Galois
|
A graph that can have new nodes and edges added to it. More...
#include <MorphHyperGraph.h>
Classes | |
struct | AuxNode |
Wrapper around a graph node that provides a lock for it as well as in-neighbor tracking. More... | |
struct | with_directional |
Struct used to define directionality of the graph. More... | |
struct | with_edge_data |
Struct used to define the type of edge data in the graph. More... | |
struct | with_file_edge_data |
Struct used to define the type of file edge data in the graph. More... | |
struct | with_no_lockable |
Struct used to define the HasNoLockable template parameter as a type in the struct. More... | |
struct | with_node_data |
Struct used to define the type of node data in the graph. More... | |
struct | with_sorted_neighbors |
Struct used to define if neighbors are sorted or not in the graph. More... | |
Public Types | |
using | read_tag = read_with_aux_first_graph_tag |
Tag that defines to graph reader how to read a graph into this class. More... | |
using | GraphNode = gNode * |
Graph node handle. More... | |
using | edge_data_type = EdgeTy |
Edge data type. More... | |
using | file_edge_data_type = FileEdgeTy |
Edge data type of file we are loading this graph from. More... | |
using | node_data_type = NodeTy |
Node data type. More... | |
using | edge_iterator = typename boost::filter_iterator< is_out_edge, typename gNodeTypes::iterator > |
(Out or Undirected) Edge iterator More... | |
using | in_edge_iterator = typename boost::filter_iterator< is_in_edge, typename gNodeTypes::iterator > |
In Edge iterator. More... | |
using | edge_data_reference = typename gNodeTypes::EdgeInfo::reference |
Reference to edge data. More... | |
using | node_data_reference = typename gNodeTypes::reference |
Reference to node data. More... | |
using | iterator = boost::transform_iterator< makeGraphNode, boost::filter_iterator< is_node, typename NodeListTy::iterator >> |
Node iterator. More... | |
using | AuxNodePadded = typename galois::substrate::CacheLineStorage< AuxNode > |
Padded version of AuxNode. More... | |
using | ReadGraphAuxData = typename std::conditional< DirectedNotInOut, LargeArray< GraphNode >, LargeArray< AuxNodePadded >>::type |
Large array that contains auxiliary data for each node (AuxNodes) More... | |
using | local_iterator = iterator |
local iterator over nodes More... | |
Public Member Functions | |
template<typename... Args> | |
GraphNode | createNode (Args &&...args) |
Creates a new node holding the indicated data. More... | |
void | addNode (const GraphNode &n, galois::MethodFlag mflag=MethodFlag::WRITE) |
Adds a node to the graph. More... | |
node_data_reference | getData (const GraphNode &n, galois::MethodFlag mflag=MethodFlag::WRITE) const |
Gets the node data for a node. More... | |
bool | containsNode (const GraphNode &n, galois::MethodFlag mflag=MethodFlag::WRITE) const |
Checks if a node is in the graph. More... | |
void | removeNode (GraphNode n, galois::MethodFlag mflag=MethodFlag::WRITE) |
Removes a node from the graph along with all its outgoing/incoming edges for undirected graphs or outgoing edges for directed graphs. More... | |
void | resizeEdges (GraphNode src, size_t size, galois::MethodFlag mflag=MethodFlag::WRITE) |
Resize the edges of the node. More... | |
edge_iterator | addEdge (GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE) |
Adds an edge to graph, replacing existing value if edge already exists. More... | |
template<typename... Args> | |
edge_iterator | addMultiEdge (GraphNode src, GraphNode dst, galois::MethodFlag mflag, Args &&...args) |
Adds and initializes an edge to graph but does not check for duplicate edges. More... | |
void | removeEdge (GraphNode src, edge_iterator dst, galois::MethodFlag mflag=MethodFlag::WRITE) |
Removes an edge from the graph. More... | |
edge_iterator | findEdge (GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE) |
Finds if an edge between src and dst exists. More... | |
edge_iterator | findEdgeSortedByDst (GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE) |
Find/return edge between src/dst if it exists; assumes that edges are sorted by destination. More... | |
template<bool _Undirected = !Directional> | |
edge_iterator | findInEdge (GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0) |
Find a particular in-edge: note this function activates for the undirected graph case, so it just calls the regular out-edge finding function. More... | |
template<bool _DirectedInOut = (Directional && InOut)> | |
in_edge_iterator | findInEdge (GraphNode src, GraphNode dst, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _DirectedInOut >::type *=0) |
Find if an incoming edge between src and dst exists for directed in-out graphs. More... | |
edge_data_reference | getEdgeData (edge_iterator ii, galois::MethodFlag mflag=MethodFlag::UNPROTECTED) const |
Returns the edge data associated with the edge. More... | |
edge_data_reference | getEdgeData (in_edge_iterator ii, galois::MethodFlag mflag=MethodFlag::UNPROTECTED) const |
Get edge data for an in-edge. More... | |
GraphNode | getEdgeDst (edge_iterator ii) |
Returns the destination of an edge. More... | |
GraphNode | getEdgeDst (in_edge_iterator ii) |
Returns the destination of an in-edge. More... | |
void | sortEdgesByDst (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE) |
Sorts edge of a node by destination. More... | |
void | sortAllEdgesByDst (MethodFlag mflag=MethodFlag::WRITE) |
Sort all edges by destination. More... | |
void | sortEdgesByDeg (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE) |
void | sortCellDegree (MethodFlag mflag=MethodFlag::WRITE) |
edge_iterator | edge_begin (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE) |
Returns an iterator to the neighbors of a node. More... | |
template<bool _Undirected = !Directional> | |
in_edge_iterator | in_edge_begin (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if<!_Undirected >::type *=0) |
Returns an iterator to the in-neighbors of a node. More... | |
template<bool _Undirected = !Directional> | |
edge_iterator | in_edge_begin (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0) |
Returns an iterator to the in-neighbors of a node; undirected case in which it's the same as a regular neighbor. More... | |
edge_iterator | edge_end (GraphNode N, galois::MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::WRITE) |
Returns the end of the neighbor edge iterator. More... | |
template<bool _Undirected = !Directional> | |
in_edge_iterator | in_edge_end (GraphNode N, galois::MethodFlag GALOIS_UNUSED(mflag)=MethodFlag::WRITE, typename std::enable_if<!_Undirected >::type *=0) |
Returns the end of an in-neighbor edge iterator. More... | |
template<bool _Undirected = !Directional> | |
edge_iterator | in_edge_end (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0) |
Returns the end of an in-neighbor edge iterator, undirected case. More... | |
runtime::iterable < NoDerefIterator < edge_iterator > > | edges (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE) |
Return a range of edges that can be iterated over by C++ for-each. More... | |
template<bool _Undirected = !Directional> | |
runtime::iterable < NoDerefIterator < in_edge_iterator > > | in_edges (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if<!_Undirected >::type *=0) |
Return a range of in-edges that can be iterated over by C++ for-each. More... | |
template<bool _Undirected = !Directional> | |
runtime::iterable < NoDerefIterator < edge_iterator > > | in_edges (GraphNode N, galois::MethodFlag mflag=MethodFlag::WRITE, typename std::enable_if< _Undirected >::type *=0) |
Return a range of in-edges that can be iterated over by C++ for-each Undirected case, equivalent to out-edge iteration. More... | |
internal::EdgesIterator < MorphHyperGraph > | out_edges (GraphNode N, MethodFlag mflag=MethodFlag::WRITE) |
An object with begin() and end() methods to iterate over the outgoing edges of N. More... | |
iterator | begin () |
Returns an iterator to all the nodes in the graph. More... | |
iterator | end () |
Returns the end of the node iterator. Not thread-safe. More... | |
local_iterator | local_begin () |
Return the beginning of local range of nodes. More... | |
local_iterator | local_end () |
Return the end of local range of nodes. More... | |
unsigned int | size () |
Returns the number of nodes in the graph. More... | |
size_t | sizeOfEdgeData () const |
Returns the size of edge data. More... | |
void | allocateFrom (FileGraph &graph, ReadGraphAuxData &aux) |
Allocate memory for nodes given a file graph with a particular number of nodes. More... | |
template<bool V = DirectedNotInOut> | |
std::enable_if_t<!V > | constructNodesFrom (FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux) |
Constructs the MorphGraph nodes given a FileGraph to construct it from. More... | |
template<bool V = DirectedNotInOut> | |
std::enable_if_t< V > | constructNodesFrom (FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux) |
Constructs the MorphGraph nodes given a FileGraph to construct it from. More... | |
template<bool V = DirectedNotInOut> | |
std::enable_if_t<!V > | constructOutEdgesFrom (FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux) |
Constructs the MorphGraph edges given a FileGraph to construct it from and already created nodes. More... | |
template<bool V = DirectedNotInOut> | |
std::enable_if_t< V > | constructOutEdgesFrom (FileGraph &graph, unsigned tid, unsigned total, const ReadGraphAuxData &aux) |
Constructs the MorphGraph edges given a FileGraph to construct it from and already created nodes. More... | |
template<bool V = DirectedNotInOut> | |
std::enable_if_t<!V > | constructInEdgesFrom (FileGraph &graph, unsigned tid, unsigned total, ReadGraphAuxData &aux) |
Constructs the MorphGraph in-edges given a FileGraph to construct it from and already created nodes. More... | |
template<bool V = DirectedNotInOut> | |
std::enable_if_t< V > | constructInEdgesFrom (FileGraph &, unsigned, unsigned, ReadGraphAuxData &) |
If a directed graph and no in-edges exist (i.e. More... | |
gstl::Vector< GraphNode > | getneighbor (GraphNode N, GraphNode H) |
gstl::Vector< GraphNode > | getallneighbor (GraphNode N) |
gstl::Vector< GraphNode > | getNets (GraphNode N) |
gstl::Vector< GraphNode > | getCells (GraphNode N) |
void | addHyperedge (GraphNode n) |
void | addCell (GraphNode n) |
Bnodes & | cellList () |
Bnodes & | getNets () |
GraphNode | getneighbornet (GraphNode N, GraphNode C) |
std::vector< GraphNode > | getallneighbornets (GraphNode N) |
Public Attributes | |
gstl::Vector< GraphNode > | locked_cells |
int | max_cell_area |
int | total_area |
std::list< int > | freeCells |
gstl::Vector< int > | maxgain |
gstl::Vector< int > | balance |
Static Public Attributes | |
static constexpr const bool | DirectedNotInOut = (Directional && !InOut) |
True if a node is both directional and not storing both in and out edges. More... | |
A graph that can have new nodes and edges added to it.
An example of use:
And in C++11:
NodeTy | Type of node data |
EdgeTy | Type of edge data |
Directional | true if graph is directed |
InOut | true if directed graph tracks in-edges |
HasNoLockable | if true, use no abstract locks in the graph |
SortedNeighbors | Keep neighbors sorted (for faster findEdge) |
FileEdgeTy | type of edges on file to be read from |
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::AuxNodePadded = typename galois::substrate::CacheLineStorage<AuxNode> |
Padded version of AuxNode.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::edge_data_reference = typename gNodeTypes::EdgeInfo::reference |
Reference to edge data.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::edge_data_type = EdgeTy |
Edge data type.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::edge_iterator = typename boost::filter_iterator<is_out_edge, typename gNodeTypes::iterator> |
(Out or Undirected) Edge iterator
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::file_edge_data_type = FileEdgeTy |
Edge data type of file we are loading this graph from.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::GraphNode = gNode* |
Graph node handle.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::in_edge_iterator = typename boost::filter_iterator<is_in_edge, typename gNodeTypes::iterator> |
In Edge iterator.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::iterator = boost::transform_iterator< makeGraphNode, boost::filter_iterator<is_node, typename NodeListTy::iterator>> |
Node iterator.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::local_iterator = iterator |
local iterator over nodes
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::node_data_reference = typename gNodeTypes::reference |
Reference to node data.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::node_data_type = NodeTy |
Node data type.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::read_tag = read_with_aux_first_graph_tag |
Tag that defines to graph reader how to read a graph into this class.
using galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::ReadGraphAuxData = typename std::conditional<DirectedNotInOut, LargeArray<GraphNode>, LargeArray<AuxNodePadded>>::type |
Large array that contains auxiliary data for each node (AuxNodes)
|
inline |
|
inline |
Adds an edge to graph, replacing existing value if edge already exists.
Ignore the edge data, let the caller use the returned iterator to set the value if desired. This frees us from dealing with the void edge data problem in this API
|
inline |
|
inline |
Adds and initializes an edge to graph but does not check for duplicate edges.
|
inline |
Adds a node to the graph.
|
inline |
Allocate memory for nodes given a file graph with a particular number of nodes.
graph | FileGraph with a number of nodes to allocate |
aux | Data structure in which to allocate space for nodes. |
|
inline |
Returns an iterator to all the nodes in the graph.
Not thread-safe.
|
inline |
|
inline |
Constructs the MorphGraph in-edges given a FileGraph to construct it from and already created nodes.
Meant to be called by multiple threads. DirectedNotInOut = false version
[in] | graph | FileGraph to construct a morph graph from |
[in] | tid | Thread id of thread calling this function |
[in] | total | Total number of threads in current execution |
[in] | aux | Contains created nodes to create edges for |
|
inline |
If a directed graph and no in-edges exist (i.e.
DirectedNotInOut = true), then construct in edges should do nothing.
|
inline |
Constructs the MorphGraph nodes given a FileGraph to construct it from.
Meant to be called by multiple threads. Version for DirectedNotInOut = false.
[in] | graph | FileGraph to construct a morph graph from |
[in] | tid | Thread id of thread calling this function |
[in] | total | Total number of threads in current execution |
[in,out] | aux | Allocated memory to store newly created nodes |
|
inline |
Constructs the MorphGraph nodes given a FileGraph to construct it from.
Meant to be called by multiple threads. Version for DirectedNotInOut = true.
[in] | graph | FileGraph to construct a morph graph from |
[in] | tid | Thread id of thread calling this function |
[in] | total | Total number of threads in current execution |
[in,out] | aux | Allocated memory to store newly created nodes |
|
inline |
Constructs the MorphGraph edges given a FileGraph to construct it from and already created nodes.
Meant to be called by multiple threads. DirectedNotInOut = false version
[in] | graph | FileGraph to construct a morph graph from |
[in] | tid | Thread id of thread calling this function |
[in] | total | Total number of threads in current execution |
[in] | aux | Contains created nodes to create edges for |
|
inline |
Constructs the MorphGraph edges given a FileGraph to construct it from and already created nodes.
Meant to be called by multiple threads. DirectedNotInOut = true version
[in] | graph | FileGraph to construct a morph graph from |
[in] | tid | Thread id of thread calling this function |
[in] | total | Total number of threads in current execution |
[in] | aux | Contains created nodes to create edges for |
|
inline |
Checks if a node is in the graph.
|
inline |
Creates a new node holding the indicated data.
Usually you should call addNode() afterwards.
[in] | args | constructor arguments for node data |
|
inline |
Returns an iterator to the neighbors of a node.
|
inline |
Returns the end of the neighbor edge iterator.
|
inline |
Return a range of edges that can be iterated over by C++ for-each.
|
inline |
Returns the end of the node iterator. Not thread-safe.
|
inline |
Finds if an edge between src and dst exists.
|
inline |
Find/return edge between src/dst if it exists; assumes that edges are sorted by destination.
|
inline |
Find a particular in-edge: note this function activates for the undirected graph case, so it just calls the regular out-edge finding function.
|
inline |
Find if an incoming edge between src and dst exists for directed in-out graphs.
|
inline |
|
inline |
|
inline |
|
inline |
Gets the node data for a node.
|
inline |
Returns the edge data associated with the edge.
It is an error to get the edge data for a non-existent edge. It is an error to get edge data for inactive edges. By default, the mflag is galois::MethodFlag::UNPROTECTED because edge_begin() dominates this call and should perform the appropriate locking.
|
inline |
Get edge data for an in-edge.
|
inline |
Returns the destination of an edge.
|
inline |
Returns the destination of an in-edge.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Returns an iterator to the in-neighbors of a node.
|
inline |
Returns an iterator to the in-neighbors of a node; undirected case in which it's the same as a regular neighbor.
|
inline |
Returns the end of an in-neighbor edge iterator.
|
inline |
Returns the end of an in-neighbor edge iterator, undirected case.
|
inline |
Return a range of in-edges that can be iterated over by C++ for-each.
|
inline |
Return a range of in-edges that can be iterated over by C++ for-each Undirected case, equivalent to out-edge iteration.
|
inline |
Return the beginning of local range of nodes.
|
inline |
Return the end of local range of nodes.
|
inline |
|
inline |
Removes an edge from the graph.
|
inline |
Removes a node from the graph along with all its outgoing/incoming edges for undirected graphs or outgoing edges for directed graphs.
|
inline |
Resize the edges of the node.
For best performance, should be done serially.
|
inline |
Returns the number of nodes in the graph.
Not thread-safe.
|
inline |
Returns the size of edge data.
|
inline |
Sort all edges by destination.
|
inline |
|
inline |
|
inline |
Sorts edge of a node by destination.
gstl::Vector<int> galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::balance |
|
static |
True if a node is both directional and not storing both in and out edges.
std::list<int> galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::freeCells |
gstl::Vector<GraphNode> galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::locked_cells |
int galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::max_cell_area |
gstl::Vector<int> galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::maxgain |
int galois::graphs::MorphHyperGraph< NodeTy, EdgeTy, Directional, InOut, HasNoLockable, SortedNeighbors, FileEdgeTy >::total_area |