XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGraph Class Reference

#include <Graph.h>

Classes

class  EdgeIterator
struct  Storage
 Copyright (c) Theophilus Eriata. All Rights Reserved. More...

Public Types

using ConnectionValidator = xiiDelegate<xiiResult(const xiiGraph&, xiiGraphVertexHandle, xiiGraphVertexHandle, xiiGraphEdgeHandle)>
using Event = xiiEvent<const xiiGraphEvent&>

Public Member Functions

 xiiGraph (xiiAllocator *pAllocator=xiiDefaultAllocatorWrapper::GetAllocator())
 Copyright (c) Theophilus Eriata. All Rights Reserved.
 xiiGraph (xiiGraph &&other)
 xiiGraph (const xiiGraph &)=delete
void operator= (const xiiGraph &)=delete
xiiResult TryInitialize ()
xiiResult Reserve (xiiUInt32 vertexCapacity, xiiUInt32 edgeCapacity)
xiiResult SetLimits (xiiUInt32 vertexLimit, xiiUInt32 edgeLimit)
 Limits bound occupied slots (including retired slots), and fail before mutation when exceeded.
xiiResult TryAddVertex (xiiGraphVertexHandle &out_hVertex)
xiiResult TryAddEdge (xiiGraphVertexHandle hSource, xiiGraphVertexHandle hTarget, xiiGraphEdgeHandle &out_hEdge)
xiiResult TryRemoveVertex (xiiGraphVertexHandle hVertex)
xiiResult TryRemoveEdge (xiiGraphEdgeHandle hEdge)
xiiResult TryClear ()
xiiGraphVertexHandle AddVertex ()
 Convenience forms return invalid handles/false on failure. Prefer Try forms when failure must propagate.
xiiGraphEdgeHandle AddEdge (xiiGraphVertexHandle hSource, xiiGraphVertexHandle hTarget)
bool RemoveVertex (xiiGraphVertexHandle hVertex)
bool RemoveEdge (xiiGraphEdgeHandle hEdge)
void Clear ()
xiiResult ReconnectEdge (xiiGraphEdgeHandle hEdge, xiiGraphVertexHandle hSource, xiiGraphVertexHandle hTarget)
 Reconnect without changing edge identity. Failure leaves the original connectivity unchanged.
xiiResult SetConnectionValidator (ConnectionValidator validator)
xiiResult ValidateConnection (xiiGraphVertexHandle hSource, xiiGraphVertexHandle hTarget, xiiGraphEdgeHandle hExistingEdge={}) const
const Event & GetEvents () const
xiiResult CopyFrom (const xiiGraph &source, xiiGraphHandleMap *out_pMapping=nullptr)
xiiResult MoveFrom (xiiGraph &&source)
xiiResult Compact (xiiGraphHandleMap &out_mapping)
 Rebuild only live storage. Old handles become stale; output maps them to the new handles on success.
xiiAllocator * GetAllocator () const
xiiUInt32 GetVertexLimit () const
xiiUInt32 GetEdgeLimit () const
bool IsValid (xiiGraphVertexHandle hVertex) const
bool IsValid (xiiGraphEdgeHandle hEdge) const
xiiUInt32 GetVertexCount () const
xiiUInt32 GetEdgeCount () const
xiiArrayPtr< const xiiGraphVertexHandle > GetVertices () const
xiiArrayPtr< const xiiGraphEdgeHandle > GetEdges () const
xiiUInt32 GetVertexIndex (xiiGraphVertexHandle hVertex) const
 Transient indices into GetVertices()/GetEdges(). Invalid handles return xiiInvalidIndex.
xiiUInt32 GetEdgeIndex (xiiGraphEdgeHandle hEdge) const
xiiUInt32 GetInDegree (xiiGraphVertexHandle hVertex) const
 Invalid vertices return zero degrees and empty adjacency cursors.
xiiUInt32 GetOutDegree (xiiGraphVertexHandle hVertex) const
EdgeIterator GetIncomingEdges (xiiGraphVertexHandle hVertex) const
EdgeIterator GetOutgoingEdges (xiiGraphVertexHandle hVertex) const
xiiGraphVertexHandle GetSource (xiiGraphEdgeHandle hEdge) const
 Invalid edges return invalid endpoints.
xiiGraphVertexHandle GetTarget (xiiGraphEdgeHandle hEdge) const
xiiGraphEdgeHandle FindEdge (xiiGraphVertexHandle hSource, xiiGraphVertexHandle hTarget) const

Static Public Attributes

static constexpr xiiUInt32 MaxElementCount = 0xFFFFFFC0U

Detailed Description

General directed multigraph, with stable, graph-owned handles and no domain-specific semantics. Parallel edges, loops, cycles and isolated vertices are supported. Lookup/degree/edge removal are O(1), insertion amortized O(1), vertex removal O(in + out), enumeration O(V + E). Adjacency allocates nothing.

Unrelated handles survive mutation and Reserve. Reacquire all views, dense indices and cursors after any mutation. Adjacency visits newest edges first; dense enumeration uses swap removal. Removed/foreign handles are rejected. Generations never wrap: exhausted slots retire. Compact explicitly remaps all live handles.

Concurrent const access is supported; use xiiSynchronizedGraph for synchronized mutation. Validators, event handlers and algorithm visitors must not mutate the graph. Instance subscriptions/validators remain with the graph object when topology is moved. CopyFrom provides explicit, recoverable copying and remapping.

Member Function Documentation

◆ AddVertex()

xiiGraphVertexHandle xiiGraph::AddVertex ( )

Convenience forms return invalid handles/false on failure. Prefer Try forms when failure must propagate.

Copyright (c) Theophilus Eriata. All Rights Reserved.

◆ CopyFrom()

xiiResult xiiGraph::CopyFrom ( const xiiGraph & source,
xiiGraphHandleMap * out_pMapping = nullptr )

Transactional replacement. Copy creates new handles; move transfers source handles and empties source. Limits and validation of the destination apply. Subscriptions and validators are never copied/moved.

◆ GetVertexIndex()

xiiUInt32 xiiGraph::GetVertexIndex ( xiiGraphVertexHandle hVertex) const

Transient indices into GetVertices()/GetEdges(). Invalid handles return xiiInvalidIndex.

Copyright (c) Theophilus Eriata. All Rights Reserved.


The documentation for this class was generated from the following files:
  • /home/runner/work/XII/XII/Source/Engine/Core/Graph/Graph.h
  • /home/runner/work/XII/XII/Source/Engine/Core/Graph/Implementation/Graph.cpp
  • /home/runner/work/XII/XII/Source/Engine/Core/Graph/Implementation/GraphConnectivity.cpp
  • /home/runner/work/XII/XII/Source/Engine/Core/Graph/Implementation/GraphMutation.cpp