EgoGraph - Maple Help

GraphTheory

 EgoGraph
 find subgraph within specified distance of vertex

 Calling Sequence EgoGraph(G, V, dist, opts)

Parameters

 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

Options

 • 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.

Description

 • 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.

Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $G≔\mathrm{CycleGraph}\left(7\right)$
 ${G}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 7 vertices and 7 edge\left(s\right)}}$ (1)
 > $\mathrm{EgoGraph}\left(G,1,2\right)$
 ${\mathrm{Graph 2: an undirected unweighted graph with 7 vertices and 7 edge\left(s\right)}}$ (2)
 > $\mathrm{EgoGraph}\left(G,1,3\right)$
 ${\mathrm{Graph 3: an undirected unweighted graph with 7 vertices and 7 edge\left(s\right)}}$ (3)
 > $\mathrm{DG}≔\mathrm{Digraph}\left(\mathrm{Trail}\left(1,2,3,4,5,3\right),\mathrm{Trail}\left(1,5,2,4,1\right)\right)$
 ${\mathrm{DG}}{≔}{\mathrm{Graph 4: a directed unweighted graph with 5 vertices and 9 arc\left(s\right)}}$ (4)
 > $\mathrm{EgoGraph}\left(\mathrm{DG},2,2\right)$
 ${\mathrm{Graph 5: a directed unweighted graph with 5 vertices and 9 arc\left(s\right)}}$ (5)
 > $\mathrm{EgoGraph}\left(\mathrm{DG},2,2,\mathrm{direction}=\mathrm{incoming}\right)$
 ${\mathrm{Graph 6: a directed unweighted graph with 5 vertices and 9 arc\left(s\right)}}$ (6)

Compatibility

 • The GraphTheory[EgoGraph] command was introduced in Maple 2021.