GraphTheory - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/HasArc

GraphTheory

  

HasArc

  

HasEdge

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

HasArc(G, e)

HasArc(G, a)

HasEdge(G, e)

HasEdge(G, a)

Parameters

G

-

graph

e

-

edge - a set of two vertices in G

a

-

arc (directed edge) - a list of two vertices in G

Description

• 

If e = {u,v} then HasEdge(G,e) returns true if the undirected graph G contains the (undirected) edge {u,v}, and false otherwise.

• 

If a = [u,v], a directed edge, HasEdge(G,a) returns true if the undirected graph G has the undirected edge {u,v} in it.

• 

If a = [u,v], HasArc(G,a) returns true if the directed graph G has the directed edge from vertex u to v in it, and false otherwise.

• 

If e = {u,v}, HasArc(G,a) returns true if the directed graph G has both edges [u,v] and [v,u] in it, and false otherwise.

• 

Because the data structure for a graph is an array of sets of neighbors, the test for edge membership uses binary search and hence the cost is O(log k) where k is the number of neighbors.

Examples

withGraphTheory:

GGraph1,2,1,4,2,3,3,4

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

(1)

HasEdgeG,1,2

true

(2)

HasEdgeG,2,1

true

(3)

HasEdgeG,1,3

false

(4)

NGraph1,2,2,3,3,4,4,1

NGraph 2: a directed unweighted graph with 4 vertices and 4 arc(s)

(5)

HasArcN,1,2

true

(6)

HasArcN,2,1

false

(7)

HasEdgeG,1,3

false

(8)

See Also

AddArc

AddEdge

DeleteArc

DeleteEdge

Graph

HighlightEdges