Java Doc for Graph.java in  » Database-Client » prefuse » prefuse » data » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » prefuse » prefuse.data 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


prefuse.data.tuple.CompositeTupleSet
   prefuse.data.Graph

All known Subclasses:   prefuse.data.Tree,  prefuse.visual.VisualGraph,
Graph
public class Graph extends CompositeTupleSet (Code)

A Graph models a network of nodes connected by a collection of edges. Both nodes and edges can have any number of associated data fields. Additionally, edges are either directed or undirected, indicating a possible directionality of the connection. Each edge has both a source node and a target node, for a directed edge this indicates the directionality, for an undirected edge this is just an artifact of the order in which the nodes were specified when added to the graph.

Both nodes and edges are represented by backing data Table instances storing the data attributes. For edges, this table must also contain a source node field and a target node field. The default column name for these fields are Graph.DEFAULT_SOURCE_KEY and Graph.DEFAULT_TARGET_KEY , but these can be configured by the graph constructor. These columns should be integer valued, and contain either the row number for a corresponding node in the node table, or another unique identifier for a node. In this second case, the unique identifier must be included as a data field in the node table. This name of this column can be configured using the appropriate graph constructor. The default column name for this field is Graph.DEFAULT_NODE_KEY , which by default evaluates to null, indicating that no special node key should be used, just the direct node table row numbers. Though the source, target, and node key values completely specify the graph linkage structure, to make graph operations more efficient an additional table is maintained internally by the Graph class, storing node indegree and outdegree counts and adjacency lists for the inlinks and outlinks for all nodes.

Graph nodes and edges can be accessed by application code by either using the row numbers of the node and edge tables, which provide unique ids for each, or using the prefuse.data.Node and prefuse.data.Edge classes -- prefuse.data.Tuple instances that provide object-oriented access to both node or edge data values and the backing graph structure. Node and Edge tuples are maintained by special TupleManager instances contained within this Graph. By default, they are not accessible from the backing node or edge tables directly. The reason for this is that these tables might be used in multiple graphs simultaneously. For example, a node data table could be used in a number of different graphs, exploring different possible linkages between those node. In short, use this Graph instance to request iterators over Node or Edge tuples, not the backing data tables.

All Graph instances also support an internally generated spanning tree, provided by the Graph.getSpanningTree() or Graph.getSpanningTree(Node) methods. This is particularly useful in visualization contexts that use an underlying tree structure to compute a graph layout.


author:
   jeffrey heer

Inner Class :protected class Listener implements TableListener,ColumnListener

Field Summary
final public static  StringDEFAULT_NODE_KEY
    
final public static  StringDEFAULT_SOURCE_KEY
    
final public static  StringDEFAULT_TARGET_KEY
    
final public static  StringEDGES
    
final protected static  StringINDEGREE
    
final public static  intINEDGES
    
final protected static  StringINLINKS
    
final protected static  SchemaLINKS_SCHEMA
    
final public static  StringNODES
    
final protected static  StringOUTDEGREE
    
final public static  intOUTEDGES
    
final protected static  StringOUTLINKS
    
final public static  intUNDIRECTED
    
protected  booleanm_directed
    
protected  TupleManagerm_edgeTuples
    
protected  Tablem_links
    
protected  booleanm_longKey
    
protected  Indexm_nidx
    
protected  Stringm_nkey
    
protected  TupleManagerm_nodeTuples
    
protected  Stringm_skey
    
protected  SpanningTreem_spanning
    
protected  Stringm_tkey
    

Constructor Summary
public  Graph()
     Creates a new, empty undirected Graph.
public  Graph(boolean directed)
     Creates a new, empty Graph.
public  Graph(Table nodes, boolean directed)
     Create a new Graph using the provided table of node data and an empty set of edges.
public  Graph(Table nodes, boolean directed, String nodeKey, String sourceKey, String targetKey)
     Create a new Graph using the provided table of node data and an empty set of edges.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected
Parameters:
  nodeKey - data field used to uniquely identify a node.
public  Graph(Table nodes, Table edges, boolean directed)
     Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
public  Graph(Table nodes, Table edges, boolean directed, String sourceKey, String targetKey)
     Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
public  Graph(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey)
     Create a new Graph.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected
