Skip to content

Latest commit

 

History

History
40 lines (27 loc) · 1.4 KB

File metadata and controls

40 lines (27 loc) · 1.4 KB
Symbols and Functions > Utility Functions >

GeneralizedGridGraph

GeneralizedGridGraph is similar to GridGraph, but it allows for additional specifiers in each direction of the grid:

In[] := GeneralizedGridGraph[{5 -> "Directed", 5 -> "Circular"}]

Possible specifiers are "Directed" and "Circular", and they can be combined:

In[] := GeneralizedGridGraph[{3 -> {"Directed", "Circular"}, 6}]

The same options as GridGraph are supported. In addition "VertexNamingFunction" -> "Coordinates" names vertices according to their position in a grid:

In[] := GeneralizedGridGraph[{4, 5, 2},
 "VertexNamingFunction" -> "Coordinates", VertexLabels -> Automatic]

Finally, it's possible to use different EdgeStyle in different directions by specifying it as a list:

In[] := GeneralizedGridGraph[{4 -> "Directed", 5, 2},
 "VertexNamingFunction" -> "Coordinates",
 EdgeStyle -> Darker /@ {Red, Green, Blue}]