public interface GraphModel
Graph objets on demand.
The graph structure contains several views. GraphView are sub-graphs with a unique
identifier, the viewId. The model maintains all views, and especially:
It is preferable to use the main graph for performing updates (add, remove, ...).
Graph graph = model.getGraph(); Node n1 = model.factory().newNode(); Node n2 = model.factory().newNode(); Edge e1 = model.factory().newEdge(n1, n2); graph.addNode(n1); graph.addNode(n2); graph.addEdge(e1);
GraphView newView = model.newView(); //Duplicate main view Graph subGraph = model.getGraph(newView); //Filter subgraph by removing nodes and edges model.setVisibleView(newView); //Set the view as current visible viewNote: Pay attention to destroy views when they are not used anymore.
GraphController| Modifier and Type | Method and Description |
|---|---|
void |
addGraphListener(GraphListener graphListener)
Add
graphListener as a listener to this graph, if it is not already. |
void |
clear()
Clears the model by deleting all views and reseting
main
view. |
GraphModel |
copy()
Returns a complete copy of this model, including all views but not listeners.
|
GraphView |
copyView(GraphView view)
Copy
view to a new graph view. |
void |
destroyView(GraphView view)
Destroy
view, if exists. |
GraphFactory |
factory()
Returns the factory that creates nodes and edges for this model.
|
DirectedGraph |
getDirectedGraph()
Build a
DirectedGraph to access the main view. |
DirectedGraph |
getDirectedGraph(GraphView view)
Build a
DirectedGraph to access view. |
DirectedGraph |
getDirectedGraphVisible()
Build a
DirectedGraph to access the visible view. |
Graph |
getGraph()
Build a
Graph to access the main view. |
Graph |
getGraph(GraphView view)
Build a
Graph to access view/code>. |
Graph |
getGraphVisible()
Build a
Graph to access the visible view. |
HierarchicalDirectedGraph |
getHierarchicalDirectedGraph()
Build a
HierarchicalDirectedGraph to access the main view. |
HierarchicalDirectedGraph |
getHierarchicalDirectedGraph(GraphView view)
Build a
HierarchicalDirectedGraph to access view. |
HierarchicalDirectedGraph |
getHierarchicalDirectedGraphVisible()
Build a
HierarchicalDirectedGraph to access the visible view. |
HierarchicalGraph |
getHierarchicalGraph()
Build a
HierarchicalGraph to access the main view. |
HierarchicalGraph |
getHierarchicalGraph(GraphView view)
Build a
HierarchicalGraph to access view. |
HierarchicalGraph |
getHierarchicalGraphVisible()
Build a
HierarchicalGraph to access the visible view. |
HierarchicalMixedGraph |
getHierarchicalMixedGraph()
Build a
HierarchicalMixedGraph to access the main view. |
HierarchicalMixedGraph |
getHierarchicalMixedGraph(GraphView view)
Build a
HierarchicalMixedGraph to access view. |
HierarchicalMixedGraph |
getHierarchicalMixedGraphVisible()
Build a
HierarchicalMixedGraph to access the visible view. |
HierarchicalUndirectedGraph |
getHierarchicalUndirectedGraph()
Build a
HierarchicalUndirectedGraph to access the main view. |
HierarchicalUndirectedGraph |
getHierarchicalUndirectedGraph(GraphView view)
Build a
HierarchicalUndirectedGraph to access view. |
HierarchicalUndirectedGraph |
getHierarchicalUndirectedGraphVisible()
Build a
HierarchicalUndirectedGraph to access the visible view. |
MixedGraph |
getMixedGraph()
Build a
MixedGraph to access the main view. |
MixedGraph |
getMixedGraph(GraphView view)
Build a
MixedGraph to access view. |
MixedGraph |
getMixedGraphVisible()
Build a
MixedGraph to access the visible view. |
UndirectedGraph |
getUndirectedGraph()
Build a
UndirectedGraph to access the main view. |
UndirectedGraph |
getUndirectedGraph(GraphView view)
Build a
UndirectedGraph to access view. |
UndirectedGraph |
getUndirectedGraphVisible()
Build a
UndirectedGraph to access the visible view. |
GraphView |
getVisibleView()
Returns the current viisble view.
|
Workspace |
getWorkspace()
Returns the workspace this graph model belongs to.
|
boolean |
isDirected()
Returns
true if the graph is directed by default. |
boolean |
isHierarchical()
Returns
true if the graph is hierarchical. |
boolean |
isMixed()
Returns
true if the graph is mixed by default. |
boolean |
isUndirected()
Returns
true if the graph is undirected by default. |
GraphView |
newView()
Create a new view by duplicating main view.
|
void |
pushFrom(Graph graph)
Copy the graph structure from
graph to this model. |
void |
pushNodes(Graph graph,
Node[] nodes)
Copy the nodes and edges betweeen these nodes from the
graph
to this model. |
void |
removeGraphListener(GraphListener graphListener)
Remove
graphListener as a listener to this graph. |
GraphSettings |
settings()
Returns the model settings.
|
void |
setVisibleView(GraphView view)
Sets the current visible view and nofity listeners the visible view changed.
|
GraphFactory factory()
GraphSettings settings()
GraphView newView()
GraphView copyView(GraphView view)
view to a new graph view. The new view contains all
nodes and edges present in view.viewvoid destroyView(GraphView view)
view, if exists. Always destroy views that are not
needed anymore to avoid memory overhead.view - the view that is to be destroyedvoid setVisibleView(GraphView view)
view - the view that is to be set as the visible viewGraphView getVisibleView()
Graph getGraph()
Graph to access the main view. If no undirected
edges have been added, returns a DirectedGraph. If the graph
only contains undirected edges, returns a UndirectedGraph.
If both directed and undirected edges exists, returns a MixedGraph.DirectedGraph getDirectedGraph()
DirectedGraph to access the main view.UndirectedGraph getUndirectedGraph()
UndirectedGraph to access the main view.MixedGraph getMixedGraph()
MixedGraph to access the main view.HierarchicalGraph getHierarchicalGraph()
HierarchicalGraph to access the main view.
If no undirected edges have been added, returns a
HierarchicalDirectedGraph. If the graph only contains undirected
edges, returns a HierarchicalUndirectedGraph. If both directed
and undirected edges exists, returns a HierarchicalMixedGraph.
Hierarchical graphs are normal graphs with more features to handle graphs within graphs.
HierarchicalDirectedGraph getHierarchicalDirectedGraph()
HierarchicalDirectedGraph to access the main view.HierarchicalUndirectedGraph getHierarchicalUndirectedGraph()
HierarchicalUndirectedGraph to access the main view.HierarchicalMixedGraph getHierarchicalMixedGraph()
HierarchicalMixedGraph to access the main view.Graph getGraphVisible()
Graph to access the visible view. If no undirected
edges have been added, returns a DirectedGraph. If the graph
only contains undirected edges, returns a UndirectedGraph.
If both directed and undirected edges exists, returns a MixedGraph.DirectedGraph getDirectedGraphVisible()
DirectedGraph to access the visible view.UndirectedGraph getUndirectedGraphVisible()
UndirectedGraph to access the visible view.MixedGraph getMixedGraphVisible()
MixedGraph to access the visible view.HierarchicalGraph getHierarchicalGraphVisible()
HierarchicalGraph to access the visible view.
If no undirected edges have been added, returns a
HierarchicalDirectedGraph. If the graph only contains undirected
edges, returns a HierarchicalUndirectedGraph. If both directed
and undirected edges exists, returns a HierarchicalMixedGraph.
Hierarchical graphs are normal graphs with more features to handle graphs within graphs.
HierarchicalDirectedGraph getHierarchicalDirectedGraphVisible()
HierarchicalDirectedGraph to access the visible view.HierarchicalUndirectedGraph getHierarchicalUndirectedGraphVisible()
HierarchicalUndirectedGraph to access the visible view.HierarchicalMixedGraph getHierarchicalMixedGraphVisible()
HierarchicalMixedGraph to access the visible view.Graph getGraph(GraphView view)
Graph to access view/code>. If no undirected
edges have been added, returns a DirectedGraph. If the graph
only contains undirected edges, returns a UndirectedGraph.
If both directed and undirected edges exists, returns a MixedGraph.view, directed by defaultDirectedGraph getDirectedGraph(GraphView view)
DirectedGraph to access view.viewUndirectedGraph getUndirectedGraph(GraphView view)
UndirectedGraph to access view.viewMixedGraph getMixedGraph(GraphView view)
MixedGraph to access view.viewHierarchicalGraph getHierarchicalGraph(GraphView view)
HierarchicalGraph to access view.
If no undirected edges have been added, returns a
HierarchicalDirectedGraph. If the graph only contains undirected
edges, returns a HierarchicalUndirectedGraph. If both directed
and undirected edges exists, returns a HierarchicalMixedGraph.
Hierarchical graphs are normal graphs with more features to handle graphs within graphs.
view, directed by defaultHierarchicalDirectedGraph getHierarchicalDirectedGraph(GraphView view)
HierarchicalDirectedGraph to access view.viewHierarchicalUndirectedGraph getHierarchicalUndirectedGraph(GraphView view)
HierarchicalUndirectedGraph to access view.viewHierarchicalMixedGraph getHierarchicalMixedGraph(GraphView view)
HierarchicalMixedGraph to access view.viewvoid pushFrom(Graph graph)
graph to this model. The
given graphmust come from a different GraphModel,
e.g. a different workspace.graph - the graph that is to be copied in this modelIllegalArgumentException - if graph belongs to this
graph modelvoid pushNodes(Graph graph, Node[] nodes)
graph
to this model. The given graphmust come from a different
GraphModel, e.g. a different workspace.graph - the graph that is to be copied in this modelnodes - the nodes to copyIllegalArgumentException - if graph belongs to this
graph modelGraphModel copy()
void clear()
main
view. Calling this method immediately makes all Graph on
other views than main obsolete.void addGraphListener(GraphListener graphListener)
graphListener as a listener to this graph, if it is not already.
To pass a WeakReference, use Netbeans WeakListeners utility class.graphListener - the listener to addvoid removeGraphListener(GraphListener graphListener)
graphListener as a listener to this graph.graphListener - the listener to removeboolean isDirected()
true if the graph is directed by default. This value is an
indicator of the current state and it means that so far all edges are directed in the graph.true if the graph is only directed or false otherwiseDirectedGraphboolean isUndirected()
true if the graph is undirected by default. This value is an
indicator of the current state and it means that so far all edges are undirected in the graph.true if the graph is only undirected or false otherwiseUndirectedGraphboolean isMixed()
true if the graph is mixed by default. This value is an
indicator of the current state and it means that directed and undirected edges has been
added to the graph. When it returns true, isDirected() and
isUndirected() methods always returns false.true if the graph is mixed or false otherwiseMixedGraphboolean isHierarchical()
true if the graph is hierarchical. This indicates the presence
of a hierarchy, in other words the height of the tree is greater than 0.true if the graph is clustered or false otherwiseHierarchicalGraphWorkspace getWorkspace()
Copyright © 2007-2012 Gephi Consortium. All Rights Reserved.