Eclipse Draw2d
3.1

org.eclipse.draw2d.internal.graph
Class GraphUtilities

java.lang.Object
  extended byorg.eclipse.draw2d.internal.graph.GraphUtilities

public class GraphUtilities
extends Object

Some utility methods for graphs.

Since:
2.1.2

Constructor Summary
GraphUtilities()
           
 
Method Summary
static boolean isCyclic(DirectedGraph graph)
          Returns true if the given graph contains at least one cycle.
static boolean isCyclic(NodeList nodes)
          Recursively removes leaf nodes from the list until there are no nodes remaining (acyclic) or there are no leaf nodes but the list is not empty (cyclic), then returns the result.
static int numberOfCrossingsInGraph(DirectedGraph graph)
          Counts the number of edge crossings in a DirectedGraph
static int numberOfCrossingsInRank(Rank rank)
          Counts the number of edge crossings in a Rank
static boolean willCauseCycle(Node source, Node target)
          Returns true if adding an edge between the 2 given nodes will introduce a cycle in the containing graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphUtilities

public GraphUtilities()
Method Detail

isCyclic

public static boolean isCyclic(DirectedGraph graph)
Returns true if the given graph contains at least one cycle.

Parameters:
graph - the graph to test
Returns:
whether the graph is cyclic

isCyclic

public static boolean isCyclic(NodeList nodes)
Recursively removes leaf nodes from the list until there are no nodes remaining (acyclic) or there are no leaf nodes but the list is not empty (cyclic), then returns the result.

Parameters:
nodes - the list of nodes to test
Returns:
whether the graph is cyclic

numberOfCrossingsInGraph

public static int numberOfCrossingsInGraph(DirectedGraph graph)
Counts the number of edge crossings in a DirectedGraph

Parameters:
graph - the graph whose crossed edges are counted
Returns:
the number of edge crossings in the graph

numberOfCrossingsInRank

public static int numberOfCrossingsInRank(Rank rank)
Counts the number of edge crossings in a Rank

Parameters:
rank - the rank whose crossed edges are counted
Returns:
the number of edge crossings in the rank

willCauseCycle

public static boolean willCauseCycle(Node source,
                                     Node target)
Returns true if adding an edge between the 2 given nodes will introduce a cycle in the containing graph.

Parameters:
source - the potential source node
target - the potential target node
Returns:
whether an edge between the 2 given nodes will introduce a cycle

Eclipse Draw2d
3.1

Copyright (c) IBM Corp. and others 2000, 2005. All Rights Reserved.