Parameters:
  nodeKey - data field used to uniquely identify a node.

Method Summary
public  intaddEdge(int s, int t)
     Add an edge to the graph.
public  EdgeaddEdge(Node s, Node t)
     Add an edge to the graph.
public  voidaddGraphModelListener(GraphListener listnr)
     Add a listener to be notified of changes to the graph.
protected  voidaddLink(String field, int len, int n, int e)
    
public  NodeaddNode()
     Add a new node to the graph.
public  intaddNodeRow()
     Add row to the node table, thereby adding a node to the graph.
public  voidclear()
     Clear this graph, removing all nodes and edges.
protected  voidclearEdges()
     Internal method for clearing the edge table, removing all edges.
public  voidclearSpanningTree()
     Clear the internally stored spanning tree.
protected  TablecreateLinkTable()
     Instantiate and return the link table.
public  voiddispose()
     Dispose of this graph.
protected  booleanedgeCheck(Edge e, boolean throwException)
     Internal method for checking the validity of an edge.
public  IntIteratoredgeRows()
     Get an iterator over all edge ids (edge table row numbers).
public  IntIteratoredgeRows(int node)
     Get an iterator over all edge ids for edges incident on the given node.
public  IntIteratoredgeRows(int node, int direction)
     Get an iterator edge ids for edges incident on the given node.
Parameters:
  node - a node id (node table row number)
Parameters:
  direction - the directionality of the edges to include.
public  Iteratoredges()
     Get an iterator over all edges in the graph.
public  Iteratoredges(Node node)
     Get an iterator over all Edges connected to the given Node in the graph.
protected  voidfireGraphEvent(Table t, int first, int last, int col, int type)
    
public  intgetAdjacentNode(int edge, int node)
     Given an edge id and an incident node id, return the node id for the other node connected to the edge.
Parameters:
  edge - an edge id (edge table row number)
Parameters:
  node - a node id (node table row number).
public  NodegetAdjacentNode(Edge e, Node n)
     Given an Edge and an incident Node, return the other Node connected to the edge.
Parameters:
  e - an Edge instance
Parameters:
  n - a Node instance.
public  intgetDegree(int node)
     Get the degree of a node, the number of edges for which a node is either the source or the target.
public  intgetDegree(Node n)
     Get the degree of a node, the number of edges for which a node is either the source or the target.
public  EdgegetEdge(int e)
     Get the Edge tuple instance corresponding to an edge id.
public  intgetEdge(int source, int target)
     Returns an edge from the source node to the target node.
public  EdgegetEdge(Node source, Node target)
     Get an Edge with given source and target Nodes.
public  intgetEdgeCount()
     Get the number of edges in this graph.
public  StringgetEdgeSourceField()
     Get the data field used to denote the source node in an edge table.
public  TablegetEdgeTable()
     Get the backing edge table.
public  StringgetEdgeTargetField()
     Get the data field used to denote the target node in an edge table.
public  TupleSetgetEdges()
     Get the collection of edges as a TupleSet.
public  intgetInDegree(int node)
     Get the in-degree of a node, the number of edges for which the node is the target.
public  intgetInDegree(Node n)
     Get the in-degree of a node, the number of edges for which the node is the target.
public  longgetKey(int node)
     Given a node id (a row number in the node table), get the value of the node key field.
public  NodegetNode(int n)
     Get the Node tuple instance corresponding to a node id.
public  intgetNodeCount()
     Get the number of nodes in this graph.
public  NodegetNodeFromKey(long key)
     Get the Node tuple corresponding to the input node key field value.
public  intgetNodeIndex(long key)
     Given a value of the node key field, get the node id (the row number in the node table).
public  StringgetNodeKeyField()
    
public  TablegetNodeTable()
     Get the backing node table.
public  TupleSetgetNodes()
     Get the collection of nodes as a TupleSet.
public  intgetOutDegree(int node)
     Get the out-degree of a node, the number of edges for which the node is the source.
public  intgetOutDegree(Node n)
     Get the out-degree of a node, the number of edges for which the node is the source.
public  intgetSourceNode(int edge)
     Get the source node id (node table row number) for the given edge id (edge table row number).
public  NodegetSourceNode(Edge e)
     Get the source Node for the given Edge instance.
