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

Method construct_temporal_connection

KVCOMM/graph/graph.py:195–211  ·  view source on GitHub ↗

Rebuild temporal edges for non-zero rounds from masks while preventing cycles.

(
        self,
        round:int = 0,
        temperature: float = 1.0,
        threshold: float = None,
    )

Source from the content-addressed store, hash-verified

193 out_node.add_successor(in_node,'spatial')
194
195 def construct_temporal_connection(
196 self,
197 round:int = 0,
198 temperature: float = 1.0,
199 threshold: float = None,
200 ):
201 """Rebuild temporal edges for non-zero rounds from masks while preventing cycles."""
202 self.clear_temporal_connection()
203 if round == 0:
204 return
205 for potential_connection, edge_mask in zip(self.potential_temporal_edges, self.temporal_masks.view(-1)):
206 out_node:Node = self.find_node(potential_connection[0])
207 in_node:Node = self.find_node(potential_connection[1])
208 if edge_mask == 0.0:
209 continue
210 if not self.check_cycle(in_node, {out_node}):
211 out_node.add_successor(in_node,'temporal')
212
213 def run(
214 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