prefuse.util
Class GraphLib

java.lang.Object
  extended by prefuse.util.GraphLib

public class GraphLib
extends java.lang.Object

Library routines for creating various Graph structures. All Graphs generated by methods of this class include a String-valued "label" field.

Author:
jeffrey heer

Field Summary
static java.lang.String LABEL
          Label data field included in generated Graphs
static Schema LABEL_SCHEMA
          Node table schema used for generated Graphs
 
Method Summary
static Tree getBalancedTree(int breadth, int depth)
          Returns a balanced tree of the requested breadth and depth.
static Graph getClique(int n)
          Returns a clique of given size.
static Tree getDiamondTree(int b, int d1, int d2)
          Create a diamond tree, with a given branching factor at each level, and depth levels for the two main branches.
static Graph getGrid(int m, int n)
          Returns a graph structured as an m-by-n grid.
static Graph getHoneycomb(int levels)
           
static Tree getLeftDeepTree(int depth)
          Returns a left deep binary tree
static Graph getNodes(int n)
          Builds a completely unconnected (edge-free) graph with the given number of nodes
static Tree getRightDeepTree(int depth)
          Returns a right deep binary tree
static Graph getStar(int n)
          Builds a "star" graph with one central hub connected to the given number of satellite nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LABEL

public static final java.lang.String LABEL
Label data field included in generated Graphs

See Also:
Constant Field Values

LABEL_SCHEMA

public static final Schema LABEL_SCHEMA
Node table schema used for generated Graphs

Method Detail

getNodes

public static Graph getNodes(int n)
Builds a completely unconnected (edge-free) graph with the given number of nodes

Parameters:
n - the number of nodes
Returns:
a graph with n nodes and no edges

getStar

public static Graph getStar(int n)
Builds a "star" graph with one central hub connected to the given number of satellite nodes.

Parameters:
n - the number of points of the star
Returns:
a "star" graph with n points, for a total of n+1 nodes

getClique

public static Graph getClique(int n)
Returns a clique of given size. A clique is a graph in which every node is a neighbor of every other node.

Parameters:
n - the number of nodes in the graph
Returns:
a clique of size n

getGrid

public static Graph getGrid(int m,
                            int n)
Returns a graph structured as an m-by-n grid.

Parameters:
m - the number of rows of the grid
n - the number of columns of the grid
Returns:
an m-by-n grid structured graph

getHoneycomb

public static Graph getHoneycomb(int levels)

getBalancedTree

public static Tree getBalancedTree(int breadth,
                                   int depth)
Returns a balanced tree of the requested breadth and depth.

Parameters:
breadth - the breadth of each level of the tree
depth - the depth of the tree
Returns:
a balanced tree

getLeftDeepTree

public static Tree getLeftDeepTree(int depth)
Returns a left deep binary tree

Parameters:
depth - the depth of the tree
Returns:
the generated tree

getRightDeepTree

public static Tree getRightDeepTree(int depth)
Returns a right deep binary tree

Parameters:
depth - the depth of the tree
Returns:
the generated Tree

getDiamondTree

public static Tree getDiamondTree(int b,
                                  int d1,
                                  int d2)
Create a diamond tree, with a given branching factor at each level, and depth levels for the two main branches.

Parameters:
b - the number of children of each branch node
d1 - the length of the first (left) branch
d2 - the length of the second (right) branch
Returns:
the generated Tree


Copyright © 2007 Regents of the University of California