public  TreegetSpanningTree()
     Return the current spanning tree over this graph.
public  TreegetSpanningTree(Node root)
     Returns a spanning tree rooted at the specified node.
public  intgetTargetNode(int edge)
     Get the target node id (node table row number) for the given edge id (edge table row number).
public  NodegetTargetNode(Edge e)
     Get the target Node for the given Edge instance.
public  IntIteratorinEdgeRows(int node)
     Get an iterator over all edges that have the given node as a target.
public  IteratorinEdges(Node node)
     Get an iterator over all in-linking edges to the given Node.
public  IteratorinNeighbors(Node n)
     Get an iterator over all in-linking neighbor nodes for the given Node.
protected  voidinit(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey)
     Initialize this Graph instance.
protected  voidinitLinkTable()
     Initialize the link table, which holds adjacency lists for this graph.
public  booleanisDirected()
     Indicates if the edges of this graph are directed or undirected.
public  Iteratorneighbors(Node n)
     Get an iterator over all neighbor nodes for the given Node in the graph.
protected  booleannodeCheck(Node n, boolean throwException)
     Internal method for checking the validity of a node.
public  IntIteratornodeRows()
     Get an iterator over all node ids (node table row numbers).
public  Iteratornodes()
     Get an iterator over all nodes in the graph.
public  IntIteratoroutEdgeRows(int node)
     Get an iterator over all edges that have the given node as a source.
public  IteratoroutEdges(Node node)
     Get an iterator over all out-linking edges from the given Node.
public  IteratoroutNeighbors(Node n)
     Get an iterator over all out-linking neighbor nodes for the given Node.
protected  booleanremLink(String field, int len, int n, int e)
    
public  voidremoveAllGraphModelListeners()
    
public  booleanremoveEdge(int edge)
     Remove an edge from the graph.
public  booleanremoveEdge(Edge e)
     Remove an edge from the graph.
public  voidremoveGraphModelListener(GraphListener listnr)
     Remove a listener from this graph.
public  booleanremoveNode(int node)
     Remove a node from the graph, also removing all incident edges.
public  booleanremoveNode(Node n)
     Remove a node from the graph, also removing all incident edges.
public  booleanremoveTuple(Tuple t)
     If the given tuple is a Node or Edge in this graph, remove it.
public  voidsetEdgeTable(Table edges)
     Updates this graph to use a different edge structure for the same nodes.
public  voidsetTupleManagers(TupleManager ntm, TupleManager etm)
     Set the tuple managers used to manage the Node and Edge tuples of this Graph.
public  Iteratortuples(Predicate filter)
     Get a filtered iterator over the edges and nodes of this graph.
public  Iteratortuples()
     Get an iterator over all the edges and nodes of this graph.
protected  voidupdateDegrees(int e, int incr)
     Internal method for updating the linkage of this graph.
protected  voidupdateDegrees(int e, int s, int t, int incr)
     Internal method for updating the linkage of this graph.
protected  voidupdateNodeData(int r, boolean added)
    

Field Detail
DEFAULT_NODE_KEY
final public static String DEFAULT_NODE_KEY(Code)
Default data field used to uniquely identify a node



DEFAULT_SOURCE_KEY
final public static String DEFAULT_SOURCE_KEY(Code)
Default data field used to denote the source node in an edge table



DEFAULT_TARGET_KEY
final public static String DEFAULT_TARGET_KEY(Code)
Default data field used to denote the target node in an edge table



EDGES
final public static String EDGES(Code)
Data group name to identify the edges of this graph



INDEGREE
final protected static String INDEGREE(Code)
In-degree data field for the links table



INEDGES
final public static int INEDGES(Code)
Indicates incoming edges (inlinks)



INLINKS
final protected static String INLINKS(Code)
In-links adjacency list data field for the links table



LINKS_SCHEMA
final protected static Schema LINKS_SCHEMA(Code)
Schema used for the internal graph linkage table



NODES
final public static String NODES(Code)
Data group name to identify the nodes of this graph



OUTDEGREE
final protected static String OUTDEGREE(Code)
Out-degree data field for the links table



OUTEDGES
final public static int OUTEDGES(Code)
Indicates outgoing edges (outlinks)



