Skip to content

Commit

Permalink
remove unused code from extract_bipartite_subgraph
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbybp committed Feb 5, 2024
1 parent 5f8fb1e commit f0c538f
Showing 1 changed file with 1 addition and 26 deletions.
27 changes: 1 addition & 26 deletions pyomo/contrib/incidence_analysis/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,39 +139,14 @@ def extract_bipartite_subgraph(graph, nodes0, nodes1):
"""
subgraph = graph.subgraph(nodes0 + nodes1)
# TODO: Any error checking that nodes are valid bipartition?
old_new_map = {}
for i, node in enumerate(nodes0 + nodes1):
if node in old_new_map:
raise RuntimeError("Node %s provided more than once.")
old_new_map[node] = i
relabeled_subgraph = nx.relabel_nodes(subgraph, old_new_map)
return relabeled_subgraph
#subgraph = nx.Graph()
#sub_M = len(nodes0)
#sub_N = len(nodes1)
#subgraph.add_nodes_from(range(sub_M), bipartite=0)
#subgraph.add_nodes_from(range(sub_M, sub_M + sub_N), bipartite=1)

#old_new_map = {}
#for i, node in enumerate(nodes0 + nodes1):
# if node in old_new_map:
# raise RuntimeError("Node %s provided more than once.")
# old_new_map[node] = i

#for node1, node2 in graph.edges():
# if node1 in old_new_map and node2 in old_new_map:
# new_node_1 = old_new_map[node1]
# new_node_2 = old_new_map[node2]
# if (
# subgraph.nodes[new_node_1]["bipartite"]
# == subgraph.nodes[new_node_2]["bipartite"]
# ):
# raise RuntimeError(
# "Subgraph is not bipartite. Found an edge between nodes"
# " %s and %s (in the original graph)." % (node1, node2)
# )
# subgraph.add_edge(new_node_1, new_node_2)
return subgraph


def _generate_variables_in_constraints(constraints, **kwds):
Expand Down

0 comments on commit f0c538f

Please sign in to comment.