lcz

1039 Reputation

12 Badges

6 years, 161 days
changsha, China

MaplePrimes Activity


These are questions asked by lcz

Essentially, this issue is only about how to make the graph look relatively more aesthetically pleasing.

It seems that the color of the arrowheads in a directed graph is consistent with the color of the edges, and their shape also seems to be unchangeable. I wonder if I missed something.

with(GraphTheory):
G := Digraph({[1, 2], [2, 3], [3, 4], [4, 1]});
DrawGraph(G, stylesheet=[vertexborder=false,vertexpadding=5,edgecolor = "Black",vertexcolor="MistyRose",edgethickness=2],size=[250,250]);

 

For example, I would like to draw it in the following style, where the arrowhead color of the directed edge "[1,2]" is red, and the arrowhead of the edge [3,4] is hollow.

Interestingly, the layer where the arrowhead is located seems to always be below the layer of the straight edge, making it impossible to cover it. I prefer the following style (adjusted using Inkscape).

 

 

 

 

 

 

 

 

 

 

Of course, it would be better if the two black arrowheads could be further apart. This can be easily achieved with other vector software. I wonder if it is easy to implement in Maple.

I obtain the adjacency matrix from a graph. We know that it is indexed according to the order of vertices in the Vertices. But what if I want to rearrange it in a different order? Here is a specific example.

with(GraphTheory):
g:=Graph({{2,3},{1,2}});
Vertices(g); #[1,2,3]
AdjacencyMatrix(g);

I would like to display this matrix in the order of [3, 1, 2].

Vertex disjoint paths are paths that only share their first and last vertices.  In Maple, we can compute the maximum number of pairwise vertex disjoint paths from x to y by the function MaxFlow.  

For example:

with(GraphTheory):
with(SpecialGraphs):
g:=IcosahedronGraph():
HighlightVertex(g, {1,7},"DodgerBlue"):
DrawGraph(g);
g1:=MakeWeighted(g);
mxf:=MaxFlow(g1,1,7)

5

Matrix(12, 12, [[0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0], [0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0], [0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0]])

So  we know that the maximum number  of vertex-disjoint paths between vertices "1" and "7" is 5. 

But can we obtain more information from MaxFlow, such as finding  five (i.e., the maximum number) vertex-disjoint paths between vertices "1" and "7" ? (These five paths may not be unique.)

Here is a set of five vertex-disjoint paths connecting vertices "1" and "7" that I observed manually, each marked with a different color.

Here are all non-isomorphic 3-regular vertex-transitive graphs with 62 vertices. I wanted to draw them all at once, but I found that tables cannot use the map function.

with(GraphTheory):
CubicVT[1] := Graph({{23,60}, {37,6}, {36,27}, {61,19}, {60,29}, {2,52},
{40,43}, {23,25}, {45,50}, {1,30}, {11,17}, {13,41}, {34,4}, {11,54}, {26,49}, 
{56,2}, {49,51}, {3,21}, {47,28}, {24,52}, {13,7}, {48,27}, {51,42}, {4,60}, 
{55,45}, {46,21}, {46,38}, {57,14}, {4,31}, {24,8}, {47,20}, {44,5}, {55,43}, 
{30,31}, {18,41}, {17,42}, {46,37}, {36,16}, {8,43}, {58,30}, {17,53}, {25,5}, 
{5,31}, {24,9}, {9,53}, {22,26}, {35,50}, {48,20}, {12,36}, {33,13}, {12,58}, 
{33,29}, {35,14}, {3,19}, {41,42}, {14,10}, {25,21}, {37,32}, {2,48}, {52,10}, 
{61,10}, {57,58}, {38,7}, {3,62}, {29,51}, {35,8}, {39,32}, {49,6}, {1,27}, 
{39,40}, {12,50}, {56,53}, {59,62}, {34,15}, {18,9}, {1,28}, {22,55}, {33,15}, 
{39,7}, {44,57}, {59,38}, {11,26}, {45,54}, {15,59}, {44,19}, {47,62}, {16,54}, {61,20}, {23,6}, {56,16}, {22,32}, {18,40}, {34,28}});