OUTLINKS
final protected static String OUTLINKS(Code)
Out-links adjacency list data field for the links table



UNDIRECTED
final public static int UNDIRECTED(Code)
Indicates all edges, regardless of direction



m_directed
protected boolean m_directed(Code)
Indicates if this graph is directed or undirected



m_edgeTuples
protected TupleManager m_edgeTuples(Code)
TupleManager for managing Edge tuple instances



m_links
protected Table m_links(Code)
Table containing the adjacency lists for the graph



m_longKey
protected boolean m_longKey(Code)
Indicates if the key values are of type long



m_nidx
protected Index m_nidx(Code)
Reference to an index over the node key field



m_nkey
protected String m_nkey(Code)
The node key field (for the Node table)



m_nodeTuples
protected TupleManager m_nodeTuples(Code)
TupleManager for managing Node tuple instances



m_skey
protected String m_skey(Code)
The source node key field (for the Edge table)



m_spanning
protected SpanningTree m_spanning(Code)
The spanning tree over this graph



m_tkey
protected String m_tkey(Code)
The target node key field (for the Edge table)




Constructor Detail
Graph
public Graph()(Code)
Creates a new, empty undirected Graph.



Graph
public Graph(boolean directed)(Code)
Creates a new, empty Graph.
Parameters:
  directed - true for directed edges, false for undirected



Graph
public Graph(Table nodes, boolean directed)(Code)
Create a new Graph using the provided table of node data and an empty set of edges.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected



Graph
public Graph(Table nodes, boolean directed, String nodeKey, String sourceKey, String targetKey)(Code)
Create a new Graph using the provided table of node data and an empty set of edges.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected
Parameters:
  nodeKey - data field used to uniquely identify a node. If thisfield is null, the node table row numbers will be used
Parameters:
  sourceKey - data field used to denote the source node in an edgetable
Parameters:
  targetKey - data field used to denote the target node in an edgetable



Graph
public Graph(Table nodes, Table edges, boolean directed)(Code)
Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected



Graph
public Graph(Table nodes, Table edges, boolean directed, String sourceKey, String targetKey)(Code)
Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected
Parameters:
  sourceKey - data field used to denote the source node in an edgetable
Parameters:
  targetKey - data field used to denote the target node in an edgetable



Graph
public Graph(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey)(Code)
Create a new Graph.
Parameters:
  nodes - the backing table to use for node data.Node instances of this graph will get their data from this table.
Parameters:
  edges - the backing table to use for edge data.Edge instances of this graph will get their data from this table.
Parameters:
  directed - true for directed edges, false for undirected
Parameters:
  nodeKey - data field used to uniquely identify a node. If thisfield is null, the node table row numbers will be used
Parameters:
  sourceKey - data field used to denote the source node in an edgetable
Parameters:
  targetKey - data field used to denote the target node in an edgetable




Method Detail
addEdge
public int addEdge(int s, int t)(Code)
Add an edge to the graph. Both multiple edges between two nodes and edges from a node to itself are allowed.
Parameters:
  s - the source node id
Parameters:
  t - the target node id the edge id (edge table row number) of the added edge



addEdge
public Edge addEdge(Node s, Node t)(Code)
Add an edge to the graph.
Parameters:
  s - the source Node
Parameters:
  t - the target Node the new Edge instance



addGraphModelListener
public void addGraphModelListener(GraphListener listnr)(Code)
Add a listener to be notified of changes to the graph.
Parameters:
  listnr - the listener to add



addLink
protected void addLink(String field, int len, int n, int e)(Code)
Internal method for adding a link to an adjacency list
Parameters:
  field - which adjacency list (inlinks or outlinks) to use
Parameters:
  len - the length of the adjacency list
Parameters:
  n - the node id of the adjacency list to use
Parameters:
  e - the edge to add to the list



addNode
public Node addNode()(Code)
Add a new node to the graph. the new Node instance



addNodeRow
public int addNodeRow()(Code)
Add row to the node table, thereby adding a node to the graph. the node id (node table row number) of the added node



clear
public void clear()(Code)
Clear this graph, removing all nodes and edges.
See Also:   prefuse.data.tuple.TupleSet.clear



