Skip to main content

Crate subgraphsearch_core

Crate subgraphsearch_core 

Source
Expand description

§subgraphsearch

Randomized tabu search for vertex-induced subgraphs with a given number of vertices and edges, regular ones, or ones of a given total weight, together with random graph generators, graph operations, and readers and writers for standard graph formats.

use subgraphsearch_core::{Graph, SearchParams, search};

// find induced 4-vertex paths (3 edges) in a 12-cycle
let g = Graph::from_edges(12, (0..12).map(|i| (i, (i + 1) % 12))).unwrap();
let result = search(&g, &SearchParams::new(4, 3)).unwrap();
let found = result.experiments.iter().find(|e| e.success).unwrap();
assert_eq!(g.induced_edge_count(&found.vertices), 3);

Modules:

  • graph: the Graph type.
  • search: the search itself, and regular: its regular-subgraph variant.
  • largest: the largest induced path, cycle or tree, clique or independent set a search finds.
  • generate and ops: random graphs, complements, induced subgraphs, switching, incidence structures.
  • formats: graph6, sparse6, Matrix Market, edge lists, sub_search adjacency lists, DOT, GraphML.
  • rng: the original programs’ generator (for exact reproduction) and xoshiro256++.
  • layout: force-directed layout for drawing graphs.
  • legacy: byte-for-byte emulation of the original sub_search and ggen programs.

Re-exports§

pub use formats::Format;
pub use generate::Model;
pub use graph::Graph;
pub use graph::GraphBuilder;
pub use graph::WeightedGraph;
pub use largest::Largest;
pub use largest::Shape;
pub use largest::largest;
pub use rng::RngKind;
pub use search::AUTO_TABU_TENURE;
pub use search::DEFAULT_KICK_SIZE;
pub use search::Experiment;
pub use search::MAX_AUTO_TABU_TENURE;
pub use search::Regular;
pub use search::SearchGraph;
pub use search::SearchParams;
pub use search::SearchResult;
pub use search::auto_tabu_tenure;
pub use search::search;
pub use search::search_sequential;
pub use search::search_settings;

Modules§

formats
Reading and writing graphs.
generate
Random graph generators, ported from the original ggen.
graph
Simple undirected graphs on vertices 0..n.
largest
The largest induced path, cycle, tree, clique or independent set a search finds, by searching one size after another.
layout
Force-directed graph layout (Fruchterman–Reingold), for visualization.
legacy
Byte-for-byte emulation of the original sub_search and ggen programs: the same stdin parameters, the same algorithms and random numbers, and the same output.
ops
Graph operations from the original ggen: complements, induced subgraphs, common neighborhoods and (Seidel) switching, plus graphs built from incidence structures, and products of graphs.
regular
Regular induced subgraphs: ports of the original reg_search and ereg_search.
rng
Random number generators.
search
Randomized tabu search for vertex-induced subgraphs with a prescribed edge count.

Enums§

Error
Errors reported by this crate.