Search Results for

    Show / Hide Table of Contents

    Class graph::Edge

    Base representation of an edge.

    An edge consists of a list of ids of nodes that are part of it. For a regular graph, this list of nodes would always have lenght 2; in the case of a hypergraph it will typically be 2+. There is currently no support for directed graphs.

    Note

    A node does not know its own id as this information can change when the graph is mutated.

    Inheritance
    utils::Component
    graph::Edge
    graph::CostEdge
    Inherited Members
    ~Component
    Component
    param
    get_class_name

    Constructors

    Edge()

    Default constructor for an empty edge.

    Declaration
    graph::Edge::Edge()

    Edge()

    Constructor with node list initialization.

    Declaration
    graph::Edge::Edge(const std::vector<int>&node_ids)

    Methods

    node_ids()

    Accessor for the list of node ids.

    Declaration
    const std::vector<int>&graph::Edge::node_ids() const

    clear_node_ids()

    Remove all node_ids from this edge.

    Declaration
    void graph::Edge::clear_node_ids()

    sort_node_ids()

    Order the node_ids ascendingly.

    Declaration
    void graph::Edge::sort_node_ids()

    add_node_id()

    Append a node at the end of the node_id list.

    Declaration
    void graph::Edge::add_node_id(int node_id)

    remove_node_id()

    Find and remove a node from the list.

    This will remove exactly one instance if one is found, zero otherwise.

    Declaration
    void graph::Edge::remove_node_id(int node_id)

    configure()

    Serialize the edge's node_ids under ["ids"].

    Declaration
    void graph::Edge::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::Edge::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::Edge::get_status() const override

    rescale()

    Declaration
    virtual void graph::Edge::rescale(double scale_factor)

    nodes_count()

    Declaration
    size_t graph::Edge::nodes_count() const

    num_nodes()

    Declaration
    size_t graph::Edge::num_nodes(const utils::Json&json)

    memory_estimate()

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