clearEdges
protected void clearEdges()(Code)
Internal method for clearing the edge table, removing all edges.



clearSpanningTree
public void clearSpanningTree()(Code)
Clear the internally stored spanning tree. Any new calls to a getSpanningTree() method will generate a new spanning tree instance as needed. This method is primarily useful for subclasses. For example, calling this method on a Tree instance will revert the state to the original rooted tree such that a sbusequent call to getSpanningTree() will return the backing Tree itself.
See Also:   Graph.getSpanningTree()
See Also:   Graph.getSpanningTree(Node)
See Also:   Tree.getSpanningTree(Node)



createLinkTable
protected Table createLinkTable()(Code)
Instantiate and return the link table. the created link table



dispose
public void dispose()(Code)
Dispose of this graph. Unregisters this graph as a listener to its included tables.



edgeCheck
protected boolean edgeCheck(Edge e, boolean throwException)(Code)
Internal method for checking the validity of an edge.
Parameters:
  e - the Edge to check for validity
Parameters:
  throwException - true if this method should throw an Exceptionwhen an invalid node is encountered true is the edge is valid, false if invalid



edgeRows
public IntIterator edgeRows()(Code)
Get an iterator over all edge ids (edge table row numbers). an iterator over all edge ids (edge table row numbers)



edgeRows
public IntIterator edgeRows(int node)(Code)
Get an iterator over all edge ids for edges incident on the given node.
Parameters:
  node - a node id (node table row number) an iterator over all edge ids for edges incident on the givennode



edgeRows
public IntIterator edgeRows(int node, int direction)(Code)
Get an iterator edge ids for edges incident on the given node.
Parameters:
  node - a node id (node table row number)
Parameters:
  direction - the directionality of the edges to include. One ofGraph.INEDGES (for in-linking edges),Graph.OUTEDGES (for out-linking edges), orGraph.UNDIRECTED (for all edges). an iterator over all edge ids for edges incident on the givennode



edges
public Iterator edges()(Code)
Get an iterator over all edges in the graph. an iterator over Edge instances



edges
public Iterator edges(Node node)(Code)
Get an iterator over all Edges connected to the given Node in the graph.
Parameters:
  node - a Node in the graph an iterator over all Edges connected to the input node



fireGraphEvent
protected void fireGraphEvent(Table t, int first, int last, int col, int type)(Code)
Fire a graph change event
Parameters:
  t - the backing table where the change occurred (either anode table or an edge table)
Parameters:
  first - the first modified table row
Parameters:
  last - the last (inclusive) modified table row
Parameters:
  col - the number of the column modified, orprefuse.data.event.EventConstants.ALL_COLUMNS for operationsaffecting all columns
Parameters:
  type - the type of modification, one ofprefuse.data.event.EventConstants.INSERT,prefuse.data.event.EventConstants.DELETE, orprefuse.data.event.EventConstants.UPDATE.



getAdjacentNode
public int getAdjacentNode(int edge, int node)(Code)
Given an edge id and an incident node id, return the node id for the other node connected to the edge.
Parameters:
  edge - an edge id (edge table row number)
Parameters:
  node - a node id (node table row number). This node id mustbe connected to the edge the adjacent node id



getAdjacentNode
public Node getAdjacentNode(Edge e, Node n)(Code)
Given an Edge and an incident Node, return the other Node connected to the edge.
Parameters:
  e - an Edge instance
Parameters:
  n - a Node instance. This node mustbe connected to the edge the adjacent Node



getDegree
public int getDegree(int node)(Code)
Get the degree of a node, the number of edges for which a node is either the source or the target.
Parameters:
  node - the node id (node table row number) the total degree of the node



getDegree
public int getDegree(Node n)(Code)
Get the degree of a node, the number of edges for which a node is either the source or the target.
Parameters:
  n - the Node instance the total degree of the node



getEdge
public Edge getEdge(int e)(Code)
Get the Edge tuple instance corresponding to an edge id.
Parameters:
  e - an edge id (edge table row number) the Node instance corresponding to the node id



getEdge
public int getEdge(int source, int target)(Code)
Returns an edge from the source node to the target node. This method returns the first such edge found; in the case of multiple edges there may be more.



