Skip to content

Commit

Permalink
ux fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mastercyb committed Jul 31, 2024
1 parent 0574a39 commit 106934e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions pages/cyberank.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ alias:: cyber rank
import operator
import collections
def cyberank(cyberlinks: list, tolerance: float = 0.001, damping_factor: float = 0.8):
cyberlinks_dict = dict(functools.reduce(operator.add, map(collections.Counter, cyberlinks)))
objects = list(set([item for t in [list(x.keys())[0] for x in cyberlinks] for item in t]))
rank = [0] * len(objects)
size = len(objects)
default_rank = (1.0 - damping_factor) / size
dangling_nodes = [obj for obj in objects if obj not in [list(cyberlink.keys())[0][1] for cyberlink in cyberlinks]]
dangling_nodes_size = len(dangling_nodes)
inner_product_over_size = default_rank * (dangling_nodes_size / size)
default_rank_with_correction = (damping_factor * inner_product_over_size) + default_rank
change = tolerance + 1
steps = 0
prevrank = [0] * len(objects)
cyberlinks_dict = dict(functools.reduce(operator.add, map(collections.Counter, cyberlinks)))
objects = list(set([item for t in [list(x.keys())[0] for x in cyberlinks] for item in t]))
rank = [0] * len(objects)
size = len(objects)
default_rank = (1.0 - damping_factor) / size
dangling_nodes = [obj for obj in objects if obj not in [list(cyberlink.keys())[0][1] for cyberlink in cyberlinks]]
dangling_nodes_size = len(dangling_nodes)
inner_product_over_size = default_rank * (dangling_nodes_size / size)
default_rank_with_correction = (damping_factor * inner_product_over_size) + default_rank
change = tolerance + 1
steps = 0
prevrank = [0] * len(objects)
while change > tolerance:
for obj in objects:
obj_index = objects.index(obj)
Expand Down

0 comments on commit 106934e

Please sign in to comment.