我有許多差異的數據。表中的一組無向圖(如相鄰列表關係,一個節點與所有節點相連),我需要將所有單個無向圖分組。例如:特定無向圖的所有節點都將在一組中&組名稱將爲最小。的節點。 sel d.adj_node, min(d.adj_node) Over (Partition By a.node) as grp
table a
left join table b
on a.adj_node=b.no
我試圖從鄰接表中創建一個無向圖來練習Karger的最小切割算法。下面是我的代碼 class Vertex(object):
'''Represents a vertex, with the indices of edges
incident on it'''
def __init__(self,name,edgeIndices=[]):
self.nam