CubicVT[2] := Graph({{39,7}, {18,41}, {11,17}, {22,32}, {46,29}, {24,8},
{18,40}, {44,19}, {55,43}, {23,25}, {45,9}, {46,38}, {59,38}, {13,6}, {39,51}, 
{48,27}, {56,16}, {57,58}, {25,21}, {52,10}, {17,43}, {22,41}, {61,20}, {15,59},
{14,27}, {39,32}, {24,54}, {42,32}, {17,53}, {56,35}, {41,42}, {34,15}, {2,52}, 
{40,43}, {33,13}, {36,10}, {44,28}, {49,6}, {56,2}, {45,54}, {25,15}, {2,50}, 
{58,20}, {61,30}, {57,48}, {48,20}, {47,62}, {35,8}, {37,6}, {13,7}, {4,31}, 
{47,28}, {35,50}, {1,19}, {49,7}, {60,29}, {61,19}, {51,42}, {11,26}, {55,45}, 
{3,4}, {36,27}, {16,54}, {9,53}, {11,40}, {47,5}, {14,10}, {23,59}, {16,8}, 
{5,31}, {24,9}, {12,36}, {3,21}, {62,31}, {22,26}, {33,37}, {57,14}, {46,37}, 
{34,21}, {1,28}, {12,52}, {34,4}, {44,5}, {12,50}, {38,60}, {55,53}, {23,60}, 
{1,30}, {58,30}, {33,29}, {3,62}, {26,18}, {49,51}});

CubicVT[3] := Graph({{23,60}, {37,6}, {38,51}, {36,27}, {61,19}, 
{60,29}, {2,52}, {40,43}, {23,25}, {1,30}, {17,39}, {11,17}, {34,4}, {33,21}, 
{23,7}, {56,2}, {1,10}, {11,8}, {49,51}, {3,21}, {47,28}, {13,7}, {48,27}, 
{25,28}, {51,42}, {55,45}, {13,26}, {46,38}, {57,14}, {4,31}, {24,8}, {44,5}, 
{55,43}, {44,27}, {2,58}, {15,6}, {18,41}, {46,37}, {58,30}, {17,53}, {5,31}, 
{24,9}, {9,53}, {22,26}, {35,50}, {48,20}, {12,36}, {33,13}, {18,54}, {50,53}, 
{24,36}, {33,29}, {3,30}, {41,42}, {14,10}, {25,21}, {20,31}, {12,61}, {52,10}, 
{57,58}, {3,62}, {35,8}, {39,32}, {49,6}, {29,32}, {12,50}, {56,43}, {55,42}, 
{22,9}, {34,15}, {1,28}, {39,7}, {45,52}, {59,5}, {59,38}, {57,47}, {60,62}, 
{11,26}, {37,41}, {35,48}, {45,54}, {15,59}, {44,19}, {47,62}, {16,54}, {46,4}, 
{61,20}, {14,16}, {56,16}, {34,19}, {22,32}, {18,40}, {49,40}});

CubicVT[4] := Graph({{13,9}, {39,7}, {18,41}, {33,28}, {11,17}, {39,8}, 
{22,32}, {24,8}, {18,40}, {44,35}, {44,19}, {55,43}, {23,25}, {46,38}, {59,38}, 
{34,27}, {2,47}, {12,31}, {48,27}, {7,62}, {56,16}, {57,58}, {25,21}, {52,10}, 
{3,10}, {61,20}, {15,59}, {45,58}, {5,6}, {39,32}, {17,53}, {41,42}, {34,15}, 
{2,52}, {59,20}, {48,53}, {40,43}, {38,40}, {33,13}, {49,6}, {56,2}, {45,54}, 
{1,16}, {48,20}, {55,37}, {47,62}, {35,8}, {14,43}, {37,6}, {13,7}, {4,31}, 
{47,28}, {35,50}, {60,29}, {61,19}, {51,42}, {24,61}, {22,50}, {11,26}, {55,45},
{11,36}, {4,51}, {49,54}, {36,27}, {16,54}, {9,53}, {14,10}, {5,31}, {24,9}, 
{12,36}, {21,32}, {3,21}, {18,52}, {22,26}, {15,41}, {56,42}, {17,29}, {57,14}, 
{46,37}, {1,28}, {34,4}, {44,5}, {23,26}, {12,50}, {60,30}, {23,60}, {1,30}, 
{58,30}, {33,29}, {3,62}, {57,25}, {46,19}, {49,51}});

