Edges are 1 of the 2 fundamental components in a graph. 1 edge connect 2 nodes.
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
Get the two nodes of this edge
Examples
var adjacent = edge.adjacentNodes()
Returns Array<GraphNode> the two nodes of this edge
Test if an edge is connected to another edge by a common node
Parameters
edge
GraphEdge test adjacency between this and supplied parameterExamples
var isAdjacent = edge.isAdjacentToEdge(anotherEdge)
Returns boolean true or false, adjacent or not
Test if an edge contains the same nodes as another edge
Parameters
edge
GraphEdge test similarity between this and supplied parameterExamples
var isSimilar = edge.isSimilarToEdge(anotherEdge)
Returns boolean true or false, similar or not
A convenience function, supply one of the edge's incident nodes and get back the other node
Parameters
node
GraphNode must be one of the edge's 2 nodesExamples
var node2 = edge.otherNode(node1)
Returns GraphNode the node that is the other node
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
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
For adjacent edges, get the node they share in common
Parameters
otherEdge
GraphEdge an adjacent edgeExamples
var sharedNode = edge1.commonNodeWithEdge(edge2)
Returns GraphNode the node in common, undefined if not adjacent
For adjacent edges, get this edge's node that is not shared in common with the other edge
Parameters
otherEdge
GraphEdge an adjacent edgeExamples
var notSharedNode = edge1.uncommonNodeWithEdge(edge2)
Returns GraphNode the node on this edge not shared by the other edge, undefined if not adjacent