getEdge
public Edge getEdge(Node source, Node target)(Code)
Get an Edge with given source and target Nodes. There may be times where there are multiple edges between two nodes; in those cases this method returns the first such edge found.
Parameters:
  source - the source Node
Parameters:
  target - the target Node an Edge with given source and target nodes, or null if nosuch edge is found.



getEdgeCount
public int getEdgeCount()(Code)
Get the number of edges in this graph. the number of edges



getEdgeSourceField
public String getEdgeSourceField()(Code)
Get the data field used to denote the source node in an edge table. the data field used to denote the source node in an edge table.



getEdgeTable
public Table getEdgeTable()(Code)
Get the backing edge table. the table of edge values



getEdgeTargetField
public String getEdgeTargetField()(Code)
Get the data field used to denote the target node in an edge table. the data field used to denote the target node in an edge table.



getEdges
public TupleSet getEdges()(Code)
Get the collection of edges as a TupleSet. Returns the same result as CompositeTupleSet.getSet(String) using Graph.EDGES as the parameter. the edges of this graph as a TupleSet instance



getInDegree
public int getInDegree(int node)(Code)
Get the in-degree of a node, the number of edges for which the node is the target.
Parameters:
  node - the node id (node table row number) the in-degree of the node



getInDegree
public int getInDegree(Node n)(Code)
Get the in-degree of a node, the number of edges for which the node is the target.
Parameters:
  n - the Node instance the in-degree of the node



getKey
public long getKey(int node)(Code)
Given a node id (a row number in the node table), get the value of the node key field.
Parameters:
  node - the node id the value of the node key field for the given node



getNode
public Node getNode(int n)(Code)
Get the Node tuple instance corresponding to a node id.
Parameters:
  n - a node id (node table row number) the Node instance corresponding to the node id



getNodeCount
public int getNodeCount()(Code)
Get the number of nodes in this graph. the number of nodes



getNodeFromKey
public Node getNodeFromKey(long key)(Code)
Get the Node tuple corresponding to the input node key field value. The node key field is used to find the node id (node table row number), which is then used to retrieve the Node tuple.
Parameters:
  key - a node key field value the requested Node instance



getNodeIndex
public int getNodeIndex(long key)(Code)
Given a value of the node key field, get the node id (the row number in the node table).
Parameters:
  key - a node key field value the node id (the row number in the node table)



getNodeKeyField
public String getNodeKeyField()(Code)
Get the data field used to uniquely identify a node the data field used to uniquely identify a node



getNodeTable
public Table getNodeTable()(Code)
Get the backing node table. the table of node values



getNodes
public TupleSet getNodes()(Code)
Get the collection of nodes as a TupleSet. Returns the same result as CompositeTupleSet.getSet(String) using Graph.NODES as the parameter. the nodes of this graph as a TupleSet instance



getOutDegree
public int getOutDegree(int node)(Code)
Get the out-degree of a node, the number of edges for which the node is the source.
Parameters:
  node - the node id (node table row number) the out-degree of the node



getOutDegree
public int getOutDegree(Node n)(Code)
Get the out-degree of a node, the number of edges for which the node is the source.
Parameters:
  n - the Node instance the out-degree of the node



getSourceNode
public int getSourceNode(int edge)(Code)
Get the source node id (node table row number) for the given edge id (edge table row number).
Parameters:
  edge - an edge id (edge table row number) the source node id (node table row number)



getSourceNode
public Node getSourceNode(Edge e)(Code)
Get the source Node for the given Edge instance.
Parameters:
  e - an Edge instance the source Node of the edge



getSpanningTree
public Tree getSpanningTree()(Code)
Return the current spanning tree over this graph. If no spanning tree has been constructed, a SpanningTree rooted at the first valid node found in the node table will be generated. Spanning trees are generated using an unweighted breadth first search over the graph structure. a spanning tree over this graph
See Also:   Graph.getSpanningTree(Node)
See Also:   Graph.clearSpanningTree()



getSpanningTree
public Tree getSpanningTree(Node root)(Code)
Returns a spanning tree rooted at the specified node. If the current spanning tree is alrady rooted at the given node, it is simply returned. Otherwise, the tree is reconstructed at the new root and made the current spanning tree for this Graph instance. Spanning trees are generated using an unweighted breadth first search over the graph structure.
Parameters:
  root - the node at which to root the spanning tree. a spanning tree over this graph, rooted at the given root
