Skip to content

Latest commit

 

History

History
48 lines (35 loc) · 1.78 KB

File metadata and controls

48 lines (35 loc) · 1.78 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"}]

Out[] = ... 5x5 grid graph, directed and circular on different dimensions ...

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

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

Out[] = ... 3x6 grid graph, directed and circular on the first dimension ...

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]

Out[] = ... 4x5x2 grid graph with vertices labeled by their coordinates ...

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}]

Out[] = ... 4x5x2 grid graph with edges colored red, green, and blue in different directions ...