MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / construct_spatial_connection

Method construct_spatial_connection

KVCOMM/graph/graph.py:180–193  ·  view source on GitHub ↗

Rebuild spatial edges from masks while preventing cycles.

(
        self,
        temperature: float = 1.0,
        threshold: float = None,
    )

Source from the content-addressed store, hash-verified

178 self.nodes[node_id].add_successor(self.decision_node)
179
180 def construct_spatial_connection(
181 self,
182 temperature: float = 1.0,
183 threshold: float = None,
184 ):
185 """Rebuild spatial edges from masks while preventing cycles."""
186 self.clear_spatial_connection()
187 for potential_connection, edge_mask in zip(self.potential_spatial_edges, self.spatial_masks.view(-1)):
188 out_node:Node = self.find_node(potential_connection[0])
189 in_node:Node = self.find_node(potential_connection[1])
190 if edge_mask == 0.0:
191 continue
192 if not self.check_cycle(in_node, {out_node}):
193 out_node.add_successor(in_node,'spatial')
194
195 def construct_temporal_connection(
196 self,

Callers 2

runMethod · 0.95
arunMethod · 0.95

Calls 4

find_nodeMethod · 0.95
check_cycleMethod · 0.95
add_successorMethod · 0.80

Tested by

no test coverage detected