fpmas 1.6
Classes | Public Types | Public Member Functions | List of all members
fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS > Class Template Reference

#include <distributed_graph.h>

Inheritance diagram for fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >:
Inheritance graph
[legend]
Collaboration diagram for fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >:
Collaboration graph
[legend]

Public Types

typedef api::graph::DistributedNode< T > NodeType
 
typedef api::graph::DistributedEdge< T > EdgeType
 
- Public Types inherited from fpmas::api::graph::Graph< NodeType, EdgeType >
typedef NodeType::IdType NodeIdType
 
typedef EdgeType::IdType EdgeIdType
 
typedef fpmas::api::graph::IdHash< typename NodeType::IdType > NodeIdHash
 
typedef fpmas::api::graph::IdHash< typename EdgeType::IdType > EdgeIdHash
 
typedef std::unordered_map< NodeIdType, NodeType *, NodeIdHashNodeMap
 
typedef std::unordered_map< EdgeIdType, EdgeType *, EdgeIdHashEdgeMap
 
- Public Types inherited from fpmas::api::graph::DistributedGraph< T >
typedef api::utils::EventCallback< SetLocalNodeEvent< T > > SetLocalNodeCallback
 
typedef api::utils::EventCallback< SetDistantNodeEvent< T > > SetDistantNodeCallback
 
- Public Types inherited from fpmas::api::graph::Graph< DistributedNode< T >, DistributedEdge< T > >
typedef NodeType::IdType NodeIdType
 
typedef EdgeType::IdType EdgeIdType
 
typedef fpmas::api::graph::IdHash< typename NodeType::IdType > NodeIdHash
 
typedef fpmas::api::graph::IdHash< typename EdgeType::IdType > EdgeIdHash
 
typedef std::unordered_map< NodeIdType, DistributedNode< T > *, NodeIdHashNodeMap
 
typedef std::unordered_map< EdgeIdType, DistributedEdge< T > *, EdgeIdHashEdgeMap
 

Public Member Functions

 DistributedGraph (const DistributedGraph< DIST_GRAPH_PARAMS_SPEC > &)=delete
 
DistributedGraphoperator= (const DistributedGraph< DIST_GRAPH_PARAMS_SPEC > &)=delete
 
 DistributedGraph (DistributedGraph< DIST_GRAPH_PARAMS_SPEC > &&graph)
 
DistributedGraphoperator= (DistributedGraph< DIST_GRAPH_PARAMS_SPEC > &&graph)
 
 DistributedGraph (api::communication::MpiCommunicator &comm)
 
api::communication::MpiCommunicatorgetMpiCommunicator () override
 
const api::communication::MpiCommunicatorgetMpiCommunicator () const override
 
DistributedId currentNodeId () const override
 
void setCurrentNodeId (DistributedId id) override
 
DistributedId currentEdgeId () const override
 
void setCurrentEdgeId (DistributedId id) override
 
NodeTypeimportNode (NodeType *node) override
 
EdgeTypeimportEdge (EdgeType *edge) override
 
std::unordered_set< api::graph::DistributedNode< T > * > getUnsyncNodes () const override
 
const SyncMode< T > & getSyncMode () const
 
SyncMode< T > & synchronizationMode () override
 
const LocationManagerImpl< T > & getLocationManager () const override
 
LocationManagerImpl< T > & getLocationManager () override
 
void balance (api::graph::LoadBalancing< T > &load_balancing) override
 
void balance (api::graph::LoadBalancing< T > &load_balancing, api::graph::PartitionMode partition_mode) override
 
void balance (api::graph::FixedVerticesLoadBalancing< T > &load_balancing, api::graph::PartitionMap fixed_vertices) override
 
void balance (api::graph::FixedVerticesLoadBalancing< T > &load_balancing, api::graph::PartitionMap fixed_vertices, api::graph::PartitionMode partition_mode) override
 
void distribute (api::graph::PartitionMap partition) override
 
void synchronize () override
 
void synchronize (std::unordered_set< NodeType * > nodes, bool synchronize_links=true) override
 
NodeTypebuildNode (T &&=std::move(T())) override
 
NodeTypebuildNode (const T &) override
 
api::graph::DistributedNode< T > * insertDistant (api::graph::DistributedNode< T > *) override
 
EdgeTypelink (NodeType *const src, NodeType *const tgt, api::graph::LayerId layer) override
 