CubicVT[5] := Graph({{39,7}, {18,41}, {11,17}, {22,32}, {24,8}, {18,40},
{44,19}, {56,49}, {55,43}, {23,25}, {52,42}, {2,3}, {14,18}, {59,38}, {46,38}, 
{62,32}, {48,27}, {56,16}, {26,21}, {15,40}, {57,58}, {25,21}, {58,43}, {33,30},
{52,10}, {22,36}, {61,20}, {15,59}, {13,8}, {39,32}, {28,7}, {17,53}, {41,42}, 
{23,17}, {34,15}, {2,52}, {40,43}, {33,13}, {49,6}, {56,2}, {45,54}, {47,16}, 
{25,10}, {12,34}, {61,53}, {5,51}, {48,20}, {39,50}, {47,62}, {35,31}, {35,8}, 
{37,6}, {13,7}, {4,31}, {47,28}, {35,50}, {60,29}, {61,19}, {51,42}, {11,26}, 
{57,60}, {55,45}, {6,19}, {44,24}, {36,27}, {16,54}, {9,53}, {14,10}, {5,31}, 
{24,9}, {12,36}, {11,48}, {3,21}, {22,26}, {29,9}, {57,14}, {46,37}, {1,28}, 
{55,38}, {46,20}, {34,4}, {59,27}, {4,41}, {44,5}, {1,45}, {12,50}, {23,60}, 
{1,30}, {58,30}, {33,29}, {3,62}, {49,51}, {37,54}});

CubicVT[6] := Graph({{39,7}, {57,54}, {18,41}, {11,17}, {22,32}, {24,8},
{18,40}, {44,19}, {55,43}, {11,33}, {23,25}, {4,48}, {46,38}, {59,38}, {12,17}, 
{47,29}, {48,27}, {56,16}, {57,58}, {25,21}, {52,10}, {16,41}, {61,20}, {15,59},
{35,26}, {56,30}, {39,32}, {6,43}, {17,53}, {41,42}, {34,15}, {2,52}, {27,9}, 
{40,43}, {33,13}, {14,62}, {49,6}, {56,2}, {34,49}, {45,54}, {13,3}, {28,52}, 
{48,20}, {47,62}, {35,8}, {7,53}, {37,6}, {13,7}, {4,31}, {47,28}, {35,50}, 
{60,29}, {2,40}, {61,19}, {51,42}, {58,21}, {11,26}, {55,45}, {22,60}, {1,23}, 
{25,39}, {36,27}, {16,54}, {46,18}, {9,53}, {14,10}, {36,5}, {5,31}, {37,31}, 
{24,9}, {12,36}, {24,32}, {55,10}, {8,20}, {15,61}, {3,21}, {44,38}, {22,26}, 
{57,14}, {45,51}, {46,37}, {1,28}, {34,4}, {44,5}, {12,50}, {50,19}, {23,60}, 
{1,30}, {59,42}, {58,30}, {33,29}, {3,62}, {49,51}});

CubicVT[7] := Graph({{27,20}, {57,30}, {24,53}, {19,20}, {37,49}, 
{13,29}, {11,17}, {56,52}, {24,8}, {18,40}, {44,19}, {57,10}, {55,43}, {28,62}, 
{6,51}, {46,38}, {33,7}, {18,42}, {48,27}, {56,16}, {4,5}, {57,58}, {25,21}, 
{11,22}, {12,27}, {25,60}, {61,20}, {44,31}, {62,21}, {15,59}, {17,9}, {39,32}, 
{41,42}, {2,10}, {2,52}, {37,38}, {11,53}, {36,50}, {45,54}, {46,6}, {2,16}, 
{44,61}, {14,58}, {26,32}, {5,19}, {48,61}, {37,6}, {13,7}, {47,28}, {49,42}, 
{35,50}, {3,47}, {12,35}, {4,15}, {23,29}, {55,54}, {34,59}, {55,40}, {1,58}, 
{46,59}, {45,16}, {9,53}, {8,9}, {40,41}, {22,39}, {14,10}, {45,43}, {5,31}, 
{12,36}, {56,54}, {23,21}, {24,35}, {50,8}, {28,30}, {18,43}, {34,31}, {22,26}, 
{7,32}, {3,25}, {14,52}, {15,38}, {26,17}, {34,4}, {1,47}, {33,60}, {23,60}, 
{1,30}, {33,29}, {3,62}, {51,41}, {36,48}, {49,51}, {13,39}});

 

DrawGraph~(CubicVT)

Error, invalid input: GraphTheory:-DrawGraph expects its 1st argument, H, to be of type {GRAPHLN, list(GRAPHLN), set(GRAPHLN)}, but received Graph({{1, 30}, {1, 47}, {1, 58}, {2, 10}, {2, 16}, {2, 52}, {3, 25}, {3, 47}, {3, 62}, {4, 5}, {4, 15}, {4, 34}, {5, 19}, {5, 31}, {6, 37}, {6, 46}, {6, 51}, {7, 13}, {7, 32}, {7, 33}, {8, 9}, {8, 24}, {8, 50}, {9, 17}, {9, 53}, {10, 14}, {10, 57}, {11, 17}, {11, 22}, {11, 53}, {12, 27}, {12, 35}, {12, 36}, {13, 29}, {13, 39}, {14, 52}, {14, 58}, {15, 38}, {15, 59}, {16, 45}, {16, 56}, {17, 26}, {18, 40}, {18, 42}, {18, 43}, {19, 20}, {19, 44}, {20, 27}, {20, 61}, {21, 23}, {21, 25}, {21, 62}, {22, 26}...
Why can lists use the map function, but tables cannot?

DrawGraph~([seq(CubicVT[i],i=1..7)])

tablemap.mw

In graph theory, the lexicographic product  or graph composition G ∙ H of graphs G and H is a graph such that

 - the vertex set of G ∙ H is the cartesian product V(G) × V(H); 
 - and any two vertices (u,v) and (x,y) are adjacent in G ∙ H if and only if either u is adjacent with x in G or u = x and v is adjacent with y in H.

 

Given two graphs, it is easy to obtain their lexicographic product. However the inverse process does not look so easy. 

Recognition problem: Given a graph G, can we guess whether there exist graphs G_1,...,G_k such that G=G_1 ∙ ⋯ ∙G_k ?

 

I read the book "Handbook of product graphs" and wiki, that say that the recognition complexity of lexicographic products is polynomially equivalent to the graph isomorphism problem

 

For the lexicographic product, I know that there is some algorithm without codes to implement the decomposition of the lexicographic products of a graph.

  • Feigenbaum, J.; Schäffer, A. A. (1986), "Recognizing composite graphs is equivalent to testing graph isomorphism", SIAM Journal on Computing, 15 (2): 619–627, doi:10.1137/0215045 (https://www.cs.yale.edu/homes/jf/FS-SICOMP86.pdf)

However, I did not understand the algorithm process mentioned in the article, nor did I see the program implementation of this algorithm. About 5 months ago, I asked similar questions on multiple platforms, but did not receive any feedback.

The potential algorithm can help us discover some theorems, so I am very interested in the implementation of the algorithm in the above article.

 

PS:We also know that there are already polynomial algorithms for the decomposition of the cartesian product of a graph. A polynomial time algorithm for finding the prime factors of Cartesian-product graphs", Discrete Applied Mathematics, 12 (2): 123–138, doi:10.1016/0166-218X(85)90066-6, MR 0808453 and we can find the java codes for implementation of finding the prime factors of Cartesian-product graphs.

3 4 5 6 7 8 9 Last Page 5 of 26