KristianKarl-zz/GraphWalker

Feature request: new keyword ratio_shared_weight

Opened this issue · 0 comments

Scenario to use:
When number of out-edge becomes large (using sub-graph), no way to set weight such as:

  • Very small. If you set one edge is 0.01w, 99 others edge share 0.99w, so each edge has 0.01w. So 0.01w is not 'very small' at this time.
  • Very big? no, simply set weight=0.99, and it will always be very big.

How to use:

  • Same as weight.
  • 0 <= ratio_shared_weight <= 1
  • ratio_shared_weight can be combined with other keywords but weight.

How it work:

  • When an edge (e_A) has ratio_shared_weight , this edge has shared mode.
  • When an edge (e_B) has no keyword weight, or weight=0, weight=-0, weight=0.00, weight=-0.00..., this edge has shared mode.
  • e_A's weight = ratio_shared_weight * e_B's weight.
  • Assume we has n shared mode edges. Only one edge has ratio_shared_weight=y. We call weight of this edge is Y. We call weight of other edges is X (the same value).
  • (n - 1) * X + y * X = 1
  • => X = 1 / (n + y - 1)
  • => Y = y * X

Example:

  • We have 99 edges has no keyword weight and ratio_shared_weight. Each edge has weight=X.
  • 1 edge has ratio_shared_weight=0.01. This edge has weight = Y.
  • 99 * X + 0.01 * X = 1
  • X = 1 / (99 + 0.01) ~= 0.0101
  • Y = 0.01 * 0.0101 = 0.000101 << X

Note: the name ratio_shared_weight maybe a bad name, please choose other name if this feature is okay.

Sorry for my english, Please fix me!