See Also:   Graph.getSpanningTree()
See Also:   Graph.clearSpanningTree()



getTargetNode
public int getTargetNode(int edge)(Code)
Get the target node id (node table row number) for the given edge id (edge table row number).
Parameters:
  edge - an edge id (edge table row number) the target node id (node table row number)



getTargetNode
public Node getTargetNode(Edge e)(Code)
Get the target Node for the given Edge instance.
Parameters:
  e - an Edge instance the target Node of the edge



inEdgeRows
public IntIterator inEdgeRows(int node)(Code)
Get an iterator over all edges that have the given node as a target. That is, edges that link into the given target node.
Parameters:
  node - a node id (node table row number) an iterator over all edges that have the given node as a target



inEdges
public Iterator inEdges(Node node)(Code)
Get an iterator over all in-linking edges to the given Node.
Parameters:
  node - a Node in the graph an iterator over all in-linking edges to the input target node



inNeighbors
public Iterator inNeighbors(Node n)(Code)
Get an iterator over all in-linking neighbor nodes for the given Node.
Parameters:
  n - a Node in the graph an iterator over all Nodes that point to the input target node



init
protected void init(Table nodes, Table edges, boolean directed, String nodeKey, String sourceKey, String targetKey)(Code)
Initialize this Graph instance.
Parameters:
  nodes - the node table
Parameters:
  edges - the edge table
Parameters:
  directed - the edge directionality
Parameters:
  nodeKey - data field used to uniquely identify a node
Parameters:
  sourceKey - data field used to denote the source node in an edgetable
Parameters:
  targetKey - data field used to denote the target node in an edgetable



initLinkTable
protected void initLinkTable()(Code)
Initialize the link table, which holds adjacency lists for this graph.



isDirected
public boolean isDirected()(Code)
Indicates if the edges of this graph are directed or undirected. true if directed edges, false if undirected edges



neighbors
public Iterator neighbors(Node n)(Code)
Get an iterator over all neighbor nodes for the given Node in the graph.
Parameters:
  n - a Node in the graph an iterator over all Nodes connected to the input node



nodeCheck
protected boolean nodeCheck(Node n, boolean throwException)(Code)
Internal method for checking the validity of a node.
Parameters:
  n - the Node to check for validity
Parameters:
  throwException - true if this method should throw an Exceptionwhen an invalid node is encountered true is the node is valid, false if invalid



nodeRows
public IntIterator nodeRows()(Code)
Get an iterator over all node ids (node table row numbers). an iterator over all node ids (node table row numbers)



nodes
public Iterator nodes()(Code)
Get an iterator over all nodes in the graph. an iterator over Node instances



outEdgeRows
public IntIterator outEdgeRows(int node)(Code)
Get an iterator over all edges that have the given node as a source. That is, edges that link out from the given source node.
Parameters:
  node - a node id (node table row number) an iterator over all edges that have the given node as a source



outEdges
public Iterator outEdges(Node node)(Code)
Get an iterator over all out-linking edges from the given Node.
Parameters:
  node - a Node in the graph an iterator over all out-linking edges from the input sourcenode



outNeighbors
public Iterator outNeighbors(Node n)(Code)
Get an iterator over all out-linking neighbor nodes for the given Node.
Parameters:
  n - a Node in the graph an iterator over all Nodes pointed to by the input source node



remLink
protected boolean remLink(String field, int len, int n, int e)(Code)
Internal method for removing a link from an adjacency list
Parameters:
  field - which adjacency list (inlinks or outlinks) to use
Parameters:
  len - the length of the adjacency list
Parameters:
  n - the node id of the adjacency list to use
Parameters:
  e - the edge to remove from the list true if the link was removed successfully, false otherwise



removeAllGraphModelListeners
public void removeAllGraphModelListeners()(Code)
Removes all listeners on this graph



removeEdge
public boolean removeEdge(int edge)(Code)
Remove an edge from the graph.
Parameters:
  edge - the edge id (edge table row number) of the edge to remove true if the edge was successfully removed, false if theedge was not found or was not valid



