Search Results for

    Show / Hide Table of Contents

    Class graph::Node

    Base class for graph nodes.

    A node's core property is the list of edges it participates in. This is a list of numeric edge_ids which only makes sense in the context of the Graph the note belongs to.

    • The node does not know its own NodeId as this information might change when the graph is manipulated (nodes ids are modified to ensure they form a contiguous set 0..N).
    • The node does not perform any validation on the list of edge_id's it is given; Ensuring validity of these is within the responsibility of the Graph.
    • If you need additional properties on the node, you can inherit from this base class (make sure to also overload configure accordingly).
    Inheritance
    utils::Component
    graph::Node
    graph::NodeWithFaces
    Inherited Members
    ~Component
    Component
    param
    get_class_name

    Constructors

    Node()

    Create an empty node. (Not participating in any edges).

    Declaration
    graph::Node::Node()

    Node()

    Create a node participating in a given set of edges.

    Declaration
    graph::Node::Node(const std::vector<size_t>&edge_ids)

    Methods

    edge_ids()

    Return the list of edges this node participates in.

    Declaration
    const std::vector<size_t>&graph::Node::edge_ids() const

    clear_edge_ids()

    Remove all edge_ids. This should typically be invoked from the Graph [not directly], as remove edge_ids implies the node's NodeId should be removed from the corresponding edges.

    Graph::remove_node

    Declaration
    void graph::Node::clear_edge_ids()

    sort_edge_ids()

    Ensure edge_ids are in ascending order.

    Declaration
    void graph::Node::sort_edge_ids()

    add_edge_id()

    Add an edge to this node.

    Declaration
    void graph::Node::add_edge_id(size_t edge_id)

    remove_edge_id()

    Remove an edge from this node.

    Declaration
    void graph::Node::remove_edge_id(size_t edge_id)

    configure()

    Read/Write this node from/to a serializer.

    Declaration
    void graph::Node::configure(const utils::Json&json) override

    render()

    render the object in structured form

    Return a structured representation of the object. This is intended for output purposes. For instance, the solution your solver finds should have a render method which allows it to be returned as part of the result. Example:

    {c++}
     MySolution : public Component {
      public:
       // Represent the internal bool vector as +-1 output.
       utils::Structure render() const override {
         utils::Structure rendered;
         for (bool item : solution_) rendered.push_back(item ? 1 : -1);
         return rendered;
       }
    
      private:
       std::vector<bool> solution_;
     }
    
     MySolution solution;
     std::cout << solution.render().to_string() << std::endl;
    

    utils::Structure

    Declaration
    utils::Structure graph::Node::render() const override

    get_status()

    get_status shows a simplified state representation

    Like render, this produces a structured representation of the object's state. However, it is intended to be simpler in nature with the purpose of rendering the object during stream-output and logging. By default, it will fall back to the full render, but overloading this allows distinguising how the object looks during LOG vs full output.

    Declaration
    utils::Structure graph::Node::get_status() const override

    memory_estimate()

    Declaration
    static size_t graph::Node::memory_estimate(size_t num_edges)
    In This Article
    Back to top Generated with Doxygen and DocFX