TrimLowFrequencyEdges removes edges that have less than the specified weight. Returns the number of edges removed
(edgeCutoff int64)
| 811 | // TrimLowFrequencyEdges removes edges that have less than |
| 812 | // the specified weight. Returns the number of edges removed |
| 813 | func (g *Graph) TrimLowFrequencyEdges(edgeCutoff int64) int { |
| 814 | var droppedEdges int |
| 815 | for _, n := range g.Nodes { |
| 816 | for src, e := range n.In { |
| 817 | if abs64(e.Weight) < edgeCutoff { |
| 818 | delete(n.In, src) |
| 819 | delete(src.Out, n) |
| 820 | droppedEdges++ |
| 821 | } |
| 822 | } |
| 823 | } |
| 824 | return droppedEdges |
| 825 | } |
| 826 | |
| 827 | // SortNodes sorts the nodes in a graph based on a specific heuristic. |
| 828 | func (g *Graph) SortNodes(cum bool, visualMode bool) { |
no test coverage detected