
Search this API  
PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object y.base.Edge
public class Edge
Represents an edge, i.e., a directed connection between two nodes (represented
by instances of class Node
) in the directed graph data type Graph
.
The directed stems from the fact that an edge has a distinct source node
and a distinct target node.
Using pair notation, an edge would be written as
(<source node>, <target node>).
Most notably, an edge provides access to its source node (source()
)
and its target node (target()
).
Note that an edge can have the same node as its source and target.
Such an edge is then called "selfloop" and method isSelfLoop()
yields
true
.
Important: Class Graph is the single authority for any structural changes to the graph data type. Specifically, this means that there is no way to create or delete a node or an edge without using an actual Graph instance.
Constructor Summary  

protected 
Edge(Graph g,
Node v,
Edge e1,
Node w,
Edge e2,
int d1,
int d2)
Creates a new edge that belongs to the given graph. 
Method Summary  

Edge 
createCopy(Graph g,
Node v,
Node w)
Creates a copy of this edge that will be inserted into the given graph connecting the given source and target nodes. 
Graph 
getGraph()
Returns the graph this edge belongs to. 
int 
index()
Returns the index of this edge within its graph G. 
boolean 
isSelfLoop()
Returns true if and only if this edge is a selfloop. 
Edge 
nextInEdge()
Returns the successor of this edge in the list of incoming edges at its target node. 
Edge 
nextOutEdge()
Returns the successor of this edge in the list of outgoing edges at its source node. 
protected void 
onReinsert()
Callback method that is invoked from a graph just before this edge will be reinserted into that graph. 
Node 
opposite(Node v)
Returns the node at the opposite edge end with respect to the given node. 
Edge 
prevInEdge()
Returns the predecessor of this edge in the list of incoming edges at its target node. 
Edge 
prevOutEdge()
Returns the predecessor of this edge in the list of outgoing edges at its source node. 
Node 
source()
Returns the source node connected to this edge. 
Node 
target()
Returns the target node connected to this edge. 
java.lang.String 
toString()
Returns a String representation of this edge. 
Methods inherited from class java.lang.Object 

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait 
Constructor Detail 

protected Edge(Graph g, Node v, Edge e1, Node w, Edge e2, int d1, int d2)
e
has source node v
and target node
w
.
e
is inserted in such a way that an iteration over the edges
at node v
returns e
e1
, if d1 == AFTER
e1
, if d1 == BEFORE
,
w
returns e
e2
, if d2 == AFTER
e2
, if d2 == BEFORE
.
e1
must have source node v
and edge e2
must have target node w
.v
 The source node of the edge.e1
 An edge with source node v
.w
 The target node of the edge.e2
 An edge with target node w
.d1
 One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.d2
 One of the object insertion specifiers Graph.BEFORE
or Graph.AFTER
.Method Detail 

public Edge createCopy(Graph g, Node v, Node w)
g
 The graph the created edge will belong to.v
 The source node of the created edge.w
 The target node of the created edge.
public Graph getGraph()
null
.
public int index()
>= 0
and < G.edgeCount()
.
Note that indices are subject to change whenever the sequence of edges in a graph is modified by either removing, hiding, reinserting, or unhiding an edge, or by explicitly changing its position in the sequence.
Graph.removeEdge(Edge)
,
Graph.hide(Edge)
,
Graph.reInsertEdge(Edge)
,
Graph.unhide(Edge)
,
Graph.moveToFirst(Edge)
,
Graph.moveToLast(Edge)
public Node source()
target()
public Node target()
source()
public Node opposite(Node v)
Note that selfloops have the same node at both edge ends.
public boolean isSelfLoop()
true
if and only if this edge is a selfloop.
An edge is called a selfloop, if it is adjacent to only one node, i.e.,
source node and target node are the same.
public java.lang.String toString()
toString
in class java.lang.Object
protected void onReinsert()
public Edge nextOutEdge()
null
is returned.
prevOutEdge()
,
nextInEdge()
public Edge nextInEdge()
null
is returned.
prevInEdge()
,
nextOutEdge()
public Edge prevOutEdge()
null
is returned.
nextOutEdge()
,
prevInEdge()
public Edge prevInEdge()
null
is returned.
nextInEdge()
,
prevOutEdge()

© Copyright 20002022, yWorks GmbH. All rights reserved. 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 