lcz

1009 Reputation

11 Badges

5 years, 237 days
changsha, China

MaplePrimes Activity


These are replies submitted by lcz

@acer OpenMaple might be what I mean. I'm going to open up a new question in order to elaborate on my question.

@acer Great! By the way, I wonder if Maple could package some codes into executable files, even including some invisible source codes. The application scenario is that we can call an executable file generated with Maple on in own Python (or C, java...) program.

@vv I saw some vertex boundaries crowding each other in the drawing.  I'd like to tweak the picture a little bit, hopefully to make it look better. but the following codes didn't work.

with(GroupTheory):
with(GraphTheory):
g:=DrawSubgroupLattice(SmallGroup(200, 31), labels = ids, output=graph):
GraphTheory:-DrawGraph(g, size=[1200,800],
stylesheet=[vertexborder  = false,vertexfont= [Arial, 10],vertexfontcolor = black,
edgecolor= " Burlywood",edgethickness   =0.6,vertexpadding =0.5]);

So I looked at the properties of g by GetGraphAttribute , and I saw something strange.

GetGraphAttribute(g)
[highlighted_edges = {{1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8}, {1, 9}, {1, 10}, {1, 11}, {1, 12}, {1, 13}, {1, 14}, {1, 15}, {1, 16}, {1, 17}, {1, 18}, {1, 19}, {1, 20}, {2, 21}, {2, 32}, {2, 42}, {3, 22}, {3, 33}, {3, 43}, {4, 23}, {4, 34}, {4, 42}, {5, 23}, {5, 35}, {5, 43}, {6, 24}, {6, 36}, {6, 42}, {7, 25}, {7, 37}, {7, 42}, {8, 21}, {8, 38}, {8, 43}, {9, 25}, {9, 39}, {9, 43}, {10, 24}, {10, 40}, {10, 43}, {11, 22}, {11, 41}, {11, 42}, {12, 31}, {12, 48}, {12, 50}, {12, 52}, {12, 54}, {12, 56}, {12, 58}, {13, 31}, {13, 49}, {13, 51}, {13, 53}, {13, 55}, {13, 57}, {13, 59}, {14, 21}, {14, 22}, {14, 23}, {14, 24}, {14, 25}, {14, 26}, {14, 27}, {14, 28}, {14, 29}, {14, 30}, {14, 31}, {14, 44}, {14, 45}, {14, 46}, {14, 47}, {14, 60}, {14, 61}, {15, 44}, {15, 54}, {15, 57}, {15, 62}, {16, 45}, {16, 55}, {16, 56}, {16, 62}, {17, 46}, {17, 48}, {17, 51}, {17, 62}, {18, 47}, {18, 49}, {18, 50}, {18, 62}, {19, 42}, {19, 43}, {19, 58}, {19, 59}, {19, 60}, {19, 62}, {20, 32}, {20, 33}, {20, 34}, {20, 35}, {20, 36}, {20, 37}, {20, 38}, {20, 39}, {20, 40}, {20, 41}, {20, 52}, {20, 53}, {20, 61}, {20, 62}, {21, 63}, {21, 68}, {21, 83}, {22, 64}, {22, 69}, {22, 83}, {23, 65}, {23, 70}, {23, 83}, {24, 66}, {24, 71}, {24, 83}, {25, 67}, {25, 72}, {25, 83}, {26, 63}, {26, 73}, {26, 82}, {27, 65}, {27, 74}, {27, 82}, {28, 66}, {28, 75}, {28, 82}, {29, 67}, {29, 76}, {29, 82}, {30, 64}, {30, 77}, {30, 82}, {31, 63}, {31, 64}, {31, 65}, {31, 66}, {31, 67}, {31, 78}, {31, 79}, {31, 80}, {31, 81}, {31, 84}, {31, 85}, {32, 68}, {32, 86}, {33, 69}, {33, 87}, {34, 70}, {34, 86}, {35, 70}, {35, 87}, {36, 71}, {36, 86}, {37, 72}, {37, 86}, {38, 68}, {38, 87}, {39, 72}, {39, 87}, {40, 71}, {40, 87}, {41, 69}, {41, 86}, {42, 83}, {42, 86}, {43, 83}, {43, 87}, {44, 80}, {44, 90}, {45, 81}, {45, 90}, {46, 78}, {46, 90}, {47, 79}, {47, 90}, {48, 78}, {48, 88}, {49, 79}, {49, 89}, {50, 79}, {50, 88}, {51, 78}, {51, 89}, {52, 84}, {52, 88}, {53, 84}, {53, 89}, {54, 80}, {54, 88}, {55, 81}, {55, 89}, {56, 81}, {56, 88}, {57, 80}, {57, 89}, {58, 85}, {58, 88}, {59, 85}, {59, 89}, {60, 82}, {60, 83}, {60, 85}, {60, 90}, {61, 68}, {61, 69}, {61, 70}, {61, 71}, {61, 72}, {61, 73}, {61, 74}, {61, 75}, {61, 76}, {61, 77}, {61, 84}, {61, 90}, {62, 86}, {62, 87}, {62, 88}, {62, 89}, {62, 90}, {63, 91}, {63, 96}, {64, 92}, {64, 96}, {65, 93}, {65, 96}, {66, 94}, {66, 96}, {67, 95}, {67, 96}, {68, 91}, {68, 98}, {69, 92}, {69, 98}, {70, 93}, {70, 98}, {71, 94}, {71, 98}, {72, 95}, {72, 98}, {73, 91}, {73, 97}, {74, 93}, {74, 97}, {75, 94}, {75, 97}, {76, 95}, {76, 97}, {77, 92}, {77, 97}, {78, 99}, {79, 99}, {80, 99}, {81, 99}, {82, 96}, {82, 97}, {83, 96}, {83, 98}, {84, 91}, {84, 92}, {84, 93}, {84, 94}, {84, 95}, {84, 99}, {85, 96}, {85, 99}, {86, 98}, {87, 98}, {88, 99}, {89, 99}, {90, 97}, {90, 98}, {90, 99}, {91, 100}, {92, 100}, {93, 100}, {94, 100}, {95, 100}, {96, 100}, {97, 100}, {98, 100}, {99, 100}}, highlighted_vertices = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100}]

