GraphOptInterface
Documentation for GraphOptInterface.
GraphOptInterface.AbstractGraphOptimizerGraphOptInterface.BipartiteGraphGraphOptInterface.BipartiteGraphGraphOptInterface.EdgeGraphOptInterface.EdgeGraphOptInterface.EdgeIndexGraphOptInterface.EdgeIndexMapGraphOptInterface.EdgeIndexMapGraphOptInterface.GraphIndexGraphOptInterface.HyperEdgeGraphOptInterface.HyperEdgeGraphOptInterface.HyperEdgeGraphOptInterface.HyperGraphGraphOptInterface.HyperGraphGraphOptInterface.HyperMapGraphOptInterface.HyperMapGraphOptInterface.HyperNodeGraphOptInterface.NodeGraphOptInterface.NodeGraphOptInterface.NodeIndexGraphOptInterface.OptiGraphBase.:==Base.getindexBase.getindexBase.getindexBase.getindexBase.getindexBase.getindexBase.reverseBase.setindex!Base.setindex!Base.setindex!Base.setindex!GraphOptInterface.add_edgeGraphOptInterface.add_nodeGraphOptInterface.add_subgraphGraphOptInterface.all_edgesGraphOptInterface.all_incident_edgesGraphOptInterface.all_neighborsGraphOptInterface.all_nodesGraphOptInterface.all_subgraphsGraphOptInterface.build_hypergraph_mapGraphOptInterface.children_incident_edgesGraphOptInterface.edge_indexGraphOptInterface.expandGraphOptInterface.get_edge_variableGraphOptInterface.get_edgesGraphOptInterface.get_hyperedgeGraphOptInterface.get_hyperedgeGraphOptInterface.get_mapped_edgesGraphOptInterface.get_mapped_edgesGraphOptInterface.get_mapped_nodesGraphOptInterface.get_mapped_nodesGraphOptInterface.get_node_variableGraphOptInterface.get_nodesGraphOptInterface.get_nodesGraphOptInterface.get_nodes_to_depthGraphOptInterface.get_subgraphsGraphOptInterface.graph_indexGraphOptInterface.identify_edgesGraphOptInterface.identify_nodesGraphOptInterface.identify_separatorsGraphOptInterface.incident_edgesGraphOptInterface.incident_edgesGraphOptInterface.induced_edgesGraphOptInterface.induced_elementsGraphOptInterface.neighborhoodGraphOptInterface.node_indexGraphOptInterface.node_variablesGraphOptInterface.non_parent_incident_edgesGraphOptInterface.non_parent_neighborsGraphOptInterface.num_all_nodesGraphOptInterface.num_all_subgraphsGraphOptInterface.num_edgesGraphOptInterface.num_nodesGraphOptInterface.num_subgraphsGraphOptInterface.parent_incident_edgesGraphOptInterface.parent_neighborsGraphOptInterface.raw_indexGraphOptInterface.raw_indexGraphOptInterface.raw_indexGraphOptInterface.stringGraphOptInterface.stringGraphOptInterface.supports_graph_interfaceGraphs.LinAlg.adjacency_matrixGraphs.LinAlg.adjacency_matrixGraphs.LinAlg.incidence_matrixGraphs.SimpleGraphs.add_edge!Graphs.SimpleGraphs.add_edge!Graphs.SimpleGraphs.add_vertex!Graphs.SimpleGraphs.add_vertex!Graphs.all_neighborsGraphs.degreeGraphs.edgesGraphs.edgesGraphs.edgetypeGraphs.edgetypeGraphs.has_edgeGraphs.has_edgeGraphs.has_edgeGraphs.has_vertexGraphs.has_vertexGraphs.is_directedGraphs.is_directedGraphs.is_directedGraphs.is_directedGraphs.neGraphs.neGraphs.nvGraphs.nvGraphs.verticesGraphs.verticesGraphs.verticesMathOptInterface.add_variable
GraphOptInterface.AbstractGraphOptimizer — TypeAbstractGraphOptimizerAbstract supertype for block-structure-exploiting optimizers.
GraphOptInterface.BipartiteGraph — TypeBipartiteGraphA simple bipartite graph. Contains two vertex sets to enforce bipartite structure.
GraphOptInterface.BipartiteGraph — MethodBipartiteGraph()Construct an empty BipartiteGraph with no vertices or edges.
GraphOptInterface.Edge — TypeEdgeAn edge represents different types of coupling. For instance an Edge{Tuple{Node}} is an edge the couple variables within a single node. An Edge{Tuple{N,Node}} couple variables across one or more nodes.
GraphOptInterface.Edge — MethodEdge(graph_index::GraphIndex, edge_index::EdgeIndex, nodes::NTuple{N,Node})Construct a new Edge connecting the given tuple of nodes. Initializes an empty MOI model and edge index map for storing coupling constraints.
GraphOptInterface.EdgeIndex — TypeEdgeIndexA unique identifier for an Edge using an integer value.
GraphOptInterface.EdgeIndexMap — TypeEdgeIndexMapA bidirectional mapping between edge variables and their corresponding node variables. Contains mappings from edge variables to (Node, MOI.VariableIndex) tuples and vice versa.
GraphOptInterface.EdgeIndexMap — MethodEdgeIndexMap()Construct an empty EdgeIndexMap with no variable mappings.
GraphOptInterface.GraphIndex — TypeGraphIndexA unique identifier for an OptiGraph using a Symbol value.
GraphOptInterface.HyperEdge — TypeHyperEdgeA hyperedge connecting multiple hypernodes in a hypergraph. Contains a set of vertices (hypernodes) that the edge connects.
GraphOptInterface.HyperEdge — MethodHyperEdge(t::HyperNode...)Construct a HyperEdge from a variable number of hypernode arguments.
GraphOptInterface.HyperEdge — MethodHyperEdge(t::Vector{HyperNode})Construct a HyperEdge from a vector of hypernodes.
GraphOptInterface.HyperGraph — TypeHyperGraphA very simple hypergraph type. Contains attributes for vertices and hyperedges.
GraphOptInterface.HyperGraph — MethodHyperGraph()Construct an empty HyperGraph with no vertices or hyperedges.
GraphOptInterface.HyperMap — TypeHyperMapA mapping from an OptiGraph to a graph view that supports various graph query functions. Currently supports a HyperGraph as the graph view.
GraphOptInterface.HyperMap — MethodHyperMap(graph::OptiGraph, hypergraph::HyperGraph)Construct a new HyperMap with empty mappings between the given graph and hypergraph.
GraphOptInterface.HyperNode — TypeHyperNodeType alias for a hypernode, represented as an Int64.
GraphOptInterface.Node — TypeNodeA node represents a set of variables and associated attributes.
GraphOptInterface.Node — MethodNode(graph_index::GraphIndex, node_index::NodeIndex)Construct a new Node with the given graph and node indices. Initializes an empty MOI model for storing variables and constraints.
GraphOptInterface.NodeIndex — TypeNodeIndexA unique identifier for a Node using an integer value.
GraphOptInterface.OptiGraph — TypeOptiGraphA hierarchical graph structure for representing optimization problems with block structure. Contains nodes (representing subproblems), edges (representing coupling constraints), and subgraphs (for hierarchical decomposition).
Fields
index::GraphIndex: Unique identifier for the graphparent::Union{Nothing,OptiGraph}: Parent graph (if this is a subgraph)nodes::Vector{Node}: Nodes in this graphedges::Vector{Edge}: Edges in this graphsubgraphs::Vector{OptiGraph}: Child subgraphsnode_by_index::OrderedDict{NodeIndex,Node}: Lookup map for nodesedge_by_index::OrderedDict{EdgeIndex,Edge}: Lookup map for edgessubgraph_by_index::OrderedDict{GraphIndex,OptiGraph}: Lookup map for subgraphs
Base.:== — MethodBase.:(==)(h1::HyperEdge, h2::HyperEdge)Check if two hyperedges are equal by comparing their vertex sets.
Base.getindex — MethodBase.getindex(hypergraph::HyperGraph, edge::HyperEdge)Get the integer index of a hyperedge in the hypergraph.
Base.getindex — MethodBase.getindex(hypergraph::HyperGraph, node::HyperNode)Get the index of a hypernode (returns the node itself as the index).
Base.getindex — MethodBase.getindex(hyper_map::HyperMap, edge::Edge)Get the HyperEdge that corresponds to the given edge in the hyper map.
Base.getindex — MethodBase.getindex(hyper_map::HyperMap, hyperedge::HyperEdge)Get the Edge that corresponds to the given hyperedge in the hyper map.
Base.getindex — MethodBase.getindex(hyper_map::HyperMap, node::Node)Get the HyperNode that corresponds to the given node in the hyper map.
Base.getindex — MethodBase.getindex(hyper_map::HyperMap, vertex::HyperNode)Get the Node that corresponds to the given vertex in the hyper map.
Base.reverse — MethodBase.reverse(e::HyperEdge)Hyperedges do not support reversal. Throws an error.
Base.setindex! — MethodBase.setindex!(hyper_map::HyperMap, edge::Edge, hyperedge::HyperEdge)Set the mapping from edge to hyperedge in the hyper map.
Base.setindex! — MethodBase.setindex!(hyper_map::HyperMap, hyperedge::HyperEdge, edge::Edge)Set the mapping from hyperedge to edge in the hyper map.
Base.setindex! — MethodBase.setindex!(hyper_map::HyperMap, node::Node, vertex::HyperNode)Set the mapping from node to vertex in the hyper map.
Base.setindex! — MethodBase.setindex!(hyper_map::HyperMap, vertex::HyperNode, node::Node)Set the mapping from vertex to node in the hyper map.
GraphOptInterface.add_edge — Methodadd_edge(graph::OptiGraph, nodes::NTuple{N,Node})::Edge where NAdd an edge to graph.
GraphOptInterface.add_node — Methodadd_node(graph::OptiGraph)::NodeAdd a node to graph. The index of the node is determined by the central graph.
GraphOptInterface.add_subgraph — Methodadd_subgraph(graph::OptiGraph)Add a new subgraph to graph.
GraphOptInterface.all_edges — Methodall_edges(graph::OptiGraph)Return all edges in graph including edges from all subgraphs recursively.
GraphOptInterface.all_incident_edges — Methodall_incident_edges(hyper_map::HyperMap, nodes::Vector{Node})::Vector{Edge}Return all of the edges within the optigraph in hyper_map that are incident to the vector of supplied nodes.
GraphOptInterface.all_neighbors — Methodall_neighbors(hyper_map::HyperMap, nodes::Vector{Node})::Vector{Node}Return the neighbor nodes within the optigraph in hyper_map to the vector of supplied optigraph nodes.
GraphOptInterface.all_nodes — Methodall_nodes(graph::OptiGraph)Return all nodes in graph including nodes from all subgraphs recursively.
GraphOptInterface.all_subgraphs — Methodall_subgraphs(graph::OptiGraph)Return all subgraphs contained in graph recursively.
GraphOptInterface.build_hypergraph_map — Methodbuild_hypergraph_map(graph::OptiGraph)Build a HyperMap that maps the given graph to a HyperGraph representation. Creates hypernodes for each node and hyperedges for each edge in the graph. Returns the complete mapping.
GraphOptInterface.children_incident_edges — Methodchildren_incident_edges(hyper_map::HyperMap, graph::OptiGraph)::Vector{Edge}Return all of the optigraph edges that are incident to the supplied graph that are strictly child connections.
GraphOptInterface.edge_index — Methodedge_index(edge::Edge)::EdgeIndexReturn the EdgeIndex of the given edge.
GraphOptInterface.expand — Methodexpand(g::HyperGraph, nodes::Vector{HyperNode}, distance::Int64)Expand the given nodes by the specified distance. Returns a tuple of (new_nodes, new_edges) where new_nodes includes all nodes within distance and new_edges are the induced hyperedges on those nodes.
GraphOptInterface.get_edge_variable — Methodget_edge_variable(edge::Edge, node::Node, variable::MOI.VariableIndex)Get the edge variable index that corresponds to the given node and variable pair.
GraphOptInterface.get_edges — Methodget_edges(graph::OptiGraph)Return the vector of edges directly contained in graph (not including subgraph edges).
GraphOptInterface.get_hyperedge — Methodget_hyperedge(hypergraph::HyperGraph, edge_index::Int64)Get the hyperedge corresponding to the given integer index.
GraphOptInterface.get_hyperedge — Methodget_hyperedge(hypergraph::HyperGraph, hypernodes::Set)Get the hyperedge connecting the given set of hypernodes.
GraphOptInterface.get_mapped_edges — Methodget_mapped_edges(hyper_map::HyperMap, edges::Vector{Edge})Get the hypergraph HyperEdge elements that correspond to the supplied optigraph edges.
GraphOptInterface.get_mapped_edges — Methodget_mapped_edges(hyper_map::HyperMap, edges::Vector{HyperEdge})Get the optigraph Edge elements that correspond to the supplied hypergraph edges.
GraphOptInterface.get_mapped_nodes — Methodget_mapped_nodes(hyper_map::HyperMap, nodes::Vector{Node})Get the hypernode elements that correspond to the supplied optigraph nodes.
GraphOptInterface.get_mapped_nodes — Methodget_mapped_nodes(hyper_map::HyperMap, nodes::Vector{HyperNode})Get the optigraph Node elements that correspond to the supplied hypergraph nodes.
GraphOptInterface.get_node_variable — Methodget_node_variable(edge::Edge, variable::MOI.VariableIndex)Get the (Node, MOI.VariableIndex) tuple that corresponds to the given edge variable.
GraphOptInterface.get_nodes — Methodget_nodes(edge::Edge)Return a vector of all nodes connected by the given edge.
GraphOptInterface.get_nodes — Methodget_nodes(graph::OptiGraph)Return the vector of nodes directly contained in graph (not including subgraph nodes).
GraphOptInterface.get_nodes_to_depth — Functionget_nodes_to_depth(graph::OptiGraph, depth::Int=0)Return nodes in graph up to the specified depth of subgraphs. A depth of 0 returns only nodes in the current graph, depth of 1 includes immediate subgraph nodes, etc.
GraphOptInterface.get_subgraphs — Methodget_subgraphs(graph::OptiGraph)Return the vector of immediate subgraphs contained in graph.
GraphOptInterface.graph_index — Methodgraph_index(graph::OptiGraph)Return the GraphIndex of the given graph.
GraphOptInterface.identify_edges — Methodidentify_edges(hypergraph::HyperGraph,partitions::Vector{Vector{HyperNode}})Identify both induced partition edges and cut edges given a partition of HyperNode vectors.
GraphOptInterface.identify_nodes — Methodidentify_nodes(hypergraph::HyperGraph,partitions::Vector{Vector{HyperEdge}})Identify both induced partition nodes and cut nodes given a partition of HyperEdge vectors.
GraphOptInterface.identify_separators — Methodidentify_separators(bgraph::BipartiteGraph, partitions::Vector; cut_selector=Graphs.degree)Identify separator elements (cut vertices or cut edges) that separate the given partitions. The cut_selector parameter determines how to assign boundary elements to cuts. It can be:
- A function (e.g.,
Graphs.degree) that compares element degrees :vertexto always assign vertices as separators:edgeto always assign edges as separators
Returns a tuple (partition_elements, cross_elements) where partition_elements are the elements local to each partition and cross_elements are the separator elements.
GraphOptInterface.incident_edges — Methodincident_edges(hypergraph::HyperGraph,hypernode::HyperNode)Identify the incident hyperedges to a HyperNode.
GraphOptInterface.incident_edges — Methodincident_edges(hypergraph::HyperGraph,hypernodes::Vector{HyperNode})Identify the incident hyperedges to a vector of HyperNodes.
GraphOptInterface.induced_edges — Methodinduced_edges(hypergraph::HyperGraph,hypernodes::Vector{HyperNode})Identify the induced hyperedges to a vector of HyperNodes.
NOTE: This currently does not support hypergraphs with unconnected nodes
GraphOptInterface.induced_elements — Methodinduced_elements(bgraph::BipartiteGraph, partitions::Vector; cut_selector=Graphs.degree)Get the induced elements for each partition (i.e., elements local to each partition, excluding separators). This is a convenience function that returns only the first element of identify_separators.
Arguments
bgraph::BipartiteGraph: The bipartite graphpartitions::Vector: Vector of partitionscut_selector=Graphs.degree: Selector for determining cut assignment (function,:vertex, or:edge)
Returns
A vector of vectors, where each inner vector contains the induced elements for that partition.
GraphOptInterface.neighborhood — Methodneighborhood(g::HyperGraph, nodes::Vector{HyperNode}, distance::Int64)Retrieve the neighborhood within distance of nodes. Returns a vector containing the original vertices and all vertices within the specified distance.
GraphOptInterface.node_index — Methodnode_index(node::Node)::NodeIndexReturn the NodeIndex of the given node.
GraphOptInterface.node_variables — Methodnode_variables(edge::Edge)::Vector{Tuple{Node,MOI.VariableIndex}}Return a vector of tuples where each tuple contains the node and variable index associated with each edge variable.
GraphOptInterface.non_parent_incident_edges — Methodnon_parent_incident_edges(hyper_map::HyperMap, subgraph::OptiGraph)::Vector{Edge}Return all of the optigraph edges that are incident to the supplied subgraph that are strictly not parent connections.
GraphOptInterface.non_parent_neighbors — Methodnon_parent_neighbors(hyper_map::HyperMap, subgraph::OptiGraph)::Vector{Node}Return the neighbor nodes in subgraph based on the optigraph in hyper_map that are not in the parent graph of `subgraph.
GraphOptInterface.num_all_nodes — Methodnum_all_nodes(graph::OptiGraph)Return the total number of nodes in graph including all nodes in subgraphs recursively.
GraphOptInterface.num_all_subgraphs — Methodnum_all_subgraphs(graph::OptiGraph)Return the total number of subgraphs in graph recursively.
GraphOptInterface.num_edges — Methodnum_edges(graph::OptiGraph)Return the number of edges directly contained in graph (not including subgraph edges).
GraphOptInterface.num_nodes — Methodnum_nodes(graph::OptiGraph)Return the number of nodes directly contained in graph (not including subgraph nodes).
GraphOptInterface.num_subgraphs — Methodnum_subgraphs(graph::OptiGraph)Return the number of immediate subgraphs in graph.
GraphOptInterface.parent_incident_edges — Methodparent_incident_edges(hyper_map::HyperMap, subgraph::OptiGraph)::Vector{Edge}Return all of the optigraph edges that are incident to the supplied subgraph that are strictly parent connections.
GraphOptInterface.parent_neighbors — Methodparent_neighbors(hyper_map::HyperMap, subgraph::OptiGraph)::Vector{Node}Return the neighbor nodes in subgraph based on the optigraph in hyper_map that are only in the parent graph of `subgraph.
GraphOptInterface.raw_index — Methodraw_index(edge::Edge)Return the raw integer value of the edge's index.
GraphOptInterface.raw_index — Methodraw_index(node::Node)Return the raw integer value of the node's index.
GraphOptInterface.raw_index — Methodraw_index(graph::OptiGraph)Return the raw Symbol value of the graph's index.
GraphOptInterface.string — Methodstring(edge::HyperEdge)Return a string representation of the hyperedge showing its vertices.
GraphOptInterface.string — Methodstring(graph::HyperGraph)Return a string representation of the hypergraph showing vertex and edge counts.
GraphOptInterface.supports_graph_interface — Methodsupports_graph_interface(optimizer::MOI.AbstractOptimizer)Check if the given optimizer supports the graph interface. Returns false for standard MOI optimizers and true for AbstractGraphOptimizer subtypes.
Graphs.LinAlg.adjacency_matrix — MethodGraphs.adjacency_matrix(bgraph::BipartiteGraph)Return the adjacency matrix of the bipartite graph. Rows correspond to vertices in the first set, columns correspond to vertices in the second set.
Graphs.LinAlg.adjacency_matrix — MethodGraphs.adjacency_matrix(hypergraph::HyperGraph)Obtain the adjacency matrix from hypergraph. Returns a sparse matrix.
Graphs.LinAlg.incidence_matrix — MethodGraphs.incidence_matrix(hypergraph::HyperGraph)Obtain the incidence matrix representation of hypergraph. Rows correspond to vertices. Columns correspond to hyperedges. Returns a sparse matrix.
Graphs.SimpleGraphs.add_edge! — MethodGraphs.add_edge!(bgraph::BipartiteGraph, from::Int64, to::Int64)Add an edge between vertices from and to. Enforces bipartite structure by requiring that the vertices be in different vertex sets.
Graphs.SimpleGraphs.add_edge! — MethodGraphs.add_edge!(hypergraph::HyperGraph, hypernodes::HyperNode...)Add a hyperedge connecting the given hypernodes. If the hyperedge already exists, returns the existing hyperedge. Requires at least 2 hypernodes.
Graphs.SimpleGraphs.add_vertex! — MethodGraphs.add_vertex!(bgraph::BipartiteGraph; bipartite=1)Add a vertex to the bipartite graph. The bipartite keyword argument specifies which vertex set to add the vertex to (1 or 2). Returns the success status.
Graphs.SimpleGraphs.add_vertex! — MethodGraphs.add_vertex!(hypergraph::HyperGraph)Add a new vertex (hypernode) to the hypergraph. Returns the new hypernode index.
Graphs.all_neighbors — MethodGraphs.all_neighbors(g::HyperGraph, node::HyperNode)Return all neighbor nodes of the given node in sorted order. Neighbors are nodes that share at least one hyperedge with the given node.
Graphs.degree — MethodGraphs.degree(g::HyperGraph, v::Int)Return the degree of vertex v (the number of unique neighbors).
Graphs.edges — MethodGraphs.edges(bgraph::BipartiteGraph)Return an iterator over all edges in the bipartite graph.
Graphs.edges — MethodGraphs.edges(hypergraph::HyperGraph)Return an iterator over all hyperedges in the hypergraph.
Graphs.edgetype — MethodGraphs.edgetype(bgraph::BipartiteGraph)Return the edge type for a bipartite graph (SimpleEdge{Int64}).
Graphs.edgetype — MethodGraphs.edgetype(graph::HyperGraph)Return the edge type for a hypergraph (HyperEdge).
Graphs.has_edge — MethodGraphs.has_edge(bgraph::BipartiteGraph, from::Int64, to::Int64)Check if the bipartite graph has an edge from from to to.
Graphs.has_edge — MethodGraphs.has_edge(graph::HyperGraph, edge::HyperEdge)Check if the hypergraph contains the given hyperedge.
Graphs.has_edge — MethodGraphs.has_edge(graph::HyperGraph, hypernodes::Set{HyperNode})Check if the hypergraph has a hyperedge connecting the given set of hypernodes.
Graphs.has_vertex — MethodGraphs.has_vertex(bgraph::BipartiteGraph, v::Integer)Check if the bipartite graph contains vertex v.
Graphs.has_vertex — MethodGraphs.has_vertex(graph::HyperGraph, v::Integer)Check if the hypergraph contains the given vertex.
Graphs.is_directed — MethodGraphs.is_directed(bgraph::BipartiteGraph)Bipartite graphs are undirected. Always returns false.
Graphs.is_directed — MethodGraphs.is_directed(graph::HyperGraph)Hypergraphs are undirected. Always returns false.
Graphs.is_directed — MethodGraphs.is_directed(::Type{BipartiteGraph})Bipartite graphs are undirected. Always returns false.
Graphs.is_directed — MethodGraphs.is_directed(::Type{HyperGraph})Hypergraphs are undirected. Always returns false.
Graphs.ne — MethodGraphs.ne(bgraph::BipartiteGraph)Return the number of edges in the bipartite graph.
Graphs.ne — MethodGraphs.ne(graph::HyperGraph)Return the number of hyperedges in the hypergraph.
Graphs.nv — MethodGraphs.nv(bgraph::BipartiteGraph)Return the number of vertices in the bipartite graph.
Graphs.nv — MethodGraphs.nv(graph::HyperGraph)Return the number of vertices (hypernodes) in the hypergraph.
Graphs.vertices — MethodGraphs.vertices(bgraph::BipartiteGraph)Return a vector of all vertices in the bipartite graph.
Graphs.vertices — MethodGraphs.vertices(hyperedge::HyperEdge)Return a vector of all vertices connected by the hyperedge.
Graphs.vertices — MethodGraphs.vertices(graph::HyperGraph)Return a vector of all vertices in the hypergraph.
MathOptInterface.add_variable — MethodMOI.add_variable(edge::Edge, node::Node, variable::MOI.VariableIndex)Add a variable to the edge that maps to the given variable on the specified node. Returns the edge's variable index for use in edge constraints.