GraphTheory
EgoGraph
find subgraph within specified distance of vertex
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
EgoGraph(G, V, dist, opts)
G
-
graph or digraph
V
vertex or list or set of vertices
dist
real constant; distance threshold
opts
(optional) equation of the form direction=incoming or outgoing
direction = one of incoming or outgoing
When G is directed, specifies the direction of the directed path used to define which vertices of G are included in the result.
If direction=outgoing, a vertex w is included in the result if there is a directed path from some vertex in V to w. If direction=incoming, w is included in the result if there is a directed path from w to some vertex in V.
The default is direction=outgoing.
EgoGraph(G, V, dist) returns the induced subgraph of G defined by those vertices of G which are within distance dist from any of vertices referenced in V.
If G is undirected, EgoGraph(G, V, dist) returns a subgraph of G in which a vertex w is present if there exists a path from some vertex in V to w whose length is less than or equal to dist.
If G is directed, EgoGraph(G, V, dist) returns a subgraph of G in which a vertex w is present if there exists a directed path from some vertex in V to w whose length is less than or equal to dist.
If G is weighted, these paths are weighted paths.
If dist is not specified, a default value of 1 is assumed.
with⁡GraphTheory:
G≔CycleGraph⁡7
G≔Graph 1: an undirected graph with 7 vertices and 7 edge(s)
EgoGraph⁡G,1,2
Graph 2: an undirected graph with 7 vertices and 7 edge(s)
EgoGraph⁡G,1,3
Graph 3: an undirected graph with 7 vertices and 7 edge(s)
DG≔Digraph⁡Trail⁡1,2,3,4,5,3,Trail⁡1,5,2,4,1
DG≔Graph 4: a directed graph with 5 vertices and 9 arc(s)
EgoGraph⁡DG,2,2
Graph 5: a directed graph with 5 vertices and 9 arc(s)
EgoGraph⁡DG,2,2,direction=incoming
Graph 6: a directed graph with 5 vertices and 9 arc(s)
The GraphTheory[EgoGraph] command was introduced in Maple 2021.
For more information on Maple 2021 changes, see Updates in Maple 2021.
See Also
InducedSubgraph
Neighbors
Reachable
Download Help Document