Edge Sampling¶
-
class
RandomEdgeSampler
(number_of_edges: int = 100, seed: int = 42)[source]¶ An implementation of random edge sampling. Edges are sampled with the same uniform probability randomly. “For details about the algorithm see this paper.”
- Parameters
-
sample
(graph: Union[networkx.classes.graph.Graph, networkit.graph.Graph]) → Union[networkx.classes.graph.Graph, networkit.graph.Graph][source]¶ Sampling edges randomly.
- Arg types:
graph (NetworkX or NetworKit graph) - The graph to be sampled from.
- Return types:
new_graph (NetworkX or NetworKit graph) - The graph of sampled edges.
-
class
RandomNodeEdgeSampler
(number_of_edges: int = 100, seed: int = 42)[source]¶ An implementation of random node-edge sampling. The algorithm first randomly samples a node. From this node it samples an edge with a neighbor. “For details about the algorithm see this paper.”
- Parameters
-
sample
(graph: Union[networkx.classes.graph.Graph, networkit.graph.Graph]) → Union[networkx.classes.graph.Graph, networkit.graph.Graph][source]¶ Sampling edges randomly from randomly sampled nodes.
- Arg types:
graph (NetworkX or NetworKit graph) - The graph to be sampled from.
- Return types:
new_graph (NetworkX or NetworKit graph) - The graph of sampled edges.
-
class
HybridNodeEdgeSampler
(number_of_edges: int = 100, seed: int = 42, p: float = 0.8)[source]¶ An implementation of hybrid node-edge sampling. The algorithm alternates between two sampling methods. (A) Random uniform edge sampling. (B) The algorithm first randomly samples a node. From this node it samples an edge with a neighbor. “For details about the algorithm see this paper.”
- Parameters
-
sample
(graph: Union[networkx.classes.graph.Graph, networkit.graph.Graph]) → Union[networkx.classes.graph.Graph, networkit.graph.Graph][source]¶ Sampling edges randomly from randomly sampled nodes or sampling random edges.
- Arg types:
graph (NetworkX or NetworKit graph) - The graph to be sampled from.
- Return types:
new_graph (NetworkX or NetworKit graph) - The graph of sampled edges.
-
class
RandomEdgeSamplerWithPartialInduction
(p: float = 0.5, seed: int = 42)[source]¶ An implementation of random edge sampling with partial edge set induction. The algorithm randomly samples edges in a streaming fashion with a fixed probability. Edges between nodes which are already in the sample are retained with an induction step. “For details about the algorithm see this paper.”
- Parameters
-
sample
(graph: Union[networkx.classes.graph.Graph, networkit.graph.Graph]) → Union[networkx.classes.graph.Graph, networkit.graph.Graph][source]¶ Sampling edges randomly with partial induction.
- Arg types:
graph (NetworkX or NetworKit graph) - The graph to be sampled from.
- Return types:
new_graph (NetworkX or NetworKit graph) - The graph of sampled edges.
-
class
RandomEdgeSamplerWithInduction
(number_of_edges: int = 100, seed: int = 42)[source]¶ An implementation of random edge sampling with edge set induction. The algorithm randomly samples edges with a fixed probability. Edges between nodes which are already in the sample are retained with an induction step. “For details about the algorithm see this paper.”
- Parameters
-
sample
(graph: Union[networkx.classes.graph.Graph, networkit.graph.Graph]) → Union[networkx.classes.graph.Graph, networkit.graph.Graph][source]¶ Sampling edges randomly with induction.
- Arg types:
graph (NetworkX graph) - The graph to be sampled from.
- Return types:
new_graph (NetworkX graph) - The graph of sampled edges.