GraphEdge

Edges are 1 of the 2 fundamental components in a graph. 1 edge connect 2 nodes.

adjacentEdges

Get an array of edges that share a node in common with this edge

Examples

var adjacent = edge.adjacentEdges()

Returns Array<GraphEdge> array of adjacent edges

adjacentNodes

Get the two nodes of this edge

Examples

var adjacent = edge.adjacentNodes()

Returns Array<GraphNode> the two nodes of this edge

isAdjacentToEdge

Test if an edge is connected to another edge by a common node

Parameters

Examples

var isAdjacent = edge.isAdjacentToEdge(anotherEdge)

Returns boolean true or false, adjacent or not

isSimilarToEdge

Test if an edge contains the same nodes as another edge

Parameters

Examples

var isSimilar = edge.isSimilarToEdge(anotherEdge)

Returns boolean true or false, similar or not

otherNode

A convenience function, supply one of the edge's incident nodes and get back the other node

Parameters

Examples

var node2 = edge.otherNode(node1)

Returns GraphNode the node that is the other node

isCircular

Test if an edge points both at both ends to the same node

Examples

var isCircular = edge.isCircular()

Returns boolean true or false, circular or not

duplicateEdges

If this is a edge with duplicate edge(s), returns an array of duplicates not including self

Examples

var array = edge.duplicateEdges()

Returns Array<GraphEdge> array of duplicate GraphEdge, empty array if none

commonNodeWithEdge

For adjacent edges, get the node they share in common

Parameters

Examples

var sharedNode = edge1.commonNodeWithEdge(edge2)

Returns GraphNode the node in common, undefined if not adjacent

uncommonNodeWithEdge

For adjacent edges, get this edge's node that is not shared in common with the other edge

Parameters

Examples

var notSharedNode = edge1.uncommonNodeWithEdge(edge2)

Returns GraphNode the node on this edge not shared by the other edge, undefined if not adjacent