However, I noticed that the labels of vertices of g are not the above integers 1,2..100,  but the following, not sure what highlighted_vertices above means.

Vertices(g)
[`1/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `2/1`, `5/1`, `5/1`, `5/1`, `5/1`, `5/1`, `5/1`, `4/2`, `4/2`, `4/2`, `4/2`, `4/2`, `4/1`, `4/1`, `4/1`, `4/1`, `4/1`, `4/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/1`, `10/1`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `10/2`, `25/2`, `8/3`, `8/3`, `8/3`, `8/3`, `8/3`, `20/5`, `20/5`, `20/5`, `20/5`, `20/5`, `20/2`, `20/2`, `20/2`, `20/2`, `20/2`, `20/5`, `20/5`, `20/5`, `20/5`, `20/1`, `20/4`, `20/5`, `20/5`, `50/3`, `50/3`, `50/5`, `50/5`, `50/5`, `40/10`, `40/10`, `40/10`, `40/10`, `40/10`, `40/8`, `100/6`, `100/14`, `100/16`, `200/31`]

 

I'm not familiar with the group theory involved here. So I don't know what the green vertices in the above picture represent and how to get them. So I'm not going to deal with them. They should be easy to colour in by using HighlightVertex.

s:=GetVertexPositions(g):
G1:=Graph(Vertices(g),Edges(g)):
SetVertexPositions(G1,s):
DrawGraph(G1,showlabels=true,size=[1000,1000],stylesheet=[vertexborder  = false,vertexfont      = [Arial, 10],
vertexfontcolor = black,edgecolor= " Burlywood",edgethickness   =0.6,vertexpadding =0.5])

@Carl Love Yes, it worked on my computer, too. That's great. Thank you for your patient help. Thus, we can nicely extend maple's NonIsomorphicGraphs capabilities.This is also an effective way for us to think about maple calling external programs.

 

An off-topic topic

As Maple2022 supports JUPyterlab, in Jupyterlab, the above mentioned still need to be slightly changed. The following is an example of the program plantri that generates some special planar graphs.

L2:= Import~(
    StringTools:-Split(ssystem("D:/plantri52/plantri 12 -q  -g")[2], "\n")[1..-2]
   , 
    source= direct, format= "Graph6"
): 

Because the last one of  Split(ssystem("D:/plantri52/plantri 12 -q -g")[2], "\n")  will be "". It's not recognized.

@Carl Love 

The option output=list doesn't seem to support in Import. 

 

In windows computer,  I can execute the corresponding command directly because I have compiled it.

 

@Carl Love I used the following commands and I can see the generated graphs (with graph6  type) in the error messages, but the reason for the error is unknown to me.

L2:=ImportGraph(ssystem("D:/nauty27r3/geng -c -b 6 -g"),graph6, output=list):

Error, invalid input: GraphTheory:-ImportGraph expects its 1st argument, filename, to be of type {string, symbol}, but received [0, "E?Bw\nE?bo\nE?qo\nE?ro\nE?ow\nE?zO\nE?zo\nE?~o\nECR_\nECr_\nECZ?\nECZ_\nEEr_\nEEh_\nEEj_\nEEz_\nEFz_"]

L2:=Import(ssystem("!D:/nauty27r3/geng -c -b 5 -g"),graph6,output=list):

Error, invalid input: Import expects value for keyword parameter output to be of type {DataFrame, DataSeries, identical(anything,auto,DataFrame,DataSeries,Graph,plot,string,table,triangles,Array,Matrix,Vector,Vector[column],Vector[row],AudioTools:-Audio,ByteArray,ImageTools:-Image,Logic,logical,boolean_function,embed,html,xml)}, but received list

  @acer t's the first time I've seen it handled so beautifully. With your help, the following code works very well.

restart;
with(GraphTheory):
DrawGraph(CompleteGraph(10), layout = interactive,
          layoutoptions = [neutral_color = "pink", initial = spring],
          stylesheet = [vertexpadding=10,edgethickness=2,edgecolor= SteelBlue]):

@acer Sorry, I have added more details in the question. In general, the matrices I encounter are real symmetric, and the strange thing is that I don't see a command to evaluate all  numeric eigenvalues of a matrix so far.

@Carl Love Thank you for your explanation.  It is really not a good habit to delete a post that others have commented on easily, even if some posts may be belong themselves.This requires good website mechanics rather than ethical constraints.

@janhardo I think deleting a post should require 2-3 qualified members to evaluate it. MaplePrimes should  learn from mathematics stack, which can show close not to accept comments or accept rechanges rather than disappear when a question or post is not good.

In maple 2022,   IsSubgraphIsomorphic adds a  option "isomorphism"  for checking, but unfortunately returns incorrect results when the option "isomorphism" is not selected.

with(GraphTheory):
T:=DeleteEdge(CompleteGraph(7),{{1,2},{2,3},{3,1}},inplace= false): 
G:=DeleteEdge(CompleteGraph(8),{{1,2},{2,3},{3,4},{4,5},{5,6}},inplace= false): 
IsSubgraphIsomorphic(T,G);
IsSubgraphIsomorphic(T,G,isomorphism)

true

false

@acer Great! I found the size of vertex in the interactive graph  is small. So I tried to use the a option vertexpadding=30, but it was disappointing and didn't work.

with(GraphTheory):
# not work
DrawGraph(CompleteGraph(10), layout = interactive, layoutoptions = [neutral_color = "pink", initial = spring],stylesheet = [vertexpadding=30]):

# it works
DrawGraph(CompleteGraph(10), stylesheet = [vertexpadding=30]):

This is a problem that I mentioned before, including the thickness of the edges, that can't be adjusted very well. See https://www.mapleprimes.com/questions/232788--Interactive-And-Stylesheet--Conflict

@Kitonum  Thank you,  and there is nothing wrong with your code. But it's not  close to what I want. My motivation for the problem is this: sometimes the default layouts of graphs are hard to see some  substructures with some particular properties.  So I need to modify it slightly. This is particularly critical in the presentation of planar graph.

Interactive graph layout method  seems to have been introduced in  maple 2020. The Interactive layout method creates an interactive plot component with a drawing of the Graph that can have the vertices repositioned by click, or clicking and dragging.

@dharr  Thank you for letting me know. I checked the paper and  indeed  the author deduce the result you said.

Since  L+(1/n)*J is reversible, it is much faster, also as Carl Love said.

@Carl Love Your improved code is very clean and effective.
Using the pseudo-inverse method, the resistance distance between all vertices will be found at once. There will be huge wear and tear. An interesting question is whether there is a good way if we only want to know the resistance distance between two vertices.

5 6 7 8 9 10 11 Last Page 7 of 16