void removeNode (api::graph::DistributedNode< T > *) override
 
void removeNode (DistributedId id) override
 
void unlink (EdgeType *) override
 
void unlink (DistributedId id) override
 
void switchLayer (EdgeType *edge, api::graph::LayerId layer_id) override
 
void addCallOnSetLocal (SetLocalNodeCallback *callback) override
 
std::vector< SetLocalNodeCallback * > onSetLocalCallbacks () const override
 
void addCallOnSetDistant (SetDistantNodeCallback *callback) override
 
std::vector< SetDistantNodeCallback * > onSetDistantCallbacks () const override
 
- Public Member Functions inherited from fpmas::api::graph::Graph< NodeType, EdgeType >
virtual void insert (NodeType *node)=0
 
virtual void insert (EdgeType *edge)=0
 
virtual void erase (NodeType *node)=0
 
virtual void erase (EdgeType *edge)=0
 
virtual void addCallOnInsertNode (api::utils::Callback< NodeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< NodeType * > * > onInsertNodeCallbacks () const =0
 
virtual void addCallOnEraseNode (api::utils::Callback< NodeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< NodeType * > * > onEraseNodeCallbacks () const =0
 
virtual void addCallOnInsertEdge (api::utils::Callback< EdgeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< EdgeType * > * > onInsertEdgeCallbacks () const =0
 
virtual void addCallOnEraseEdge (api::utils::Callback< EdgeType * > *callback)=0
 
virtual std::vector< api::utils::Callback< EdgeType * > * > onEraseEdgeCallbacks () const =0
 
virtual NodeType * getNode (NodeIdType id)=0
 
virtual const NodeType * getNode (NodeIdType id) const =0
 
virtual const NodeMapgetNodes () const =0
 
virtual EdgeType * getEdge (EdgeIdType id)=0
 
virtual const EdgeType * getEdge (EdgeIdType) const =0
 
virtual const EdgeMapgetEdges () const =0
 
virtual void clear ()=0
 
virtual api::communication::MpiCommunicatorgetMpiCommunicator ()=0
 
virtual const api::communication::MpiCommunicatorgetMpiCommunicator () const =0
 
virtual LocationManager< T > & getLocationManager ()=0
 
virtual const LocationManager< T > & getLocationManager () const =0
 
virtual DistributedNode< T > * importNode (DistributedNode< T > *node)=0
 
virtual DistributedEdge< T > * importEdge (DistributedEdge< T > *edge)=0
 
virtual std::unordered_set< DistributedNode< T > * > getUnsyncNodes () const =0
 
virtual DistributedId currentNodeId () const =0
 
virtual void setCurrentNodeId (DistributedId id)=0
 
virtual DistributedId currentEdgeId () const =0
 
virtual void setCurrentEdgeId (DistributedId id)=0
 
virtual DistributedNode< T > * buildNode (T &&data)=0
 
virtual DistributedNode< T > * buildNode (const T &data)=0
 
virtual DistributedNode< T > * insertDistant (DistributedNode< T > *node)=0
 
virtual void removeNode (DistributedNode< T > *node)=0
 
virtual void removeNode (DistributedId id)=0
 
virtual void unlink (DistributedEdge< T > *edge)=0
 
virtual void unlink (DistributedId id)=0
 
virtual DistributedEdge< T > * link (DistributedNode< T > *source, DistributedNode< T > *target, LayerId layer_id)=0
 
virtual void switchLayer (DistributedEdge< T > *edge, LayerId layer_id)=0
 
virtual void addCallOnSetLocal (SetLocalNodeCallback *callback)=0
 
virtual std::vector< SetLocalNodeCallback * > onSetLocalCallbacks () const =0
 
virtual void addCallOnSetDistant (SetDistantNodeCallback *callback)=0
 
virtual std::vector< SetDistantNodeCallback * > onSetDistantCallbacks () const =0
 
virtual void balance (LoadBalancing< T > &lb)=0
 
virtual void balance (LoadBalancing< T > &lb, PartitionMode partition_mode)=0
 
virtual void balance (FixedVerticesLoadBalancing< T > &lb, PartitionMap fixed_vertices)=0
 
virtual void balance (FixedVerticesLoadBalancing< T > &lb, PartitionMap fixed_vertices, PartitionMode partition_mode)=0
 
virtual void distribute (PartitionMap partition)=0
 
virtual void synchronize ()=0
 
virtual void synchronize (std::unordered_set< DistributedNode< T > * > nodes, bool synchronize_links=true)=0
 
virtual synchro::SyncMode< T > & synchronizationMode ()=0
 
- Public Member Functions inherited from fpmas::api::graph::Graph< DistributedNode< T >, DistributedEdge< T > >
virtual void insert (DistributedNode< T > *node)=0
 
virtual void insert (DistributedEdge< T > *edge)=0
 
virtual void erase (DistributedNode< T > *node)=0
 
virtual void erase (DistributedEdge< T > *edge)=0
 
virtual void addCallOnInsertNode (api::utils::Callback< DistributedNode< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedNode< T > * > * > onInsertNodeCallbacks () const=0
 
virtual void addCallOnEraseNode (api::utils::Callback< DistributedNode< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedNode< T > * > * > onEraseNodeCallbacks () const=0
 
virtual void addCallOnInsertEdge (api::utils::Callback< DistributedEdge< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedEdge< T > * > * > onInsertEdgeCallbacks () const=0
 
virtual void addCallOnEraseEdge (api::utils::Callback< DistributedEdge< T > * > *callback)=0
 
virtual std::vector< api::utils::Callback< DistributedEdge< T > * > * > onEraseEdgeCallbacks () const=0
 
virtual DistributedNode< T > * getNode (NodeIdType id)=0
 
virtual const DistributedNode< T > * getNode (NodeIdType id) const=0
 
virtual const NodeMapgetNodes () const=0
 
virtual DistributedEdge< T > * getEdge (EdgeIdType id)=0
 
virtual const DistributedEdge< T > * getEdge (EdgeIdType) const=0
 
virtual const EdgeMapgetEdges () const=0
 
virtual void clear ()=0
 

Detailed Description

template<DIST_GRAPH_PARAMS>
class fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >

api::graph::DistributedGraph implementation.

Member Typedef Documentation

◆ NodeType

template<DIST_GRAPH_PARAMS >
typedef api::graph::DistributedNode<T> fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::NodeType

◆ EdgeType

template<DIST_GRAPH_PARAMS >
typedef api::graph::DistributedEdge<T> fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::EdgeType

Constructor & Destructor Documentation

◆ DistributedGraph() [1/2]

template<DIST_GRAPH_PARAMS >
fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::DistributedGraph ( DistributedGraph< DIST_GRAPH_PARAMS_SPEC > &&  graph)

DistributedGraph move constructor.

◆ DistributedGraph() [2/2]

template<DIST_GRAPH_PARAMS >
fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::DistributedGraph ( api::communication::MpiCommunicator comm)
inline

DistributedGraph constructor.

Parameters
commMPI communicator

Member Function Documentation

◆ operator=()

template<DIST_GRAPH_PARAMS >
DistributedGraph< DIST_GRAPH_PARAMS_SPEC > & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::operator= ( DistributedGraph< DIST_GRAPH_PARAMS_SPEC > &&  graph)

DistributedGraph move assignment operator.

◆ getMpiCommunicator() [1/2]

template<DIST_GRAPH_PARAMS >
api::communication::MpiCommunicator & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::getMpiCommunicator ( )
inlineoverridevirtual

Returns the internal MpiCommunicator.

Returns
reference to the internal MpiCommunicator

Implements fpmas::api::graph::DistributedGraph< T >.

◆ getMpiCommunicator() [2/2]

template<DIST_GRAPH_PARAMS >
const api::communication::MpiCommunicator & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::getMpiCommunicator ( ) const
inlineoverridevirtual

Returns the internal MpiCommunicator.

Returns
reference to the internal MpiCommunicator

Implements fpmas::api::graph::DistributedGraph< T >.

◆ currentNodeId()

template<DIST_GRAPH_PARAMS >
DistributedId fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::currentNodeId ( ) const
inlineoverridevirtual

Returns the current internal Node ID.

The next node built with buildNode() will have an id equal to currentNodeId()++;

Returns
current Node ID

Implements fpmas::api::graph::DistributedGraph< T >.

◆ setCurrentNodeId()

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::setCurrentNodeId ( DistributedId  id)
inlineoverridevirtual

Sets the current internal Node ID to the specified value.

Parameters
idnode id

Implements fpmas::api::graph::DistributedGraph< T >.

◆ currentEdgeId()

template<DIST_GRAPH_PARAMS >
DistributedId fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::currentEdgeId ( ) const
inlineoverridevirtual

Returns the current internal Edge ID.

The next edge built with link() will have an id equal to currentEdgeId()++;

Returns
current Edge ID

Implements fpmas::api::graph::DistributedGraph< T >.

◆ setCurrentEdgeId()

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::setCurrentEdgeId ( DistributedId  id)
inlineoverridevirtual

Sets the current internal Edge ID to the specified value.

Parameters
idedge id

Implements fpmas::api::graph::DistributedGraph< T >.

◆ importNode()

template<DIST_GRAPH_PARAMS >
DistributedGraph< DIST_GRAPH_PARAMS_SPEC >::NodeType * fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::importNode ( NodeType node)
overridevirtual

Imports a DistributedNode into the local graph instance.

When a node is imported into the graph, two main events occur :

  • the node is inserted into the graph, triggering insert node callbacks, as specified in Graph::insert(NodeType*).
  • the node becomes *LOCAL* to this graph, replacing an eventual outdated *DISTANT* representation of this node.

Finally, the inserted node is returned.

Parameters
nodenode to import
Returns
inserted node

Implements fpmas::api::graph::DistributedGraph< T >.

◆ importEdge()

template<DIST_GRAPH_PARAMS >
DistributedGraph< DIST_GRAPH_PARAMS_SPEC >::EdgeType * fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::importEdge ( EdgeType edge)
overridevirtual

Imports a DistributedEdge into the local graph instance.

The DistributedEdge must comply with the following requirements:

  • dynamically allocated
  • defined getTempSourceNode() and getTempTargetNode()

Moreover, at least the source or the target node of the imported edge must represent a LOCAL node (since edges between two DISTANT nodes are not represented in a DistributedGraph anyway).

Several situations might then occur :

When source or target is DISTANT, the corresponding node might already be represented in the local graph instance. In that case, the imported edge is linked to the existing representation, and the corresponding TemporaryNode is discarded (without a call to the TemporaryNode::build() method).

Else, if no DISTANT representation of the node is available, a DISTANT representation is created into the local graph instance and the edge is linked to this new DISTANT node, built using the TemporaryNode::build() method.

Notice that a DISTANT representation of the imported edge might already exist, notably if the two nodes are LOCAL and at least one of them was imported in the current distribute() operation. In that case, the imported edge can be discarded and the edge already contained in the graph goes LOCAL, without calling insert edge callbacks. Source and target TemporaryNodes are also be discarded.

Parameters
edgeto import
Returns
inserted edge

Implements fpmas::api::graph::DistributedGraph< T >.

◆ getUnsyncNodes()

template<DIST_GRAPH_PARAMS >
std::unordered_set< api::graph::DistributedNode< T > * > fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::getUnsyncNodes ( ) const
inlineoverridevirtual

Returns a buffer containing nodes that have not been synchronized yet using the getDataSync() component.

This set corresponds to nodes that were created while importing an importEdge() or insertDistant() statement.

Nodes are added to the buffer when importEdge() or insertDistant() is called, each node is removed under two conditions:

  1. When its data is synchronized with a call to getDataSync().synchronize() or getDataSync().synchronize(node_set), that are themselves called by synchronize() and synchronize(std::unordered_set nodes).
  2. When it is erased from the graph

Notice that what is called "data synchronization" there is still dependent on the current SyncMode: this does not necessarily mean message exchanges or data import.

Returns
unsynchronized nodes buffer

Implements fpmas::api::graph::DistributedGraph< T >.

◆ getSyncMode()

template<DIST_GRAPH_PARAMS >
const SyncMode< T > & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::getSyncMode ( ) const
inline
Deprecated:
Use synchronizationMode() instead.

Returns the internal SyncMode instance.

Returns
sync mode

◆ synchronizationMode()

template<DIST_GRAPH_PARAMS >
SyncMode< T > & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::synchronizationMode ( )
inlineoverridevirtual

Returns the current synchro::SyncMode instance used to synchronize() the graph.

Directly accessing synchronizationMode().getSyncLinker().synchronize() or synchronizationMode().getDataSync().synchronize() can be used to perform corresponding partial synchronizations (contrary to synchronize()) for performance purpose.

Implements fpmas::api::graph::DistributedGraph< T >.

◆ getLocationManager() [1/2]

template<DIST_GRAPH_PARAMS >
const LocationManagerImpl< T > & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::getLocationManager ( ) const
inlineoverridevirtual

Reference to the internal LocationManager.

The LocationManager is notably used to easily access the LOCAL and DISTANT nodes in independent sets, thanks to the LocationManager::getLocalNodes() and LocationManager::getDistantNodes() functions.

Returns
internal LocationManager

Implements fpmas::api::graph::DistributedGraph< T >.

◆ getLocationManager() [2/2]

template<DIST_GRAPH_PARAMS >
LocationManagerImpl< T > & fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::getLocationManager ( )
inlineoverridevirtual

Reference to the internal LocationManager.

The LocationManager is notably used to easily access the LOCAL and DISTANT nodes in independent sets, thanks to the LocationManager::getLocalNodes() and LocationManager::getDistantNodes() functions.

Returns
internal LocationManager

Implements fpmas::api::graph::DistributedGraph< T >.

◆ balance() [1/4]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::balance ( api::graph::LoadBalancing< T > &  lb)
inlineoverridevirtual
Deprecated:
Deprecated in favor of balance(LoadBalancing<T>&, PartitionMode)

Implements fpmas::api::graph::DistributedGraph< T >.

◆ balance() [2/4]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::balance ( api::graph::LoadBalancing< T > &  lb,
api::graph::PartitionMode  partition_mode 
)
inlineoverridevirtual

Balances the graph across processors using the specified load balancing algorithm and partitioning strategy.

This function act as a synchronization barrier, so all the process must enter this function to ensure progress.

Parameters
lbload balancing algorithm
partition_modepartitioning strategy

Implements fpmas::api::graph::DistributedGraph< T >.

◆ balance() [3/4]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::balance ( api::graph::FixedVerticesLoadBalancing< T > &  lb,
api::graph::PartitionMap  fixed_vertices 
)
inlineoverridevirtual
Deprecated:
Deprecated in favor of balance(FixedVerticesLoadBalancing<T>&, PartitionMap, PartitionMode)

Implements fpmas::api::graph::DistributedGraph< T >.

◆ balance() [4/4]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::balance ( api::graph::FixedVerticesLoadBalancing< T > &  lb,
api::graph::PartitionMap  fixed_vertices,
api::graph::PartitionMode  partition_mode 
)
inlineoverridevirtual

Balances the graph using the specified load balancing algorithm with fixed vertices support.

This function act as a synchronization barrier, so all the process must enter this function to ensure progress.

Parameters
lbload balancing algorithm
fixed_verticesfixed vertices map
partition_modepartitioning strategy

Implements fpmas::api::graph::DistributedGraph< T >.

◆ distribute()

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::distribute ( api::graph::PartitionMap  partition)
overridevirtual

Distributes the Graph across processors according to the specified partition.

The partition describes nodes to export. In consequence, entries specified for nodes that are not LOCAL to this graph are ignored.

The partition is specified as a {node_id, process_rank} map.

The process then handles node serialization and migrations. Exported nodes becomes DISTANT.

Parameters
partitionexport partition

Implements fpmas::api::graph::DistributedGraph< T >.

◆ synchronize() [1/2]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::synchronize ( )
overridevirtual

Synchronizes the DistributedGraph.

This function acts as a synchronization barrier : all processes blocks until all other perform a synchronize() call.

The synchronization process involves two main steps :

  1. Link and Removed node synchronization (using synchronizationMode().getSyncLinker().synchronize())
  2. Node Data synchronization (using synchronizationMode().getDataSync().synchronize())

Different synchronization modes might define different policies to perform those synchronizations.

In any case, as specified in the corresponding function, it is guaranteed that :

  • links created with link() are committed, i.e. they are properly reported on other processes potentially involved, and added to the local graph if not done yet.
  • links destroyed with unlink() are properly removed from all the processes
  • nodes removed with removeNode() are properly removed from all the processes

Since all nodes are synchronized, the getUnsyncNodes() buffer is cleared.

Implements fpmas::api::graph::DistributedGraph< T >.

◆ synchronize() [2/2]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::synchronize ( std::unordered_set< NodeType * >  nodes,
bool  synchronize_links = true 
)
overridevirtual

Partially synchronizes the graph, as specified in the synchronize() method, except that the synchro::DataSync::synchronize(std::unordered_set<api::graph::DistributedNode<T>*>) method is used with the specified nodes instead.

Links synchronization is regularly performed with synchronizationMode().getSyncLinker().synchronize(), unless synchronize_links is false.

nodes are not required to be contained in getUnsyncNodes(), but are removed from this buffer if they do.

The specified nodes list might contain LOCAL and DISTANT nodes: it is the responsibility of the implemented synchro::DataSync to eventually not do anything with LOCAL nodes.

Parameters
nodesnodes to synchronize
synchronize_linksspecifies if synchro::SyncLinker::synchronize() must be called

Implements fpmas::api::graph::DistributedGraph< T >.

◆ buildNode() [1/2]

template<DIST_GRAPH_PARAMS >
DistributedGraph< DIST_GRAPH_PARAMS_SPEC >::NodeType * fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::buildNode ( T &&  data = std::move(T()))
overridevirtual

Builds a new LOCAL node into the graph.

The specified data is moved into the built node.

The node is inserted into the graph, triggering insert node events as specified in Graph::insert(NodeType*).

Parameters
datanode data
Returns
pointer to built node

Implements fpmas::api::graph::DistributedGraph< T >.

◆ buildNode() [2/2]

template<DIST_GRAPH_PARAMS >
DistributedGraph< DIST_GRAPH_PARAMS_SPEC >::NodeType * fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::buildNode ( const T &  data)
overridevirtual

Builds a new LOCAL node into the graph.

The specified data is copied to the built node.

The node is inserted into the graph, triggering insert node events as specified in Graph::insert(NodeType*).

Parameters
datanode data
Returns
pointer to built node

Implements fpmas::api::graph::DistributedGraph< T >.

◆ insertDistant()

template<DIST_GRAPH_PARAMS >
api::graph::DistributedNode< T > * fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::insertDistant ( api::graph::DistributedNode< T > *  node)
overridevirtual

Inserts a temporary DISTANT node into the graph.

The node is guaranteed to live at least until the next synchronize() call.

Once inserted, the temporary node can eventually be used as any other DISTANT node, and so can be linked to existing LOCAL and DISTANT nodes or to query data.

However, the DistributedNode::location() must be initialized manually, otherwise operations above might produce unexpected results.

The node must be dynamically allocated, and the DistributedGraph implementation automatically takes its ownership.

If a node with the same ID is already contained in the graph, the node is simply deleted and a pointer to the existing node is returned. Else, a pointer to the inserted node is returned.

This method can notably be used to implement distributed graph initialization algorithms. Indeed, if a node 0 is built on process 0 and node 1 is built on process 1, it is at first glance impossible to create a link from node 0 to node 1.

But, for example knowing that the node 1 is necessarily instanciated on process 1, it is possible to manually insert a DISTANT representation of node 1 using insertDistant() on process 0, what allows to build a link from node 0 to node 1 on process 0. Such link will be committed at the latest at the next synchronize() call and imported on process 1.

Parameters
nodetemporary DISTANT node to manually insert in the graph

Implements fpmas::api::graph::DistributedGraph< T >.

◆ link()

template<DIST_GRAPH_PARAMS >
DistributedGraph< DIST_GRAPH_PARAMS_SPEC >::EdgeType * fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::link ( NodeType *const  source,
NodeType *const  target,
api::graph::LayerId  layer_id 
)
overridevirtual

Links source to target on the specified layer.

The two nodes might be LOCAL, only one of them might be DISTANT, or **both of them might be DISTANT**. In this last case, it is however required that the two DISTANT representations of source and target nodes already exist in the local graph, i.e. each node is already connected to at least one LOCAL node.

In consequence the edge is not guaranteed to be inserted in the graph upon return, since its creation might require inter-process communications, depending on the synchronization mode.

However, it is guaranteed that upon return of the next synchronize() call, the edge is properly inserted in the graphs hosted by the processes that might require it, i.e. the processes that host at least one of its source and target nodes.

In any case, insert edge callbacks, as specified in Graph::insert(EdgeType*), are called only when the edge is effectively inserted into the graph.

Parameters
sourcesource node
targettarget node
layer_idlayer id

Implements fpmas::api::graph::DistributedGraph< T >.

◆ removeNode() [1/2]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::removeNode ( api::graph::DistributedNode< T > *  node)
overridevirtual

Globally removes the specified node from the graph.

The removed node might be DISTANT or LOCAL. The node is not guaranteed to be effectively removed upon return, since it might be involved in inter-process communications, depending on the synchronization mode.

However, it is guaranteed that upon return of the next synchronize() call, the node (and its connected edges) are completely removed from all the processes.

In any case, Erase node callbacks, as specified in Graph::erase(NodeType*), are called only when the node is effectively erased from the graph.

The node is assumed to belong to the graph, behavior is unspecified otherwise.

Parameters
nodepointer to node to remove

Implements fpmas::api::graph::DistributedGraph< T >.

◆ removeNode() [2/2]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::removeNode ( DistributedId  id)
inlineoverridevirtual

Globally removes the node with the specified id from the graph.

Equivalent to

api::graph::DistributedNode< T > * getNode(NodeIdType) override
Definition: graph.h:228
void removeNode(api::graph::DistributedNode< T > *) override
Definition: distributed_graph.h:630
See also
removeNode(NodeType*)
Parameters
idof the node to remove

Implements fpmas::api::graph::DistributedGraph< T >.

◆ unlink() [1/2]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::unlink ( EdgeType edge)
overridevirtual

Globally unlinks the specified edge.

The specified edge might be LOCAL or DISTANT.

In consequence the edge is not guaranteed to be effectively unlinked upon return, since it might be involved in inter-process communications, depending on the synchronization mode.

However, it is guaranteed that upon return of the next synchronize() call, the edge is completely removed from all the processes.

In any case, Erase edge callbacks, as specified in Graph::erase(EdgeType*), are called only when the edge is effectively erased from the graph.

Parameters
edgeedge to remove

Implements fpmas::api::graph::DistributedGraph< T >.

◆ unlink() [2/2]

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::unlink ( DistributedId  id)
inlineoverridevirtual

Globally unlinks the edge with the specified id.

Equivalent to

api::graph::DistributedEdge< T > * getEdge(EdgeIdType) override
Definition: graph.h:246
void unlink(EdgeType *) override
Definition: distributed_graph.h:395
See also
unlink(EdgeType*)
Parameters
idof the edge to unlink

Implements fpmas::api::graph::DistributedGraph< T >.

◆ switchLayer()

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::switchLayer ( EdgeType edge,
api::graph::LayerId  layer_id 
)
overridevirtual

Switches the edge to the specified layer.

Currently, this operation is only available for LOCAL edges.

The edge is properly re-linked to its source and target node, while the Edge::setLayer() method does not.

Parameters
edgeedge to switch
layer_idnew layer

Implements fpmas::api::graph::DistributedGraph< T >.

◆ addCallOnSetLocal()

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::addCallOnSetLocal ( SetLocalNodeCallback callback)
inlineoverridevirtual

Adds a set LOCAL node callback.

A DistributedNode is set LOCAL in the following situations :

Parameters
callbackset local node callback

Implements fpmas::api::graph::DistributedGraph< T >.

◆ onSetLocalCallbacks()

template<DIST_GRAPH_PARAMS >
std::vector< SetLocalNodeCallback * > fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::onSetLocalCallbacks ( ) const
inlineoverridevirtual

Current set local callbacks list.

Returns
set local callbacks

Implements fpmas::api::graph::DistributedGraph< T >.

◆ addCallOnSetDistant()

template<DIST_GRAPH_PARAMS >
void fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::addCallOnSetDistant ( SetDistantNodeCallback callback)
inlineoverridevirtual

Adds a set DISTANT callback.

A DistributedNode is set DISTANT in the following situations :

  • the node is exported to an other process (i.e. in a distribute() call) AND persist in the graph (i.e. at least one LOCAL node is still connected to this node)
  • the node is created as a missing source or target in the importEdge process
Parameters
callbackset distant node callback

Implements fpmas::api::graph::DistributedGraph< T >.

◆ onSetDistantCallbacks()

template<DIST_GRAPH_PARAMS >
std::vector< SetDistantNodeCallback * > fpmas::graph::detail::DistributedGraph< DIST_GRAPH_PARAMS >::onSetDistantCallbacks ( ) const
inlineoverridevirtual

Current set distant callbacks list.

Returns
set distant callbacks

Implements fpmas::api::graph::DistributedGraph< T >.


The documentation for this class was generated from the following file: