public interface Graph
Modifier and Type | Method and Description |
---|---|
boolean |
addAllEdges(Collection<? extends Edge> edges)
Adds all edges in the collection to this graph.
|
boolean |
addAllNodes(Collection<? extends Node> nodes)
Adds all nodes in the collection to this graph.
|
boolean |
addEdge(Edge edge)
Adds an edge to this graph.
|
boolean |
addNode(Node node)
Adds a node to this graph.
|
void |
clear()
Clears all edges and all nodes in the graph
|
void |
clearEdges()
Clears all edges in the graph
|
void |
clearEdges(Node node)
Clears the edges incident to the given node.
|
void |
clearEdges(Node node,
int type)
Clears the edges of the given type incident to the given node.
|
boolean |
contains(Edge edge)
Returns true if edge is contained in this graph.
|
boolean |
contains(Node node)
Returns true if node is contained in this graph.
|
Object |
getAttribute(String key)
Gets the attribute value for the given key.
|
Object |
getAttribute(String key,
double timestamp)
Gets the attribute for the given key and timestamp
|
Set<String> |
getAttributeKeys()
Gets all attribute keys.
|
int |
getDegree(Node node)
Gets the node degree.
|
Edge |
getEdge(Node node1,
Node node2)
Gets the edge adjacent to node1 and node2.
|
Edge |
getEdge(Node node1,
Node node2,
int type)
Gets the edge adjacent to node1 and node2 and from the given type.
|
Edge |
getEdge(Object id)
Gets an edge by its identifier.
|
int |
getEdgeCount()
Gets the number of edges in the graph.
|
int |
getEdgeCount(int type)
Gets the number of edges of the given type in the graph.
|
EdgeIterable |
getEdges()
Gets all the edges in the graph.
|
EdgeIterable |
getEdges(Node node)
Gets all edges incident to a given node.
|
EdgeIterable |
getEdges(Node node,
int type)
Gets all edges incident to a given node with the given edge type.
|
GraphModel |
getModel()
Returns the model this graph belongs to.
|
NodeIterable |
getNeighbors(Node node)
Gets all neighbors of a given node.
|
NodeIterable |
getNeighbors(Node node,
int type)
Gets all neighbors of a given node connected through the given edge type.
|
Node |
getNode(Object id)
Gets a node given its identifier.
|
int |
getNodeCount()
Gets the number of nodes in the graph.
|
NodeIterable |
getNodes()
Gets all the nodes in the graph.
|
Node |
getOpposite(Node node,
Edge edge)
Gets the node at the opposite end of the given edge.
|
EdgeIterable |
getSelfLoops()
Gets all the self-loop edges in the graph.
|
GraphView |
getView()
Gets the graph view associated to this graph.
|
boolean |
isAdjacent(Node node1,
Node node2)
Returns true if node1 and node2 are adjacent.
|
boolean |
isAdjacent(Node node1,
Node node2,
int type)
Returns true if node1 and node2 are adjacent with an edge of the given
type.
|
boolean |
isDirected()
Returns true if this graph is directed.
|
boolean |
isDirected(Edge edge)
Returns true if the given edge is directed.
|
boolean |
isIncident(Edge edge1,
Edge edge2)
Returns true if edge1 and edge2 are incident.
|
boolean |
isIncident(Node node,
Edge edge)
Returns true if the node and the edge are incident.
|
boolean |
isMixed()
Returns true if this graph is mixed (both directed and undirected edges).
|
boolean |
isSelfLoop(Edge edge)
Returns true if the given edge is a self-loop.
|
boolean |
isUndirected()
Returns true if this graph is undirected.
|
void |
readLock()
Opens a read lock for the current thread.
|
void |
readUnlock()
Closes a read lock for the current thread.
|
void |
readUnlockAll()
Closes all read locks for the current thread.
|
boolean |
removeAllEdges(Collection<? extends Edge> edges)
Removes all edges in the collection from this graph.
|
boolean |
removeAllNodes(Collection<? extends Node> nodes)
Removes all nodes in the collection from this graph.
|
boolean |
removeEdge(Edge edge)
Removes an edge from this graph.
|
boolean |
removeNode(Node node)
Removes a node from this graph.
|
void |
setAttribute(String key,
Object value)
Sets the attribute value for the given key.
|
void |
setAttribute(String key,
Object value,
double timestamp)
Sets the attribute value for the given key and timestamp.
|
void |
writeLock()
Opens a write lock for the current thread.
|
void |
writeUnlock()
Closes a write lock for the current thread.
|
boolean addEdge(Edge edge)
edge
- the edge to addboolean addNode(Node node)
node
- the node to addboolean addAllEdges(Collection<? extends Edge> edges)
edges
- the edge collectionboolean addAllNodes(Collection<? extends Node> nodes)
nodes
- the node collectionboolean removeEdge(Edge edge)
edge
- the edge to removeboolean removeNode(Node node)
node
- the node to removeboolean removeAllEdges(Collection<? extends Edge> edges)
edges
- the edge collectionboolean removeAllNodes(Collection<? extends Node> nodes)
nodes
- the node collectionboolean contains(Node node)
node
- the node to testboolean contains(Edge edge)
edge
- the edge to testNode getNode(Object id)
id
- the node idEdge getEdge(Object id)
id
- the edge idEdge getEdge(Node node1, Node node2)
node1
- the first nodenode2
- the second nodeEdge getEdge(Node node1, Node node2, int type)
node1
- the first nodenode2
- the second nodetype
- the edge typeNodeIterable getNodes()
EdgeIterable getEdges()
EdgeIterable getSelfLoops()
NodeIterable getNeighbors(Node node)
node
- the node to get neighborsNodeIterable getNeighbors(Node node, int type)
node
- the node to get neighborstype
- the edge typeEdgeIterable getEdges(Node node)
node
- the node to get edges fromEdgeIterable getEdges(Node node, int type)
node
- the node to get edges fromtype
- the edge typeint getNodeCount()
int getEdgeCount()
int getEdgeCount(int type)
type
- the edge typeNode getOpposite(Node node, Edge edge)
node
- the node to get the oppositeedge
- the edge connected to both nodesint getDegree(Node node)
node
- the nodeboolean isSelfLoop(Edge edge)
edge
- the edge to testboolean isDirected(Edge edge)
edge
- the edge to testboolean isAdjacent(Node node1, Node node2)
node1
- the first nodenode2
- the second nodeboolean isAdjacent(Node node1, Node node2, int type)
node1
- the first nodenode2
- the second nodetype
- the edge typeboolean isIncident(Edge edge1, Edge edge2)
edge1
- the first edgeedge2
- the second edgeboolean isIncident(Node node, Edge edge)
node
- the nodeedge
- the edgevoid clearEdges(Node node)
node
- the node to clear edges fromvoid clearEdges(Node node, int type)
node
- the node to clear edges fromtype
- the edge typevoid clear()
void clearEdges()
GraphView getView()
Object getAttribute(String key)
key
- the keyObject getAttribute(String key, double timestamp)
key
- the keytimestamp
- the timestampvoid setAttribute(String key, Object value)
key
- the keyvalue
- the valuevoid setAttribute(String key, Object value, double timestamp)
key
- the keyvalue
- the valuetimestamp
- the timestampSet<String> getAttributeKeys()
GraphModel getModel()
boolean isDirected()
boolean isUndirected()
boolean isMixed()
void readLock()
void readUnlock()
void readUnlockAll()
void writeLock()
void writeUnlock()
Copyright © 2007–2015 Gephi Consortium. All rights reserved.