EgoGraph - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


GraphTheory

  

EgoGraph

  

find subgraph within specified distance of vertex

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

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

withGraphTheory:

GCycleGraph7

GGraph 1: an undirected graph with 7 vertices and 7 edge(s)

(1)

EgoGraphG,1,2

Graph 2: an undirected graph with 7 vertices and 7 edge(s)

(2)

EgoGraphG,1,3

Graph 3: an undirected graph with 7 vertices and 7 edge(s)

(3)

DGDigraphTrail1,2,3,4,5,3,Trail1,5,2,4,1

DGGraph 4: a directed graph with 5 vertices and 9 arc(s)

(4)

EgoGraphDG,2,2

Graph 5: a directed graph with 5 vertices and 9 arc(s)

(5)

EgoGraphDG,2,2,direction=incoming

Graph 6: a directed graph with 5 vertices and 9 arc(s)

(6)

Compatibility

• 

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