removeEdge
public boolean removeEdge(Edge e)(Code)
Remove an edge from the graph.
Parameters:
  e - the Edge to remove from the graph true if the edge was successfully removed, false if theedge was not found in this graph



removeGraphModelListener
public void removeGraphModelListener(GraphListener listnr)(Code)
Remove a listener from this graph.
Parameters:
  listnr - the listener to remove



removeNode
public boolean removeNode(int node)(Code)
Remove a node from the graph, also removing all incident edges.
Parameters:
  node - the node id (node table row number) of the node to remove true if the node was successfully removed, false if thenode id was not found or was not valid



removeNode
public boolean removeNode(Node n)(Code)
Remove a node from the graph, also removing all incident edges.
Parameters:
  n - the Node to remove from the graph true if the node was successfully removed, false if thenode was not found in this graph



removeTuple
public boolean removeTuple(Tuple t)(Code)
If the given tuple is a Node or Edge in this graph, remove it.
See Also:   prefuse.data.tuple.TupleSet.removeTuple(prefuse.data.Tuple)



setEdgeTable
public void setEdgeTable(Table edges)(Code)
Updates this graph to use a different edge structure for the same nodes. All other settings will remain the same (e.g., directionality, keys)
Parameters:
  edges - the new edge table.



setTupleManagers
public void setTupleManagers(TupleManager ntm, TupleManager etm)(Code)
Set the tuple managers used to manage the Node and Edge tuples of this Graph.
Parameters:
  ntm - the TupleManager to use for nodes
Parameters:
  etm - the TupleManager to use for edges



tuples
public Iterator tuples(Predicate filter)(Code)
Get a filtered iterator over the edges and nodes of this graph.
See Also:   prefuse.data.tuple.TupleSet.tuples(prefuse.data.expression.Predicate)



tuples
public Iterator tuples()(Code)
Get an iterator over all the edges and nodes of this graph. The iterator will return all edges first, then all nodes.
See Also:   prefuse.data.tuple.TupleSet.tuples



updateDegrees
protected void updateDegrees(int e, int incr)(Code)
Internal method for updating the linkage of this graph.
Parameters:
  e - the edge id for the updated link
Parameters:
  incr - the increment value, 1 for an added link,-1 for a removed link



updateDegrees
protected void updateDegrees(int e, int s, int t, int incr)(Code)
Internal method for updating the linkage of this graph.
Parameters:
  e - the edge id for the updated link
Parameters:
  s - the source node id for the updated link
Parameters:
  t - the target node id for the updated link
Parameters:
  incr - the increment value, 1 for an added link,-1 for a removed link



updateNodeData
protected void updateNodeData(int r, boolean added)(Code)
Update the link table to accomodate an inserted or deleted node
Parameters:
  r - the node id, also the row number into the link table
Parameters:
  added - indicates if a node was added or removed



Methods inherited from prefuse.data.tuple.CompositeTupleSet
public void addColumn(String name, Class type, Object defaultValue)(Code)(Java Doc)
public void addColumn(String name, Class type)(Code)(Java Doc)
public void addColumn(String name, Expression expr)(Code)(Java Doc)
public void addColumn(String name, String expr)(Code)(Java Doc)
public void addSet(String name, TupleSet set)(Code)(Java Doc)
public Tuple addTuple(Tuple t)(Code)(Java Doc)
public void clear()(Code)(Java Doc)
public boolean containsSet(TupleSet set)(Code)(Java Doc)
public boolean containsTuple(Tuple t)(Code)(Java Doc)
public TupleSet getSet(String name)(Code)(Java Doc)
public int getTupleCount()(Code)(Java Doc)
public boolean hasSet(String name)(Code)(Java Doc)
public boolean isAddColumnSupported()(Code)(Java Doc)
public void removeAllSets()(Code)(Java Doc)
public TupleSet removeSet(String name)(Code)(Java Doc)
public boolean removeTuple(Tuple t)(Code)(Java Doc)
public Iterator setNames()(Code)(Java Doc)
public Tuple setTuple(Tuple t)(Code)(Java Doc)
public Iterator sets()(Code)(Java Doc)
public Iterator tuples()(Code)(Java Doc)
public Iterator tuples(Predicate filter)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.