[med-svn] [r-cran-igraph] 01/03: New upstream version 1.1.2
Andreas Tille
tille at debian.org
Thu Sep 7 08:45:31 UTC 2017
This is an automated email from the git hooks/post-receive script.
tille pushed a commit to branch master
in repository r-cran-igraph.
commit 87a296fa006430124f7d4f1c73f41b04c12e9089
Author: Andreas Tille <tille at debian.org>
Date: Thu Sep 7 09:27:42 2017 +0200
New upstream version 1.1.2
---
DESCRIPTION | 48 +-
MD5 | 1460 ++---
NAMESPACE | 61 +-
R/adjacency.R | 12 +-
R/attributes.R | 63 +-
R/auto.R | 465 +-
R/basic.R | 9 +-
R/bipartite.R | 9 +-
R/centrality.R | 24 +-
R/cliques.R | 55 +-
R/cocitation.R | 10 +-
R/cohesive.blocks.R | 8 +-
R/community.R | 133 +-
R/components.R | 19 +-
R/console.R | 2 +
R/conversion.R | 49 +-
R/decomposition.R | 6 +-
R/embedding.R | 30 +-
R/epi.R | 4 +-
R/fit.R | 5 +-
R/flow.R | 62 +-
R/foreign.R | 104 +-
R/games.R | 140 +-
R/glet.R | 12 +-
R/hrg.R | 24 +-
R/igraph-package.R | 11 +-
R/incidence.R | 5 +-
R/indexing.R | 2 +-
R/interface.R | 78 +-
R/iterators.R | 240 +-
R/layout.R | 134 +-
R/layout_drl.R | 14 +-
R/lazyeval.R | 10 +-
R/make.R | 104 +-
R/mgclust.R | 10 +
R/minimum.spanning.tree.R | 13 +-
R/motifs.R | 21 +-
R/nexus.R | 9 +-
R/operators.R | 57 +-
R/other.R | 12 +-
R/package.R | 7 -
R/palette.R | 1 +
R/par.R | 99 +-
R/paths.R | 6 +-
R/plot.R | 55 +-
R/plot.common.R | 46 +-
R/plot.shapes.R | 22 +-
R/pp.R | 2 +-
R/print.R | 43 +-
R/printr.R | 7 +-
R/random_walk.R | 7 +-
R/rewire.R | 16 +-
R/scan.R | 55 +-
R/scg.R | 43 +-
R/sgm.R | 5 +-
R/socnet.R | 40 +
R/structural.properties.R | 307 +-
R/structure.info.R | 7 +-
R/test.R | 4 +-
R/tkplot.R | 2 +
R/topology.R | 36 +-
R/triangles.R | 2 +-
R/utils.R | 2 +-
R/uuid.R | 4 +-
R/versions.R | 6 +-
R/weakref.R | 10 +-
R/zzz-deprecate.R | 2 +
configure | 18 +-
configure.ac | 2 +-
inst/NEWS.md | 70 +
inst/README.md | 1 +
inst/benchmarks/time_call.R | 4 +-
inst/tests/test-vs-es-printing.R | 88 -
inst/tests/test-vs-indexing-lapply.R | 11 -
inst/tests/test_callbacks.R | 10 -
inst/tests/test_igraph.options.R | 14 -
inst/tests/test_layout.gem.R | 12 -
inst/tests/test_scg.R | 66 -
man/E.Rd | 37 +-
man/V.Rd | 35 +-
man/aaa-igraph-package.Rd | 11 +-
man/add_edges.Rd | 18 +-
man/add_layout_.Rd | 55 +-
man/add_vertices.Rd | 18 +-
man/adjacent_vertices.Rd | 20 +-
man/all_simple_paths.Rd | 5 +-
man/alpha_centrality.Rd | 16 +-
man/are_adjacent.Rd | 22 +-
man/arpack.Rd | 35 +-
man/articulation_points.Rd | 12 +-
man/as.directed.Rd | 12 +-
man/as.igraph.Rd | 5 +-
man/as_adj_list.Rd | 13 +-
man/as_adjacency_matrix.Rd | 6 +-
man/as_edgelist.Rd | 5 +-
man/as_graphnel.Rd | 7 +-
man/as_ids.Rd | 5 +-
man/as_incidence_matrix.Rd | 11 +-
man/as_long_data_frame.Rd | 3 +-
man/as_membership.Rd | 3 +-
man/assortativity.Rd | 14 +-
man/authority_score.Rd | 12 +-
man/automorphisms.Rd | 14 +-
man/betweenness.Rd | 18 +-
man/bfs.Rd | 12 +-
man/biconnected_components.Rd | 12 +-
man/bipartite_mapping.Rd | 6 +-
man/bipartite_projection.Rd | 10 +-
man/c.igraph.es.Rd | 34 +-
man/c.igraph.vs.Rd | 34 +-
man/canonical_permutation.Rd | 14 +-
man/categorical_pal.Rd | 7 +-
man/centr_betw.Rd | 17 +-
man/centr_betw_tmax.Rd | 17 +-
man/centr_clo.Rd | 19 +-
man/centr_clo_tmax.Rd | 19 +-
man/centr_degree.Rd | 20 +-
man/centr_degree_tmax.Rd | 20 +-
man/centr_eigen.Rd | 22 +-
man/centr_eigen_tmax.Rd | 22 +-
man/centralize.Rd | 22 +-
man/cliques.Rd | 25 +-
man/closeness.Rd | 15 +-
man/cluster_edge_betweenness.Rd | 17 +-
man/cluster_fast_greedy.Rd | 16 +-
man/cluster_infomap.Rd | 24 +-
man/cluster_label_prop.Rd | 18 +-
man/cluster_leading_eigen.Rd | 18 +-
man/cluster_louvain.Rd | 13 +-
man/cluster_optimal.Rd | 16 +-
man/cluster_spinglass.Rd | 26 +-
man/cluster_walktrap.Rd | 17 +-
man/cocitation.Rd | 7 +-
man/cohesive_blocks.Rd | 54 +-
man/communities.Rd | 61 +-
man/compare.Rd | 11 +-
man/complementer.Rd | 5 +-
man/component_wise.Rd | 61 +-
man/components.Rd | 25 +-
man/compose.Rd | 11 +-
man/consensus_tree.Rd | 14 +-
man/console.Rd | 9 +-
man/constraint.Rd | 15 +-
man/contract.Rd | 5 +-
man/convex_hull.Rd | 12 +-
man/coreness.Rd | 11 +-
man/count_isomorphisms.Rd | 28 +-
man/count_motifs.Rd | 8 +-
man/count_subgraph_isomorphisms.Rd | 29 +-
man/count_triangles.Rd | 14 +-
man/curve_multiple.Rd | 13 +-
man/decompose.Rd | 11 +-
man/degree.Rd | 6 +-
man/delete_edge_attr.Rd | 54 +-
man/delete_edges.Rd | 18 +-
man/delete_graph_attr.Rd | 54 +-
man/delete_vertex_attr.Rd | 54 +-
man/delete_vertices.Rd | 18 +-
man/dfs.Rd | 12 +-
man/diameter.Rd | 15 +-
man/difference.Rd | 3 +-
man/difference.igraph.Rd | 8 +-
man/difference.igraph.es.Rd | 33 +-
man/difference.igraph.vs.Rd | 33 +-
man/dim_select.Rd | 13 +-
man/disjoint_union.Rd | 13 +-
man/distances.Rd | 25 +-
man/diverging_pal.Rd | 7 +-
man/diversity.Rd | 10 +-
man/dominator_tree.Rd | 12 +-
man/dyad_census.Rd | 12 +-
man/each_edge.Rd | 14 +-
man/eccentricity.Rd | 3 +-
man/edge.Rd | 18 +-
man/edge_attr-set.Rd | 55 +-
man/edge_attr.Rd | 54 +-
man/edge_attr_names.Rd | 53 +-
man/edge_connectivity.Rd | 17 +-
man/edge_density.Rd | 11 +-
man/ego.Rd | 41 +-
man/eigen_centrality.Rd | 17 +-
man/embed_adjacency_matrix.Rd | 11 +-
man/embed_laplacian_matrix.Rd | 18 +-
man/ends.Rd | 21 +-
man/erdos.renyi.game.Rd | 12 +-
man/fit_hrg.Rd | 14 +-
man/fit_power_law.Rd | 13 +-
man/get.edge.ids.Rd | 26 +-
man/girth.Rd | 11 +-
man/gorder.Rd | 20 +-
man/graph_.Rd | 3 +-
man/graph_attr-set.Rd | 54 +-
man/graph_attr.Rd | 55 +-
man/graph_attr_names.Rd | 54 +-
man/graph_from_adj_list.Rd | 12 +-
man/graph_from_adjacency_matrix.Rd | 15 +-
man/graph_from_atlas.Rd | 42 +-
man/graph_from_data_frame.Rd | 18 +-
man/graph_from_edgelist.Rd | 42 +-
man/graph_from_graphdb.Rd | 12 +-
man/graph_from_graphnel.Rd | 5 +-
man/graph_from_incidence_matrix.Rd | 15 +-
man/graph_from_isomorphism_class.Rd | 28 +-
man/graph_from_lcf.Rd | 12 +-
man/graph_from_literal.Rd | 44 +-
man/graph_id.Rd | 32 +
man/graph_version.Rd | 3 +-
man/graphlet_basis.Rd | 12 +-
man/groups.Rd | 5 +-
man/gsize.Rd | 22 +-
man/head_of.Rd | 20 +-
man/head_print.Rd | 34 +
man/hrg-methods.Rd | 14 +-
man/hrg.Rd | 14 +-
man/hrg_tree.Rd | 14 +-
man/hub_score.Rd | 12 +-
man/identical_graphs.Rd | 5 +-
man/igraph-attribute-combination.Rd | 13 +-
man/igraph-dollar.Rd | 55 +-
man/igraph-es-attributes.Rd | 61 +-
man/igraph-es-indexing.Rd | 79 +-
man/igraph-es-indexing2.Rd | 70 +-
man/igraph-minus.Rd | 18 +-
man/igraph-vs-attributes.Rd | 87 +-
man/igraph-vs-indexing.Rd | 99 +-
man/igraph-vs-indexing2.Rd | 68 +-
man/igraph_demo.Rd | 11 +-
man/igraph_options.Rd | 48 +-
man/igraph_test.Rd | 3 +-
man/igraph_version.Rd | 6 +-
man/incident.Rd | 20 +-
man/incident_edges.Rd | 20 +-
man/indent_print.Rd | 21 +
man/intersection.Rd | 3 +-
man/intersection.igraph.Rd | 14 +-
man/intersection.igraph.es.Rd | 33 +-
man/intersection.igraph.vs.Rd | 33 +-
man/is_chordal.Rd | 13 +-
man/is_dag.Rd | 6 +-
man/is_degseq.Rd | 14 +-
man/is_directed.Rd | 22 +-
man/is_graphical.Rd | 14 +-
man/is_igraph.Rd | 6 +-
man/is_min_separator.Rd | 6 +-
man/is_named.Rd | 7 +-
man/is_printer_callback.Rd | 17 +
man/is_separator.Rd | 5 +-
man/is_weighted.Rd | 7 +-
man/isomorphic.Rd | 28 +-
man/isomorphism_class.Rd | 26 +-
man/isomorphisms.Rd | 28 +-
man/ivs.Rd | 24 +-
man/keeping_degseq.Rd | 15 +-
man/knn.Rd | 16 +-
man/laplacian_matrix.Rd | 7 +-
man/layout.deprecated.Rd | 9 +-
man/layout.fruchterman.reingold.grid.Rd | 3 +-
man/layout.spring.Rd | 3 +-
man/layout.svd.Rd | 3 +-
man/layout_.Rd | 57 +-
man/layout_as_bipartite.Rd | 64 +-
man/layout_as_star.Rd | 66 +-
man/layout_as_tree.Rd | 68 +-
man/layout_in_circle.Rd | 63 +-
man/layout_nicely.Rd | 62 +-
man/layout_on_grid.Rd | 63 +-
man/layout_on_sphere.Rd | 61 +-
man/layout_randomly.Rd | 61 +-
man/layout_with_dh.Rd | 63 +-
man/layout_with_drl.Rd | 22 +-
man/layout_with_fr.Rd | 69 +-
man/layout_with_gem.Rd | 65 +-
man/layout_with_graphopt.Rd | 64 +-
man/layout_with_kk.Rd | 68 +-
man/layout_with_lgl.Rd | 61 +-
man/layout_with_mds.Rd | 66 +-
man/layout_with_sugiyama.Rd | 67 +-
man/local_scan.Rd | 5 +-
man/make_.Rd | 3 +-
man/make_bipartite_graph.Rd | 16 +-
man/make_chordal_ring.Rd | 42 +-
man/make_clusters.Rd | 5 +-
man/make_de_bruijn_graph.Rd | 14 +-
man/make_empty_graph.Rd | 43 +-
man/make_full_bipartite_graph.Rd | 15 +-
man/make_full_citation_graph.Rd | 44 +-
man/make_full_graph.Rd | 46 +-
man/make_graph.Rd | 43 +-
man/make_kautz_graph.Rd | 13 +-
man/make_lattice.Rd | 42 +-
man/make_line_graph.Rd | 7 +-
man/make_ring.Rd | 47 +-
man/make_star.Rd | 43 +-
man/make_tree.Rd | 43 +-
man/match_vertices.Rd | 13 +-
man/matching.Rd | 20 +-
man/max_cardinality.Rd | 10 +-
man/max_flow.Rd | 15 +-
man/merge_coords.Rd | 60 +-
man/min_cut.Rd | 5 +-
man/min_separators.Rd | 3 +-
man/min_st_separators.Rd | 10 +-
man/modularity.igraph.Rd | 17 +-
man/motifs.Rd | 7 +-
man/mst.Rd | 16 +-
man/neighbors.Rd | 20 +-
man/nexus.Rd | 42 +-
man/norm_coords.Rd | 68 +-
man/normalize.Rd | 66 +-
man/page_rank.Rd | 20 +-
man/path.Rd | 17 +-
man/permute.Rd | 10 +-
man/pipe.Rd | 6 +-
man/plot.igraph.Rd | 13 +-
man/plot.sir.Rd | 13 +-
man/plot_dendrogram.communities.Rd | 13 +-
man/plot_dendrogram.igraphHRG.Rd | 7 +-
man/plus-.igraph.Rd | 17 +-
man/power_centrality.Rd | 18 +-
man/predict_edges.Rd | 16 +-
man/print.igraph.Rd | 26 +-
man/print.igraph.es.Rd | 34 +-
man/print.igraph.vs.Rd | 36 +-
man/print.igraphHRG.Rd | 35 +-
man/print.igraphHRGConsensus.Rd | 15 +-
man/printer_callback.Rd | 36 +
man/printr.Rd | 10 +
man/r_pal.Rd | 7 +-
man/radius.Rd | 3 +-
man/random_walk.Rd | 5 +-
man/read_graph.Rd | 20 +-
man/reciprocity.Rd | 5 +-
man/rep.igraph.Rd | 7 +-
man/rev.igraph.es.Rd | 35 +-
man/rev.igraph.vs.Rd | 35 +-
man/rewire.Rd | 7 +-
man/rglplot.Rd | 11 +-
man/running_mean.Rd | 7 +-
man/sample_.Rd | 3 +-
man/sample_bipartite.Rd | 15 +-
man/sample_correlated_gnp.Rd | 3 +-
man/sample_correlated_gnp_pair.Rd | 3 +-
man/sample_degseq.Rd | 15 +-
man/sample_dirichlet.Rd | 5 +-
man/sample_dot_product.Rd | 12 +-
man/sample_fitness.Rd | 10 +-
man/sample_fitness_pl.Rd | 10 +-
man/sample_forestfire.Rd | 12 +-
man/sample_gnm.Rd | 12 +-
man/sample_gnp.Rd | 12 +-
man/sample_grg.Rd | 15 +-
man/sample_growing.Rd | 15 +-
man/sample_hierarchical_sbm.Rd | 12 +-
man/sample_hrg.Rd | 15 +-
man/sample_islands.Rd | 12 +-
man/sample_k_regular.Rd | 12 +-
man/sample_last_cit.Rd | 15 +-
man/sample_motifs.Rd | 8 +-
man/sample_pa.Rd | 15 +-
man/sample_pa_age.Rd | 16 +-
man/sample_pref.Rd | 20 +-
man/sample_sbm.Rd | 12 +-
man/sample_seq.Rd | 13 +-
man/sample_smallworld.Rd | 13 +-
man/sample_sphere_surface.Rd | 5 +-
man/sample_sphere_volume.Rd | 5 +-
man/sample_traits_callaway.Rd | 9 +-
man/scan_stat.Rd | 3 +-
man/scg-method.Rd | 12 +-
man/scg.Rd | 18 +-
man/scg_eps.Rd | 14 +-
man/scg_group.Rd | 16 +-
man/scg_semi_proj.Rd | 17 +-
man/sequential_pal.Rd | 7 +-
man/set_edge_attr.Rd | 54 +-
man/set_graph_attr.Rd | 54 +-
man/set_vertex_attr.Rd | 54 +-
man/shapes.Rd | 15 +-
man/similarity.Rd | 14 +-
man/simplified.Rd | 9 +-
man/simplify.Rd | 13 +-
man/sir.Rd | 23 +-
man/spectrum.Rd | 13 +-
man/split_join_distance.Rd | 3 +-
man/srand.Rd | 3 +-
man/st_cuts.Rd | 12 +-
man/st_min_cuts.Rd | 12 +-
man/stochastic_matrix.Rd | 15 +-
man/strength.Rd | 12 +-
man/sub-.igraph.Rd | 24 +-
man/sub-sub-.igraph.Rd | 20 +-
man/subcomponent.Rd | 10 +-
man/subgraph.Rd | 11 +-
man/subgraph_centrality.Rd | 15 +-
man/subgraph_isomorphic.Rd | 31 +-
man/subgraph_isomorphisms.Rd | 26 +-
man/tail_of.Rd | 20 +-
man/tkigraph.Rd | 9 +-
man/tkplot.Rd | 55 +-
man/topo_sort.Rd | 10 +-
man/transitivity.Rd | 11 +-
man/triad_census.Rd | 12 +-
man/unfold_tree.Rd | 7 +-
man/union.Rd | 3 +-
man/union.igraph.Rd | 14 +-
man/union.igraph.es.Rd | 33 +-
man/union.igraph.vs.Rd | 33 +-
man/unique.igraph.es.Rd | 33 +-
man/unique.igraph.vs.Rd | 33 +-
man/upgrade_graph.Rd | 3 +-
man/vertex.Rd | 19 +-
man/vertex_attr-set.Rd | 54 +-
man/vertex_attr.Rd | 53 +-
man/vertex_attr_names.Rd | 53 +-
man/vertex_connectivity.Rd | 21 +-
man/which_multiple.Rd | 19 +-
man/which_mutual.Rd | 12 +-
man/with_edge_.Rd | 9 +-
man/with_graph_.Rd | 9 +-
man/with_igraph_opt.Rd | 29 +
man/with_vertex_.Rd | 9 +-
man/without_attr.Rd | 9 +-
man/without_loops.Rd | 9 +-
man/without_multiples.Rd | 9 +-
man/write_graph.Rd | 14 +-
src/CHOLMOD/Include/cholmod_blas.h | 2 +-
src/DensityGrid.cpp | 17 +-
src/DensityGrid_3d.cpp | 18 +-
src/Makevars.in | 2 +-
src/Makevars.win | 6 +-
src/adjlist.c | 46 +
src/atlas-edges.h | 2 +
src/attributes.c | 12 +-
src/bignum.h | 7 +-
src/bipartite.c | 3 +
src/bliss.cc | 405 +-
src/bliss/bignum.hh | 133 +
src/bliss/bliss_heap.cc | 99 +
src/bliss/defs.cc | 42 +
src/bliss/defs.hh | 128 +
src/bliss/graph.cc | 5606 ++++++++++++++++++++
src/bliss/graph.hh | 997 ++++
src/bliss/heap.hh | 83 +
src/bliss/igraph-changes.md | 36 +
src/{bliss_kqueue.hh => bliss/kqueue.hh} | 76 +-
src/bliss/kstack.hh | 141 +
src/{bliss_orbit.cc => bliss/orbit.cc} | 59 +-
src/bliss/orbit.hh | 111 +
src/bliss/partition.cc | 1143 ++++
src/bliss/partition.hh | 308 ++
src/{bliss_eqrefhash.cc => bliss/uintseqhash.cc} | 94 +-
src/bliss/uintseqhash.hh | 65 +
src/bliss/utils.cc | 122 +
src/bliss/utils.hh | 69 +
src/bliss_bignum.hh | 76 -
src/bliss_defs.hh | 52 -
src/bliss_eqrefhash.hh | 58 -
src/bliss_graph.cc | 2495 ---------
src/bliss_graph.hh | 236 -
src/bliss_heap.cc | 95 -
src/bliss_heap.hh | 47 -
src/bliss_kstack.hh | 98 -
src/bliss_orbit.hh | 53 -
src/bliss_partition.cc | 917 ----
src/bliss_partition.hh | 127 -
src/bliss_timer.cc | 111 -
src/bliss_timer.hh | 38 -
src/bliss_utils.cc | 60 -
src/bliss_utils.hh | 23 -
src/cattributes.c | 12 +-
src/centrality.c | 8 +-
src/cliquer/README | 61 +
src/cliquer/cliquer.c | 1777 +++++++
src/cliquer/cliquer.h | 57 +
src/cliquer/cliquer_graph.c | 768 +++
src/cliquer/cliquerconf.h | 68 +
src/cliquer/graph.h | 75 +
src/cliquer/misc.h | 73 +
src/cliquer/reorder.c | 425 ++
src/cliquer/reorder.h | 26 +
src/cliquer/set.h | 389 ++
src/cliques.c | 181 +-
src/clustertool.cpp | 11 +-
src/cohesive_blocks.c | 7 +
src/community.c | 20 +-
src/decomposition.c | 6 +
src/dotproduct.c | 2 +-
src/drl_layout.cpp | 1 +
src/fast_community.c | 212 +-
src/feedback_arc_set.c | 54 +-
src/flow.c | 7 +
src/foreign-dl-parser.c | 174 +-
src/foreign-dl-parser.y | 2 +-
src/foreign-graphml.c | 15 +-
src/foreign-pajek-parser.c | 187 +-
src/foreign-pajek-parser.y | 1 +
src/foreign.c | 11 +
src/games.c | 39 +-
src/gengraph_box_list.h | 4 +
src/gengraph_definitions.h | 2 +
src/glet.c | 161 +-
src/igraph_cliquer.c | 375 ++
src/igraph_cliquer.h | 29 +
src/igraph_math.h | 3 +
src/igraph_threading.h | 10 +-
src/igraph_version.h | 8 +-
src/include/igraph_adjlist.h | 126 +-
src/include/igraph_arpack.h | 38 +-
src/include/igraph_array.h | 10 +-
src/include/igraph_attributes.h | 194 +-
src/include/igraph_bipartite.h | 119 +-
src/include/igraph_blas.h | 25 +-
src/include/igraph_centrality.h | 277 +-
src/include/igraph_cliques.h | 104 +-
src/include/igraph_cocitation.h | 53 +-
src/include/igraph_community.h | 271 +-
src/include/igraph_complex.h | 133 +-
src/include/igraph_components.h | 45 +-
src/include/igraph_constants.h | 11 +-
src/include/igraph_constructors.h | 77 +-
src/include/igraph_conversion.h | 43 +-
src/include/igraph_datatype.h | 11 +-
src/include/igraph_decls.h | 24 +
src/include/igraph_dqueue.h | 11 +-
src/include/igraph_dqueue_pmt.h | 24 +-
src/include/igraph_eigen.h | 86 +-
src/include/igraph_embedding.h | 55 +-
src/include/igraph_epidemics.h | 21 +-
src/include/igraph_error.h | 46 +-
src/include/igraph_flow.h | 209 +-
src/include/igraph_foreign.h | 91 +-
src/include/igraph_games.h | 369 +-
src/include/igraph_graphlets.h | 51 +-
src/include/igraph_heap.h | 10 +-
src/include/igraph_heap_pmt.h | 18 +-
src/include/igraph_hrg.h | 91 +-
src/include/igraph_interface.h | 91 +-
src/include/igraph_interrupt.h | 16 +-
src/include/igraph_iterators.h | 145 +-
src/include/igraph_lapack.h | 81 +-
src/include/igraph_layout.h | 245 +-
src/include/igraph_matching.h | 41 +-
src/include/igraph_matrix.h | 11 +-
src/include/igraph_matrix_pmt.h | 122 +-
src/include/igraph_memory.h | 14 +-
src/include/igraph_microscopic_update.h | 57 +-
src/include/igraph_mixing.h | 35 +-
src/include/igraph_motifs.h | 65 +-
src/include/igraph_neighborhood.h | 30 +-
src/include/igraph_nongraph.h | 45 +-
src/include/igraph_operators.h | 53 +-
src/include/igraph_paths.h | 193 +-
src/include/igraph_progress.h | 22 +-
src/include/igraph_psumtree.h | 30 +-
src/include/igraph_qsort.h | 18 +-
src/include/igraph_random.h | 68 +-
src/include/igraph_scan.h | 61 +-
src/include/igraph_separators.h | 31 +-
src/include/igraph_spmatrix.h | 91 +-
src/include/igraph_stack.h | 11 +-
src/include/igraph_stack_pmt.h | 22 +-
src/include/igraph_statusbar.h | 17 +-
src/include/igraph_structural.h | 178 +-
src/include/igraph_strvector.h | 71 +-
src/include/igraph_threading.h.in | 10 +-
src/include/igraph_topology.h | 73 +-
src/include/igraph_transitivity.h | 25 +-
src/include/igraph_types.h | 32 +-
src/include/igraph_vector.h | 19 +-
src/include/igraph_vector_pmt.h | 136 +-
src/include/igraph_vector_ptr.h | 61 +-
src/include/igraph_version.h.in | 6 +
src/include/igraph_visitor.h | 11 +-
src/init.c | 740 +++
src/lad.c | 17 +-
src/layout.c | 6 +
src/layout_dh.c | 10 +-
src/layout_fr.c | 9 +-
src/layout_gem.c | 3 +-
src/layout_kk.c | 79 +-
src/lazyeval.c | 2 -
src/matching.c | 74 +-
src/memory.c | 24 +
src/microscopic_update.c | 4 +-
src/motifs.c | 72 +-
src/paths.c | 5 +-
src/pottsmodel_2.cpp | 2 +-
src/prpack.cpp | 5 +
src/prpack/prpack_csc.h | 7 +-
src/prpack/prpack_igraph_graph.cpp | 118 +-
src/prpack/prpack_solver.cpp | 1 -
src/rinterface.c | 115 +-
src/rinterface_extra.c | 1 -
src/sbm.c | 6 +-
src/scan.c | 6 +-
src/second.f | 2 +-
src/separators.c | 6 +-
src/simpleraytracer/RIgraphRay.cpp | 1 -
src/sparsemat.c | 67 +-
src/structural_properties.c | 490 +-
...ph_qsort.h => structural_properties_internal.h} | 36 +-
src/structure_generators.c | 41 +-
src/topology.c | 117 +-
src/triangles.c | 15 +-
src/triangles_template.h | 10 +-
src/triangles_template1.h | 10 +-
src/uuid/gen_uuid.c | 20 +-
src/vector.pmt | 5 +-
src/vector_ptr.c | 5 +-
tests/testthat.R | 4 +
.../tests => tests/testthat}/celegansneural.gml.gz | Bin
{inst/tests => tests/testthat}/dyad.census.R | 0
{inst/tests => tests/testthat}/football.gml.gz | Bin
{inst/tests => tests/testthat}/power.gml.gz | Bin
.../testthat}/test-constructor-modifiers.R | 0
tests/testthat/test-graph-ids.R | 72 +
{inst/tests => tests/testthat}/test-index-es.R | 2 +-
{inst/tests => tests/testthat}/test-isomorphism.R | 0
{inst/tests => tests/testthat}/test-make.R | 0
{inst/tests => tests/testthat}/test-make_graph.R | 0
.../tests => tests/testthat}/test-new-layout-api.R | 0
{inst/tests => tests/testthat}/test-notable.R | 0
.../tests => tests/testthat}/test-old-data-type.R | 0
{inst/tests => tests/testthat}/test-random_walk.R | 0
{inst/tests => tests/testthat}/test-version.R | 0
{inst/tests => tests/testthat}/test-versions.R | 0
tests/testthat/test-vs-es-printing.R | 110 +
{inst/tests => tests/testthat}/test-vs-es-quirks.R | 0
{inst/tests => tests/testthat}/test-vs-es.R | 91 +-
{inst/tests => tests/testthat}/test-vs-operators.R | 0
{inst/tests => tests/testthat}/test-weakref.R | 0
{inst/tests => tests/testthat}/test_add.edges.R | 0
{inst/tests => tests/testthat}/test_add.vertices.R | 0
.../testthat}/test_adjacency.spectral.embedding.R | 0
{inst/tests => tests/testthat}/test_all.st.cuts.R | 0
.../testthat}/test_alpha.centrality.R | 0
.../tests => tests/testthat}/test_are.connected.R | 0
{inst/tests => tests/testthat}/test_arpack.R | 0
.../testthat}/test_articulation.points.R | 0
{inst/tests => tests/testthat}/test_as.directed.R | 0
.../tests => tests/testthat}/test_as.undirected.R | 0
.../tests => tests/testthat}/test_assortativity.R | 0
{inst/tests => tests/testthat}/test_attributes.R | 0
.../testthat}/test_authority.score.R | 0
.../testthat}/test_average.path.length.R | 0
{inst/tests => tests/testthat}/test_ba.game.R | 0
{inst/tests => tests/testthat}/test_betweenness.R | 0
.../testthat}/test_biconnected.components.R | 0
.../testthat}/test_bipartite.projection.R | 0
.../testthat}/test_bipartite.random.game.R | 8 +-
{inst/tests => tests/testthat}/test_bonpow.R | 0
{inst/tests => tests/testthat}/test_bug-1019624.R | 0
{inst/tests => tests/testthat}/test_bug-1032819.R | 0
{inst/tests => tests/testthat}/test_bug-1033045.R | 0
.../testthat}/test_bug-1073705-indexing.R | 0
.../testthat}/test_bug-1073800-clique.R | 0
.../testthat}/test_canonical.permutation.R | 0
{inst/tests => tests/testthat}/test_cliques.R | 0
{inst/tests => tests/testthat}/test_closeness.R | 0
{inst/tests => tests/testthat}/test_clusters.R | 0
{inst/tests => tests/testthat}/test_communities.R | 0
{inst/tests => tests/testthat}/test_constraint.R | 0
.../testthat}/test_contract.vertices.R | 0
{inst/tests => tests/testthat}/test_correlated.R | 0
.../tests => tests/testthat}/test_count.multiple.R | 0
.../testthat}/test_decompose.graph.R | 0
{inst/tests => tests/testthat}/test_degree.R | 0
.../testthat}/test_degree.sequence.game.R | 0
{inst/tests => tests/testthat}/test_delete.edges.R | 0
.../testthat}/test_delete.vertices.R | 0
{inst/tests => tests/testthat}/test_diameter.R | 0
{inst/tests => tests/testthat}/test_dimSelect.R | 0
.../tests => tests/testthat}/test_dominator.tree.R | 0
.../testthat}/test_dot.product.game.R | 0
{inst/tests => tests/testthat}/test_dyad.census.R | 0
.../testthat}/test_edge.betweenness.R | 4 +-
.../testthat}/test_edge.betweenness.community.R | 0
.../testthat}/test_edge.connectivity.R | 0
{inst/tests => tests/testthat}/test_edgenames.R | 0
{inst/tests => tests/testthat}/test_evcent.R | 0
.../testthat}/test_fartherst.nodes.R | 0
.../testthat}/test_fastgreedy.community.R | 0
{inst/tests => tests/testthat}/test_forestfire.R | 0
.../tests => tests/testthat}/test_get.adjacency.R | 0
{inst/tests => tests/testthat}/test_get.adjlist.R | 6 +-
.../testthat}/test_get.all.shortest.paths.R | 0
{inst/tests => tests/testthat}/test_get.diameter.R | 0
{inst/tests => tests/testthat}/test_get.edge.R | 0
{inst/tests => tests/testthat}/test_get.edgelist.R | 0
.../tests => tests/testthat}/test_get.incidence.R | 0
.../testthat}/test_get.shortest.paths.R | 0
{inst/tests => tests/testthat}/test_girth.R | 0
.../tests => tests/testthat}/test_graph.adhesion.R | 0
.../testthat}/test_graph.adjacency.R | 0
.../tests => tests/testthat}/test_graph.adjlist.R | 0
{inst/tests => tests/testthat}/test_graph.atlas.R | 0
{inst/tests => tests/testthat}/test_graph.bfs.R | 10 +
.../testthat}/test_graph.bipartite.R | 0
.../testthat}/test_graph.complementer.R | 0
.../tests => tests/testthat}/test_graph.compose.R | 0
.../tests => tests/testthat}/test_graph.coreness.R | 0
.../testthat}/test_graph.data.frame.R | 0
.../testthat}/test_graph.de.bruijn.R | 0
.../tests => tests/testthat}/test_graph.density.R | 0
.../tests => tests/testthat}/test_graph.edgelist.R | 0
{inst/tests => tests/testthat}/test_graph.eigen.R | 0
.../tests => tests/testthat}/test_graph.formula.R | 0
.../tests => tests/testthat}/test_graph.isoclass.R | 0
{inst/tests => tests/testthat}/test_graph.kautz.R | 0
{inst/tests => tests/testthat}/test_graph.knn.R | 0
.../tests => tests/testthat}/test_graph.maxflow.R | 0
{inst/tests => tests/testthat}/test_graph.mincut.R | 0
.../testthat}/test_graph.subisomorphic.lad.R | 0
.../testthat}/test_graph.subisomorphic.vf2.R | 0
{inst/tests => tests/testthat}/test_graphNEL.R | 3 +-
{inst/tests => tests/testthat}/test_graphlets.R | 33 -
{inst/tests => tests/testthat}/test_hrg.R | 0
{inst/tests => tests/testthat}/test_hsbm.R | 0
tests/testthat/test_igraph.options.R | 45 +
.../testthat}/test_independent.vertex.sets.R | 0
{inst/tests => tests/testthat}/test_indexing.R | 0
{inst/tests => tests/testthat}/test_indexing2.R | 0
{inst/tests => tests/testthat}/test_indexing3.R | 0
{inst/tests => tests/testthat}/test_is.bipartite.R | 0
{inst/tests => tests/testthat}/test_is.chordal.R | 0
{inst/tests => tests/testthat}/test_iterators.R | 0
.../testthat}/test_label.propagation.community.R | 0
.../testthat}/test_laplacian.spectral.embedding.R | 0
.../testthat}/test_largest.cliques.R | 0
.../test_largest.independent.vertex.sets.R | 0
{inst/tests => tests/testthat}/test_layout.fr.R | 2 +
{inst/tests => tests/testthat}/test_layout.kk.R | 0
{inst/tests => tests/testthat}/test_layout.mds.R | 0
{inst/tests => tests/testthat}/test_layout.merge.R | 0
.../testthat}/test_leading.eigenvector.community.R | 0
.../testthat}/test_maximal_cliques.R | 0
.../testthat}/test_minimal.st.separators.R | 0
.../testthat}/test_minimum.size.separators.R | 0
.../testthat}/test_modularity_matrix.R | 0
{inst/tests => tests/testthat}/test_motifs.R | 0
.../testthat}/test_multilevel.community.R | 0
{inst/tests => tests/testthat}/test_neighborhood.R | 0
{inst/tests => tests/testthat}/test_neighbors.R | 0
{inst/tests => tests/testthat}/test_operators.R | 0
{inst/tests => tests/testthat}/test_operators3.R | 0
{inst/tests => tests/testthat}/test_operators4.R | 0
.../testthat}/test_optimal.community.R | 0
{inst/tests => tests/testthat}/test_pajek.R | 0
{inst/tests => tests/testthat}/test_print.R | 20 +-
{inst/tests => tests/testthat}/test_psumtree.R | 3 +-
{inst/tests => tests/testthat}/test_sample.R | 0
{inst/tests => tests/testthat}/test_sbm.game.R | 0
{inst/tests => tests/testthat}/test_scan.R | 0
{inst/tests => tests/testthat}/test_sdf.R | 0
{inst/tests => tests/testthat}/test_sgm.R | 0
{inst/tests => tests/testthat}/test_sir.R | 2 +
{inst/tests => tests/testthat}/test_sphere.R | 2 -
{inst/tests => tests/testthat}/test_transitivity.R | 4 +-
{inst/tests => tests/testthat}/test_triangles.R | 0
{inst/tests => tests/testthat}/test_unfold.tree.R | 0
.../testthat}/test_walktrap.community.R | 0
.../testthat}/test_watts.strogatz.game.R | 0
762 files changed, 23829 insertions(+), 15539 deletions(-)
diff --git a/DESCRIPTION b/DESCRIPTION
index b6e46c8..79a441d 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,36 +1,38 @@
Package: igraph
-Version: 1.0.1
+Version: 1.1.2
Title: Network Analysis and Visualization
Author: See AUTHORS file.
-Maintainer: Gabor Csardi <csardi.gabor at gmail.com>
+Maintainer: Gábor Csárdi <csardi.gabor at gmail.com>
Description: Routines for simple graphs and network analysis. It can
- handle large graphs very well and provides functions for generating random
- and regular graphs, graph visualization, centrality methods and much more.
+ handle large graphs very well and provides functions for generating random
+ and regular graphs, graph visualization, centrality methods and much more.
Depends: methods
-Imports: Matrix, magrittr, NMF, irlba
-Suggests: igraphdata, stats4, rgl, tcltk, graph, ape, scales
+Imports: graphics, grDevices, irlba, magrittr, Matrix, pkgconfig (>=
+ 2.0.0), stats, utils
+Suggests: ape, graph, igraphdata, NMF, rgl, scales, stats4, tcltk,
+ testthat
License: GPL (>= 2)
URL: http://igraph.org
SystemRequirements: gmp, libxml2
BugReports: https://github.com/igraph/igraph/issues
+Encoding: UTF-8
Collate: 'adjacency.R' 'auto.R' 'assortativity.R' 'attributes.R'
'basic.R' 'bipartite.R' 'centrality.R' 'centralization.R'
- 'cliques.R' 'cocitation.R' 'cohesive.blocks.R' 'printr.R'
- 'community.R' 'components.R' 'console.R' 'conversion.R'
- 'data_frame.R' 'decomposition.R' 'degseq.R' 'demo.R'
- 'embedding.R' 'epi.R' 'fit.R' 'flow.R' 'foreign.R' 'games.R'
- 'glet.R' 'hrg.R' 'igraph-package.R' 'incidence.R' 'indexing.R'
- 'interface.R' 'iterators.R' 'layout.R' 'layout_drl.R'
- 'lazyeval.R' 'make.R' 'mgclust.R' 'minimum.spanning.tree.R'
- 'motifs.R' 'nexus.R' 'operators.R' 'other.R' 'package.R'
- 'palette.R' 'par.R' 'paths.R' 'plot.R' 'plot.common.R'
- 'plot.shapes.R' 'pp.R' 'print.R' 'random_walk.R' 'rewire.R'
- 'scan.R' 'scg.R' 'sgm.R' 'similarity.R' 'simple.R' 'sir.R'
- 'socnet.R' 'sparsedf.R' 'structural.properties.R'
- 'structure.info.R' 'test.R' 'tkplot.R' 'topology.R'
- 'triangles.R' 'utils.R' 'uuid.R' 'versions.R' 'weakref.R'
- 'zzz-deprecate.R'
+ 'cliques.R' 'cocitation.R' 'cohesive.blocks.R' 'community.R'
+ 'components.R' 'console.R' 'conversion.R' 'data_frame.R'
+ 'decomposition.R' 'degseq.R' 'demo.R' 'embedding.R' 'epi.R'
+ 'fit.R' 'flow.R' 'foreign.R' 'games.R' 'glet.R' 'hrg.R'
+ 'igraph-package.R' 'incidence.R' 'indexing.R' 'interface.R'
+ 'iterators.R' 'layout.R' 'layout_drl.R' 'lazyeval.R' 'make.R'
+ 'mgclust.R' 'minimum.spanning.tree.R' 'motifs.R' 'nexus.R'
+ 'operators.R' 'other.R' 'package.R' 'palette.R' 'par.R'
+ 'paths.R' 'plot.R' 'plot.common.R' 'plot.shapes.R' 'pp.R'
+ 'print.R' 'printr.R' 'random_walk.R' 'rewire.R' 'scan.R'
+ 'scg.R' 'sgm.R' 'similarity.R' 'simple.R' 'sir.R' 'socnet.R'
+ 'sparsedf.R' 'structural.properties.R' 'structure.info.R'
+ 'test.R' 'tkplot.R' 'topology.R' 'triangles.R' 'utils.R'
+ 'uuid.R' 'versions.R' 'weakref.R' 'zzz-deprecate.R'
NeedsCompilation: yes
-Packaged: 2015-06-26 01:04:44 UTC; gaborcsardi
+Packaged: 2017-07-20 21:33:52 UTC; gaborcsardi
Repository: CRAN
-Date/Publication: 2015-06-26 11:13:24
+Date/Publication: 2017-07-21 11:39:40 UTC
diff --git a/MD5 b/MD5
index 5ea643c..9be82ce 100644
--- a/MD5
+++ b/MD5
@@ -1,81 +1,81 @@
-2c5e42dcbba6017e93ab51bf81b4f20a *DESCRIPTION
-50bafc0417326064ab29ea6a4644c220 *NAMESPACE
-55dd90c46ae68e431233c74c70817915 *R/adjacency.R
+3ec4922447c7ea18478bbb5b1a5d407c *DESCRIPTION
+a94031b4ea3e06c36f2397baf40b0498 *NAMESPACE
+638a4ff2bbdff1f6ba877d42da9f8da7 *R/adjacency.R
ba96cdf262f284a91629bcc81958464a *R/assortativity.R
-871276e16f6aeb7b9206f14d18706dbc *R/attributes.R
-7625f16ec000d67fba004b5527af4d0f *R/auto.R
+4e8a737d746fe286c63f20391b85f5d7 *R/attributes.R
+fefa1c0d053707ca1bceafe8f6be822a *R/auto.R
d41d8cd98f00b204e9800998ecf8427e *R/auto.R.in
-2aa7eb58f202fd133c29004b0f600615 *R/basic.R
-955c7998cfc2dd457548cbed16601a56 *R/bipartite.R
-61c7fd410ddf9e53528a33b384d07de2 *R/centrality.R
+5664da08a1f8845c2482800ebdd4da41 *R/basic.R
+5a57b9f50c12d6192bfce4cf68daf930 *R/bipartite.R
+25e22e5363ea555120ed49f181ee8ae1 *R/centrality.R
249b7f6fb9165564b81c3bf5df932290 *R/centralization.R
-535a949047902b37cf4f1b4b4659425d *R/cliques.R
-6c503afbcde5732d2070df77b7712f9f *R/cocitation.R
-bc9b293f380e0a87c33775da13707e56 *R/cohesive.blocks.R
-9200a81d3cd06c4970779c3d01851ce2 *R/community.R
-4767ee8bfdeacb4dbd4acf70715f560b *R/components.R
-21dccc6b3725cb86825cbe4bcf9ecefc *R/console.R
-845e3474688180d66cb87de42e14d279 *R/conversion.R
+4d30719473e0269bfed98ed719796f31 *R/cliques.R
+bbb60a4c74350d8ef25d2662aa49180c *R/cocitation.R
+487ba2140d68e06c0f92cfc651533bdb *R/cohesive.blocks.R
+c5949abb5bfb45cf41a5d3b08ae0c24f *R/community.R
+fddb54f1475069dfd9a3643d35d26563 *R/components.R
+047be7bba9e76d408aaa49e2daf7f96d *R/console.R
+1ced970a1345835a5c2a9cdab7a8ca30 *R/conversion.R
f60154d5c769713e6694ab0c8b287a43 *R/data_frame.R
-46360b04298b2abf673c195277e554f4 *R/decomposition.R
+0ec847f8d499985036fc2c3e28a4dfee *R/decomposition.R
d20ec0854628e7d0173998343b9d9271 *R/degseq.R
4206d088dc2e5cad5568d5b0b19cb103 *R/demo.R
-1c0051d5d333d64c534f7a90faf209c9 *R/embedding.R
-2aedcb15df7d1d6f577bde625eae9fd3 *R/epi.R
-7270bb6cdce7f4a9438949e21a3874d1 *R/fit.R
-7b50f4ec4636d2d5057e0d6e45cacb7a *R/flow.R
-0f6515a1a6c8d79b90b86078b64a216f *R/foreign.R
-e7e7ff124f1f515371c9fb791749d933 *R/games.R
-e243b3f2cb3334a5cf2bb51103b66226 *R/glet.R
-fd6c3972a93a933d35144ff7b1b8b8fa *R/hrg.R
-6ac57bf5bf50c5affb5d2aed29f93d40 *R/igraph-package.R
-43d173fd8b57715003d60790c7c2c560 *R/incidence.R
-b1715dfef456137328a00ff9b770545d *R/indexing.R
-b3a77c85e9f5cad37d6c9a0d8899b0e8 *R/interface.R
-019d1060cdccc33575ed954bdbae388f *R/iterators.R
-1045c427da4eb100b63b72eb9f734b92 *R/layout.R
-5ff011b96c1871c3d2736fef68a772b8 *R/layout_drl.R
-f011488c4fade0c2e917568dfbd3dbbf *R/lazyeval.R
-6228a94a52c828fe939bafba779a2987 *R/make.R
-4b1b30ee58dbfbbcf3e0b99d72d385ba *R/mgclust.R
-bfe6df5c0c275a6998e26c3e07b7f794 *R/minimum.spanning.tree.R
-a72970cff239d026a39a8d970e96adac *R/motifs.R
-a294ea37054111ecd15408227ae68615 *R/nexus.R
-681e9b187ce729c6f8bd9434d9977fa1 *R/operators.R
-33503344e3c5008937834887aee6848f *R/other.R
-0f8808bb3fd91c593d6ab9220e06bcc5 *R/package.R
-f965e97b2bf1fdfbab7c5c60ee180cee *R/palette.R
-266a2e11ff674a80dce3b5e0668425a2 *R/par.R
-ef9eb5604ee9485c5e1f95b1e6ebb42c *R/paths.R
-6a0c88a56b8b284a1862064aba1b66ef *R/plot.R
-7c6cdfaa48271ee61543e21d82561521 *R/plot.common.R
-2219bdd7cf551776413f8e8f775110a3 *R/plot.shapes.R
-173dc6c730cf0702ad1fe1dd8a5a9692 *R/pp.R
-480aa14d1bddc436db66b7763dbb9b57 *R/print.R
-aebe5923d9e5ed95bad7edb63f51d411 *R/printr.R
-746a4da766b543cea185baf5375a2cd6 *R/random_walk.R
-7ecfdd3a6d588af525da6a4a8e27554b *R/rewire.R
-774a74900a27b0b69fe2618f14a2a08e *R/scan.R
-d31407a7b29796b72a7a3c2a6eafc313 *R/scg.R
-d2d42ed1f409f616a8fa9dcda5ec12d4 *R/sgm.R
+9fedff2192567dcaf3febbf3ccef7a56 *R/embedding.R
+6908f573f975b61439cf453d9e388bc9 *R/epi.R
+7b52a5f78251b7531e5b6ce2f82c77d7 *R/fit.R
+8241496e720b3b60aa8cecdfdd7280cf *R/flow.R
+e719228397bda3cb1d6a842add278171 *R/foreign.R
+73f04d5ea81b4ce3b8c25ec0bbe60f64 *R/games.R
+e19b328c2621fe0db27bc9622a1003b1 *R/glet.R
+f088a71216577c92399af1b7244b4370 *R/hrg.R
+15a62d62546d46acda84a5eeddb19f42 *R/igraph-package.R
+cdbea7bbcda2d444b162ed7a57238b08 *R/incidence.R
+ca2b9fd8d97dcc7d95988c33170e4777 *R/indexing.R
+94def4d6fa4c5dcde059b083f8a18fe2 *R/interface.R
+a104f676ca0d4bc046ddea159cd1bffe *R/iterators.R
+9b65f227ebf8c4a8cf42fa9861db62ab *R/layout.R
+a37fa01f6f25d76f29ee0301e76a07b1 *R/layout_drl.R
+95366f1e91f837bd730f943ee8c005b8 *R/lazyeval.R
+b510be15bc611d9b6b0e6c4aeedc9058 *R/make.R
+79a0ea606a187685e19151f5c9c7797a *R/mgclust.R
+90f64fe163faa43dbb168d3f40166e34 *R/minimum.spanning.tree.R
+fc601ca07614dca0e233bdf88ceaf2cf *R/motifs.R
+84ef1e7a44ed47d88e22112215a00e34 *R/nexus.R
+231c83447ab19e88f3d8f27d5c53ddee *R/operators.R
+c55a3913b222e44136d8cffd0a6c889e *R/other.R
+a782d198b54b5384eb109acf7997f606 *R/package.R
+bf1b9f23e4f3c6925b40d700c1e43ddc *R/palette.R
+55a365385f8989892cb1c0ef4d9c337b *R/par.R
+4ed201432c7c922ea37b6cf822b9f75e *R/paths.R
+c67e4ccf3086f8b9eaf1530693a1287f *R/plot.R
+76fd2a4de3dfbc84122003afeac34ee1 *R/plot.common.R
+4c363225538967c067b8cf060c6b7622 *R/plot.shapes.R
+013081ac5ad5942c8ddbca625b67b58b *R/pp.R
+d4c54e85a59ed9955cb39e3bc0fd0c9f *R/print.R
+72537ec66e0406ccaf61069f220f06fd *R/printr.R
+b4ef25e0fbb795e3ea6f6f4f28be7e37 *R/random_walk.R
+42c4f7aa4e3f5d4656ac228e1e001fe5 *R/rewire.R
+597c06b2317dffbc41b020c8d3f832c0 *R/scan.R
+59ab90bee689894f07c627f312b4767d *R/scg.R
+2a0fd5d6d4e07002c39c1ed497687666 *R/sgm.R
ba463b11d0c2f3b7cf1781cdeb34d5a3 *R/similarity.R
296a4b11587d8311ab9ed05836b72f01 *R/simple.R
db7f41f5186a1dd4561c2464b2acdc07 *R/sir.R
-43a3a2dccadcb247801102866e33dbc2 *R/socnet.R
+a3032214cb7736e816efac0648691339 *R/socnet.R
1ba5d03fdff8d5e714320cc47f332d1d *R/sparsedf.R
-24e25af5a04efb4d7d82176e6bbf009c *R/structural.properties.R
-d4a76d483bb8afa8716c1ce5340c8cd2 *R/structure.info.R
-441eea32a286eefc85a22e432c3d11b4 *R/test.R
-fe4ab338c2ee6498660eeef229a60106 *R/tkplot.R
-738c84e875b277b2d82da30f5cd710ef *R/topology.R
-d1834d2fffb6a383c6f2ce7b216df3f6 *R/triangles.R
-09c6021900b34101393a17aaf640e920 *R/utils.R
-7cad85ba458be835fa73e70f548b2ee7 *R/uuid.R
-41bcc0ef061e37371ae6203464fb0687 *R/versions.R
-a6102f385771f3b6023b5f83ec872c0d *R/weakref.R
-0ecc144bf3508ed2d4c65e2dbc81c4a2 *R/zzz-deprecate.R
-6e989e75e989389ee4c508d0e37d0d51 *configure
-02637ad0af99df6d0c92b8aa5d2fc8fc *configure.ac
+4e66501d0988d385a44273f5e9f4ee1f *R/structural.properties.R
+49277a7f60c0d5d93330d3145c3c00b1 *R/structure.info.R
+e85ebcf2d2bf8f3590517969b1a4cec3 *R/test.R
+771e19abb91c7d7bbb3c5455062426c7 *R/tkplot.R
+c6ff94955e31c10166da5704574ee664 *R/topology.R
+49d841011964ec28930e7e2b861cbf3f *R/triangles.R
+4c372b082cbb95708a85f575fe3bb8d1 *R/utils.R
+053db0cd8d886ca5929575dc179f05e0 *R/uuid.R
+dedeede120a8f6b67ac214934ec34b3d *R/versions.R
+986ffd9c0f8b6ff1c1144a6710954914 *R/weakref.R
+82be9ebc0900c63b2ffff118e8e81f9f *R/zzz-deprecate.R
+9bd722faa4b8037fae8de0c2c7098217 *configure
+71315f15b94202f5d743cba6058eb8e2 *configure.ac
d41d8cd98f00b204e9800998ecf8427e *configure.win
f6d91efbe9a92d9da367b19ae2b77d48 *demo/00Index
594342a01208503fbaac63fa9b1f24fa *demo/centrality.R
@@ -86,11 +86,11 @@ faf3ffd01e590fd13b34efb775f173eb *demo/hrg.R
771ca356197ee2b54c40ceccb4c2419c *demo/smallworld.R
63f74b06a17d02a00dac03fb54a07b54 *inst/AUTHORS
5cc5f3e2c4239fe9a47bfefdbb923dd0 *inst/CITATION
-b1f7ddce29fbf876cc9b6ef5120df8c2 *inst/NEWS.md
-cf9b9fcdfbc6a08f71bbdcd384312e1b *inst/README.md
+f122c2727feffcec4c3c3e3d923304f0 *inst/NEWS.md
+27e30ac7130f81f5207760f3ef59161c *inst/README.md
9318bc2aeb60f4f79eac2357da0d9b84 *inst/benchmarks/correlated.R
4f938e92ca259e3259a5223e87e51bb0 *inst/benchmarks/local.scan.R
-be1c160f903340c69231c009998d9c11 *inst/benchmarks/time_call.R
+e089bba153ae6dd3f7bafb2f62dbded0 *inst/benchmarks/time_call.R
5ad213883678196238e964be02ae0585 *inst/benchmarks/time_dirSelect.R
edff9359ac1cb8957676283032452e3c *inst/benchmarks/time_fr_layout.R
ebf0471b513b73423273265c2fe2a663 *inst/benchmarks/time_kk_layout.R
@@ -102,510 +102,362 @@ eae286de8f64912cf4b2ac317bc5e67b *inst/benchmarks/time_sgm.R
4fb9f93f54eeef966f8259609247a787 *inst/igraph.gif
c07ee84ac019e590ef906200e5183ea2 *inst/igraph2.gif
87bc6231efc284995f9d609715ea4d2f *inst/my_html_library.tcl
-3a5ec4e3cc8d87587b31237c5541f86e *inst/tests/celegansneural.gml.gz
-28cd0567bf26075c39c14d11c4c829aa *inst/tests/dyad.census.R
-34d03342fd57be47bdcf3079baea1efa *inst/tests/football.gml.gz
-157659d4b0f46abf1b2893b2e52a9fc1 *inst/tests/power.gml.gz
-d44acbb3efd8c507e3dbb2004a4dc52f *inst/tests/test-constructor-modifiers.R
-e6b10c3c036376304dd0a6866a8f3926 *inst/tests/test-index-es.R
-4788e269746f1dab1c81dd3c451e25ba *inst/tests/test-isomorphism.R
-72eaaa03dc1634f01b6627dc4b579331 *inst/tests/test-make.R
-69b30e1a71abb8ba4183e53802995c5a *inst/tests/test-make_graph.R
-22c63ccc32ad7bcc1ca5858e1f7682f1 *inst/tests/test-new-layout-api.R
-3c946c65dbee1987ac5fd0991ab4cbdd *inst/tests/test-notable.R
-7687fdcb891047a342172e1feab863b5 *inst/tests/test-old-data-type.R
-f4383004c3666fcdda76b140c9be5f91 *inst/tests/test-random_walk.R
-9611d2c9cb947b58c40443fe2368bbc3 *inst/tests/test-version.R
-ec4d2c7247fdbb3cb6e5f8299d51925d *inst/tests/test-versions.R
-fee32de1be74da0b925a367eeef58ece *inst/tests/test-vs-es-printing.R
-89c1da084e2516de1600992f2c91adbc *inst/tests/test-vs-es-quirks.R
-ad17a2d0bfa04974980731e8824e66e8 *inst/tests/test-vs-es.R
-a7de50a9ec007b0ec6bd4ba043b8ce0c *inst/tests/test-vs-indexing-lapply.R
-b0783b265ed1ce213fc45bfc8ef0abf6 *inst/tests/test-vs-operators.R
-4c1ba73219c8dfd973fc878c0e2ed3b7 *inst/tests/test-weakref.R
-85ec5222dcf11a56e1c119cefcd8c9d1 *inst/tests/test_add.edges.R
-9d640d7ac3411dad252fa61e191968fd *inst/tests/test_add.vertices.R
-13cae003d2c04d379736320d7dac41f9 *inst/tests/test_adjacency.spectral.embedding.R
-b93a3944e3c6b752dac2e225ce10d2ea *inst/tests/test_all.st.cuts.R
-542a9710d4d20713093a35d9b5000c7a *inst/tests/test_alpha.centrality.R
-505493c56ee9fd269286cf68a3701fd7 *inst/tests/test_are.connected.R
-1186c6125dd7536cc593a14912cacb2a *inst/tests/test_arpack.R
-e282694af0f688cb034709e529f70ea2 *inst/tests/test_articulation.points.R
-8979b7079adec68a4eebc1fdcfec25b8 *inst/tests/test_as.directed.R
-e48a4e35ddf3d28d072f439de1eb0499 *inst/tests/test_as.undirected.R
-3d24bf6e4a3f12e23306a6075f786b84 *inst/tests/test_assortativity.R
-795eb9d342b6953248fd9578ad6f4868 *inst/tests/test_attributes.R
-8b60ef73553267334628adff510abcb0 *inst/tests/test_authority.score.R
-3809cd4a3febab2fe0a453bc8cabc030 *inst/tests/test_average.path.length.R
-6b49e3650ff1719aa1f44db76b47ba4d *inst/tests/test_ba.game.R
-0a5a3daca2a7c84fcebfbe44f771f794 *inst/tests/test_betweenness.R
-4f381a3bdebfbf215316ec09037f3c02 *inst/tests/test_biconnected.components.R
-5082b11e39d7b485770e6400656841e7 *inst/tests/test_bipartite.projection.R
-0137a8f814a670f45fb8678a74a0ac30 *inst/tests/test_bipartite.random.game.R
-8582a01c00fe03d6cc8336be5ea1555d *inst/tests/test_bonpow.R
-3a8a8485e09a9be56b8aa61943d1b2cf *inst/tests/test_bug-1019624.R
-a0f71df068480720e927de8b86f061d9 *inst/tests/test_bug-1032819.R
-6de97cc0e6c5f0eccb17bcebed244070 *inst/tests/test_bug-1033045.R
-254a3cf2d08007ad5803d244a99abdfb *inst/tests/test_bug-1073705-indexing.R
-8eb54ffc45a7662db609689ab1da7ee2 *inst/tests/test_bug-1073800-clique.R
-cda7097f73b9ef8be8bfe6662d3399d6 *inst/tests/test_callbacks.R
-2c96af4031e6a3b8b018a8ce8735eb07 *inst/tests/test_canonical.permutation.R
-f254ac34fc9203ce26ad62ed19d30976 *inst/tests/test_cliques.R
-ac1d66133bea5969e51bd75e13c354d8 *inst/tests/test_closeness.R
-c45762e40c0ee3cb70d305d06db47f0d *inst/tests/test_clusters.R
-8d2c03d0914792d2f1679d3909be2a18 *inst/tests/test_communities.R
-4a2a8e80da2d290077446c5cccca7998 *inst/tests/test_constraint.R
-2786c19359b36de1d6c2d90c305fde9e *inst/tests/test_contract.vertices.R
-a4762ac8213e2d36626defccac985e1a *inst/tests/test_correlated.R
-df25b65676954132724105f0c45d76fc *inst/tests/test_count.multiple.R
-401b5276d52c308093b1d9ebf252ec66 *inst/tests/test_decompose.graph.R
-3bce5671201a06ebd58d90ad350a01a8 *inst/tests/test_degree.R
-5512dce75135fa587c083313a70c6b19 *inst/tests/test_degree.sequence.game.R
-8ceeede3d4b00fd625b2f111a1ce60af *inst/tests/test_delete.edges.R
-a2667985a9407d55df61cd8b56c58b5d *inst/tests/test_delete.vertices.R
-6fef9d7dba6ac8269458d0d5764e0052 *inst/tests/test_diameter.R
-c5526915b4f853835809c7fb5898822f *inst/tests/test_dimSelect.R
-94f8ad23a61bb3dc9d46ff310b712611 *inst/tests/test_dominator.tree.R
-541d7ff02723427f2026be1a0eb7a737 *inst/tests/test_dot.product.game.R
-5d9a8a58619b8bb5c7645e2a4dbbc309 *inst/tests/test_dyad.census.R
-372dee80f0212ec9fb38200aa25b6d1d *inst/tests/test_edge.betweenness.R
-82fe00c577b8f8ec3430f7848f2c2fd8 *inst/tests/test_edge.betweenness.community.R
-078a1606ee3392ef9d8408b2b146ab60 *inst/tests/test_edge.connectivity.R
-fecffc869c851602342b441a3a418b77 *inst/tests/test_edgenames.R
-4781c4417c2f526009605d601b832ba6 *inst/tests/test_evcent.R
-85edbfa6a1db6972776e62292a19dc8b *inst/tests/test_fartherst.nodes.R
-80cf1f5676bd09a700e490ed4b439cfb *inst/tests/test_fastgreedy.community.R
-542aafbf6ff22a659f339ea8ffff8276 *inst/tests/test_forestfire.R
-36eccc1dd3d999a3941e7d034d1e6d17 *inst/tests/test_get.adjacency.R
-70b7391ff74607bee1c8936f578c335d *inst/tests/test_get.adjlist.R
-51873b120dd3fd8fba64430e3a5daec8 *inst/tests/test_get.all.shortest.paths.R
-849cff0f46c9170797641ba66cba5595 *inst/tests/test_get.diameter.R
-c4ba0a587f9530519bf13ea2acb58843 *inst/tests/test_get.edge.R
-f9249efa32145fc1c8c12a36f945cbdf *inst/tests/test_get.edgelist.R
-ded360a0009f7c4f67dc2b0352a0fb8a *inst/tests/test_get.incidence.R
-713863c8a73e169cd24293f85d08fc74 *inst/tests/test_get.shortest.paths.R
-03b481f55a65183b3b0e8ad203897960 *inst/tests/test_girth.R
-f2214f9cf209e9878e4da3c57232f17f *inst/tests/test_graph.adhesion.R
-6616d546c5d1fc6e253cde6c4fdee6db *inst/tests/test_graph.adjacency.R
-f7f7d009ae1a05610d9410b8bcc9d3a5 *inst/tests/test_graph.adjlist.R
-9ba1d7ad6342b0bef83bf1aaa52aae50 *inst/tests/test_graph.atlas.R
-849ce84a24fb61e09ed729bba98d4d7f *inst/tests/test_graph.bfs.R
-499b455adea86ee71817783a4a65f577 *inst/tests/test_graph.bipartite.R
-879c434fba2bfd905c539be92ebe91fa *inst/tests/test_graph.complementer.R
-c13bf09188f949377f0eac6d68a84042 *inst/tests/test_graph.compose.R
-2aa42f162d1bcb6b9582281130432efb *inst/tests/test_graph.coreness.R
-5f4e9c1eb0d4699236654074358b5115 *inst/tests/test_graph.data.frame.R
-68161b1dacafdfeef13eccd9efd7ae5f *inst/tests/test_graph.de.bruijn.R
-8723a905ccf9bd8987926a579d0442a5 *inst/tests/test_graph.density.R
-de6d23c1d3d6e7b16d3159f56185e434 *inst/tests/test_graph.edgelist.R
-df43bbc9223f5d6496e5715f1881abd6 *inst/tests/test_graph.eigen.R
-f894160c868e9392d2727cf9a6dc5af6 *inst/tests/test_graph.formula.R
-e2efb24c4db5b274ac18017ed480d2d9 *inst/tests/test_graph.isoclass.R
-6f3d4507996dbcc43920adce657a738f *inst/tests/test_graph.kautz.R
-0a80082ebc39ec4cdca090a3e1c11c67 *inst/tests/test_graph.knn.R
-9d869da1cc161a645c293d10dc341590 *inst/tests/test_graph.maxflow.R
-1159c879ec2285bbaa08209a1d2c5add *inst/tests/test_graph.mincut.R
-530fba9e8d790c38aca699b1a568de00 *inst/tests/test_graph.subisomorphic.lad.R
-eb55c1cd65d26a7530d9460ec396dfb2 *inst/tests/test_graph.subisomorphic.vf2.R
-ae031d23ec08cade48a2d03721dac0c7 *inst/tests/test_graphNEL.R
-65da974174ee936968ff534d50d35b93 *inst/tests/test_graphlets.R
-3e58a33bfda76293340465d7aac08c86 *inst/tests/test_hrg.R
-a570ca5f125efa4d98d030585f2004d2 *inst/tests/test_hsbm.R
-5448ef099cc050671cda697846fe042c *inst/tests/test_igraph.options.R
-026f3752506a2ec286066504e9d37a85 *inst/tests/test_independent.vertex.sets.R
-e466a39d382b5505b953292b62c50366 *inst/tests/test_indexing.R
-ff070d086e04573751eb22de047f4b7c *inst/tests/test_indexing2.R
-c78a920d52351d67639476e2aac25a8d *inst/tests/test_indexing3.R
-7748209eb0003b8d2c5d4ee90606878e *inst/tests/test_is.bipartite.R
-d501b567e3e573c4d999ac1ace4bb665 *inst/tests/test_is.chordal.R
-52138bea453eda91c667da3742007912 *inst/tests/test_iterators.R
-764d5cb76819f0a268562b2f6f59f82b *inst/tests/test_label.propagation.community.R
-c8c475e2e86016609574169e78c716ea *inst/tests/test_laplacian.spectral.embedding.R
-418d9fcc91a880b0fb839eb0fe002a41 *inst/tests/test_largest.cliques.R
-fce5463a31d7da19e21761e1d3bfbe9d *inst/tests/test_largest.independent.vertex.sets.R
-3f461a4ed6ed74da672f44761a2de349 *inst/tests/test_layout.fr.R
-f3caf46d387b7fecd5e28826fd753c7d *inst/tests/test_layout.gem.R
-bfeeecbfd9aeea87ba0c0b2cae9f627c *inst/tests/test_layout.kk.R
-6a2aed874635751a944a0f28f08f2c9a *inst/tests/test_layout.mds.R
-7e921347ce3b1b198f167e574067d1db *inst/tests/test_layout.merge.R
-dea0f7483ea375c42c7a00e6217a09eb *inst/tests/test_leading.eigenvector.community.R
-b373b6fd97fabb47114c76e104fa86bb *inst/tests/test_maximal_cliques.R
-751e142d0005412034ca097b97c9a153 *inst/tests/test_minimal.st.separators.R
-e376dbc01376d61de29507390ea4a4a0 *inst/tests/test_minimum.size.separators.R
-27b029baf39ed4c32ba0d69d5f7ed5a0 *inst/tests/test_modularity_matrix.R
-76e7ce19e8352b279c775ebed2f69153 *inst/tests/test_motifs.R
-993e177c45db6a718a6784b34330c659 *inst/tests/test_multilevel.community.R
-46d54173d41a303f3390ca543721ccb5 *inst/tests/test_neighborhood.R
-9f34f2b64e709ee9d3d3069464f88c15 *inst/tests/test_neighbors.R
-24cbc821daf29547b37847071891286a *inst/tests/test_operators.R
-46c39f7c2bed29cc43dc7ce9cfefa10b *inst/tests/test_operators3.R
-b45cd48a81d66aec4e4c28a9bd9da016 *inst/tests/test_operators4.R
-de9a71750cfede9c47f11418dd2bd351 *inst/tests/test_optimal.community.R
-560990b6b9e50c3585297bbea2a8313b *inst/tests/test_pajek.R
-823610533e3068fd474e770d7decc725 *inst/tests/test_print.R
-aff3f8aee89ec2151834aef5a203125f *inst/tests/test_psumtree.R
-c16adef7ce46505194e165e819a6ee7f *inst/tests/test_sample.R
-071bf3fb054279e535ccb9936ecb1944 *inst/tests/test_sbm.game.R
-5996191f90b8e86be20a5840a2089aa1 *inst/tests/test_scan.R
-2c945b5acdbb1e4c85b3112a67be04f6 *inst/tests/test_scg.R
-9274bc5af61b2058a08fe4d377aedab0 *inst/tests/test_sdf.R
-307c4bdb58bd0229816f4363a5b12186 *inst/tests/test_sgm.R
-7078a546e96ccb8b0dab099b9b451487 *inst/tests/test_sir.R
-1f919061ff9d5f2c9f8c771b5b9ca873 *inst/tests/test_sphere.R
-3fa33f48dc6393aa2915845a2813339b *inst/tests/test_transitivity.R
-59b470781b4cbb8184b85b2f292cc9a0 *inst/tests/test_triangles.R
-7f8ca4c58a09baf998e26774fc6a6290 *inst/tests/test_unfold.tree.R
-2426bc82153054e1f00534d6c81e47b9 *inst/tests/test_walktrap.community.R
-d8d7a03abfc121b96fad591afb9fbca7 *inst/tests/test_watts.strogatz.game.R
2521dfd3cdd6457b8947f9bd78094b48 *inst/tkigraph_help/communities.html
b836ba1ad253b94013d430cf0ba3e7c2 *inst/tkigraph_help/index.html
11db5e3c8a97b9b22418aecf954b961a *inst/tkigraph_help/style.css
4cbf1010c7a8edb8b8576853eb8898d6 *inst/tkigraph_help/tkigraph-main.gif
-42c1278ae6f22de279f3ddc9ed26fe28 *man/E.Rd
-3f3ac164c20cdd057b07edfe481b4655 *man/V.Rd
-820f2d1b9be71a7060609c4fed5676fa *man/aaa-igraph-package.Rd
-16cadea42418126237df23b69083f7d0 *man/add_edges.Rd
-1f7a2c8b6ae4eca77770eaa2f5adcbe4 *man/add_layout_.Rd
-5ce3b4c2874535ac07cce4b033902ad9 *man/add_vertices.Rd
-1c77e11700e3c830d602d58974f0948f *man/adjacent_vertices.Rd
-ed8b296fbab3bb09d4f8e1693fa18dfd *man/all_simple_paths.Rd
-3f115e30d70b57a85dd0bb86ee858e6f *man/alpha_centrality.Rd
-593e85eda7a2355a70bd13d3a9280260 *man/are_adjacent.Rd
-c35a0ae551bc338162ed2365a1c44c32 *man/arpack.Rd
-6674c22d07aa391dedf759f6230c40a5 *man/articulation_points.Rd
-72e51eca9b31ed0802757b2ba90b43d8 *man/as.directed.Rd
-ce1904d04c4dea1fe6ca733be2f11c4b *man/as.igraph.Rd
-f50b14b832c15b59a92d0332bcc89ccf *man/as_adj_list.Rd
-c806cd2c9c54293c378cf3c60bad100b *man/as_adjacency_matrix.Rd
-adadf7f7c32cd962cd782caf6a9d6cf3 *man/as_edgelist.Rd
-553979df54450f9fdeb74992f16e1d7f *man/as_graphnel.Rd
-be123be50bf38ec0b4b8ed1b30ff0ca2 *man/as_ids.Rd
-b47be078d27a0ecc33094bb13fcdb77d *man/as_incidence_matrix.Rd
-b1cb9a66612beaee4a34d607d8ff278b *man/as_long_data_frame.Rd
-ccd0d0339e4b242c1442ca31d7b92e30 *man/as_membership.Rd
-e5510800ad5bbca2061a8c1496d49b1b *man/assortativity.Rd
-94896983d098792b003cf4a7b28fd262 *man/authority_score.Rd
-d5dc0579c91dac3bcdd0a6a4644cd141 *man/automorphisms.Rd
-8ee4fb751ff6d43c2180160321a5b40d *man/betweenness.Rd
-7eb787039b97a218dfe970e011d7c79d *man/bfs.Rd
-11e3fc1351df6dfa17486eadb8ddc292 *man/biconnected_components.Rd
-a6bfcf76e2146eccf273aab86500c5ee *man/bipartite_mapping.Rd
-1a068022bde7e4d489a528d86d0d723d *man/bipartite_projection.Rd
-e5faacfc659013aa966dd01b252338a2 *man/c.igraph.es.Rd
-1a84493af7864d878ba3dcdbd7cd6bcc *man/c.igraph.vs.Rd
-dfaf157b403f341ee0f7fff041c9fa3d *man/canonical_permutation.Rd
-618c5eca9051b733581259943ba4b896 *man/categorical_pal.Rd
-581113912e2e3f6d41cc30323f1d3c21 *man/centr_betw.Rd
-a030cd80299a5e65507dcf99f5a2ec4c *man/centr_betw_tmax.Rd
-7bed7a172c2ea0da3d80dc86ea211584 *man/centr_clo.Rd
-ce2fac46632fa55176d18c5a3de1a8e7 *man/centr_clo_tmax.Rd
-87ea150584120535700e8c891bc7ab6e *man/centr_degree.Rd
-68a931c8ed757c098465abafeae723de *man/centr_degree_tmax.Rd
-c05a22aebdbd1fe1913280dc8cf921a3 *man/centr_eigen.Rd
-521a6a801c97a8348c43e7af5c117dd6 *man/centr_eigen_tmax.Rd
-40fbbc993bfa698a22c4b0b88d4605f8 *man/centralize.Rd
-720d7dfb2654ecb33d227c0bf87d0dff *man/cliques.Rd
-f20851702be457b76933b0473ad2014e *man/closeness.Rd
-853ea7bcc0d09991bd222dc649f29a97 *man/cluster_edge_betweenness.Rd
-f2e1654f3bf33206891b23bac01d87a6 *man/cluster_fast_greedy.Rd
-7d3a1c1d34ffd76051d4120c98c3572e *man/cluster_infomap.Rd
-450ce83fc207203efc551d704a219cac *man/cluster_label_prop.Rd
-a92d4850db4c32e8527a93ded86fcf11 *man/cluster_leading_eigen.Rd
-1b1c7382bc342cac0c7b6a0264479222 *man/cluster_louvain.Rd
-32631022f52b45b5877e11fce7615621 *man/cluster_optimal.Rd
-7be2c4600e453c1b1d2c196dca9e20cb *man/cluster_spinglass.Rd
-85835158e45b3cb08e3862febabd351c *man/cluster_walktrap.Rd
-31f676c711d9807d0153e790c574cd89 *man/cocitation.Rd
-0aa629efee730064061f2ef0c7e3cb3d *man/cohesive_blocks.Rd
-28170705450784257bff8a0a8338caa1 *man/communities.Rd
-694aab9fa9475d4f3de2f9ccb39666ab *man/compare.Rd
-39457167b31ab972e173cf9c4ed448e4 *man/complementer.Rd
-eb9237e69899642b8aa6b1df2347ca44 *man/component_wise.Rd
-dafb78dbeb15cda02db23570186f4681 *man/components.Rd
-07d446402fa23a221f2a1d747175acd7 *man/compose.Rd
-29f939daa99e37681803250021bbfefc *man/consensus_tree.Rd
-81d65bf9d19be8973ea34dbbac7bd48e *man/console.Rd
-9edf36b2d7ad2e59fae80c92d3e65368 *man/constraint.Rd
-8975e669758a2fbbe6af5c9ed2597b7a *man/contract.Rd
-32c5b3b636e949bdc7500edf2ac08ad0 *man/convex_hull.Rd
-e685b2e07e639f23583ffc29053a9ccd *man/coreness.Rd
-ad7ae4c446fd85e7a4fe2c1a9a109033 *man/count_isomorphisms.Rd
-e97bda4f31ca00ec8baa0d2bfe29b15a *man/count_motifs.Rd
-0bcee3f3c8bf4dc244763d4a3444eaf6 *man/count_subgraph_isomorphisms.Rd
-5b8dfc677d8881bc998f95d7767ab686 *man/count_triangles.Rd
-9e53a4cfce7b1cb32b35f46bf14f4675 *man/curve_multiple.Rd
-77b4c935af70b2317fc364532a5b590c *man/decompose.Rd
-d130e862deb252b1da4febfd6e95c123 *man/degree.Rd
-2ed62693c6a16d84fada9fc20fd889be *man/delete_edge_attr.Rd
-7680628420f914eee2c97a4be6058a13 *man/delete_edges.Rd
-14b1696fdc471c3c5bb693b102271aaa *man/delete_graph_attr.Rd
-f894633052e956e40bf6a958d3c8f2e2 *man/delete_vertex_attr.Rd
-c3e5b2a63f48feb3ede390b61fc6c8aa *man/delete_vertices.Rd
-639babe2082d25cfa7826243295e9b62 *man/dfs.Rd
-19f8468e2239f50570ab4ba031ff74e4 *man/diameter.Rd
-647fb341144f2510dc854c33a2548502 *man/difference.Rd
-0dbc896fad5e6dbbb8e4351ca4eeeecb *man/difference.igraph.Rd
-b5c15780d2a52e92c3f51a67d33a488f *man/difference.igraph.es.Rd
-c130e348b16235400a7686cb64e6bc3a *man/difference.igraph.vs.Rd
-0b8c38e7dc7b03a6cb650a4eba0c15c0 *man/dim_select.Rd
-87213fb94ed3f4677ff653b879d9a529 *man/disjoint_union.Rd
-adc4fe47551956348269bf88cd3cddf5 *man/distances.Rd
-347159fec595675b3defc2f9a341c091 *man/diverging_pal.Rd
-dbcc4cc78b8be60c6af754234225adba *man/diversity.Rd
-012fd6d56cf19d9d7a5173b82aad3407 *man/dominator_tree.Rd
-4f7cbb04e3894a4debe1827cb383916a *man/dyad_census.Rd
-3d1e4cf9bb2a1ee538555f126a25ad36 *man/each_edge.Rd
-08825c5e095e796765c52865ebbdcd64 *man/eccentricity.Rd
-b63be8edd87ffb5945f407fdc0488c87 *man/edge.Rd
-674e1311beca10e0bc989016cf00c955 *man/edge_attr-set.Rd
-7dc0f500697f55abf00ef45b479a4ece *man/edge_attr.Rd
-15c0ba433decb07d4ab33992ce75810b *man/edge_attr_names.Rd
-607c683e8e7814f82cc6db63c58d2beb *man/edge_connectivity.Rd
-bb562ba01abd97d07b231fe2e88bc7e1 *man/edge_density.Rd
-bd6e630a76ee6e65756059a9640540f6 *man/ego.Rd
-d63adaba5e10e2c5c87e415234eae4b6 *man/eigen_centrality.Rd
-59b771162e183b433f8e9b003d09de31 *man/embed_adjacency_matrix.Rd
-d616eef787d4c0e7f6f6d5d0853e6fa7 *man/embed_laplacian_matrix.Rd
-d87115d0d20a0642ec5f967736324fca *man/ends.Rd
-fa0900f5a1e35fb9e3041b44c7423c3a *man/erdos.renyi.game.Rd
-8658562750b9627a0f0a632a49034205 *man/fit_hrg.Rd
-56a434f03c82e835dd31f87292f5a71d *man/fit_power_law.Rd
+b2a55d49fcc6ebc528a6f9395c50f261 *man/E.Rd
+ee3ff791491751bdb63c9df6218bbeaf *man/V.Rd
+6af61ac445af6756b1bc6132dcf7296d *man/aaa-igraph-package.Rd
+7bcba12e059d71638f1b808272bec87c *man/add_edges.Rd
+005c9655f7cb20a04732705d79a3c545 *man/add_layout_.Rd
+6342d3fb4225552287124b32890bf6c5 *man/add_vertices.Rd
+03cea0e5e9c94188ca7ca6dff93f8ee4 *man/adjacent_vertices.Rd
+775fe78e24a55d9a12a50cf0ede46fa3 *man/all_simple_paths.Rd
+50c77638a121cb85ea019a53c747fef9 *man/alpha_centrality.Rd
+93276b1940fcb34282af450bd1dc945c *man/are_adjacent.Rd
+973de1a608c13c919093657e7a26af69 *man/arpack.Rd
+5170bf452d4f03a35cd19e2dad51a0ad *man/articulation_points.Rd
+7150fecd06550d767b4a756d8a4e0d31 *man/as.directed.Rd
+4edd0d5ebe349816bdb3ad552f3d4625 *man/as.igraph.Rd
+d80d7cd3a20deba5218f74fae9b1f343 *man/as_adj_list.Rd
+12b8ef3d7ef484c5ff6f3ee8296cfc50 *man/as_adjacency_matrix.Rd
+b2630685da60c720488fe4adedcbf6df *man/as_edgelist.Rd
+b0e0174c94001e8b3d228f56299a0b70 *man/as_graphnel.Rd
+07c73a99ed8373f3d47bcb3428367bf9 *man/as_ids.Rd
+794bc47f2113374b92a0e069ee56c6da *man/as_incidence_matrix.Rd
+a7e8dcb9ee9a687693602dc251c6fcdb *man/as_long_data_frame.Rd
+af80a2f10fb2325144873031228602f6 *man/as_membership.Rd
+8c74542afe61527f02475f817b9d9f2f *man/assortativity.Rd
+34806ff532c38a8998a4e87a03d166ed *man/authority_score.Rd
+26cc0de7da666b382bdf8e881f5338e2 *man/automorphisms.Rd
+ca001bc5fe6724f01b465fed7a94d48f *man/betweenness.Rd
+57fe37d13e3ce887cd34e8123410acc1 *man/bfs.Rd
+fd8f543453db1ea10a85aac0e809bc82 *man/biconnected_components.Rd
+260b8e476f5318771591d0ece02c1fd0 *man/bipartite_mapping.Rd
+098ada8eab3798c172d0aa84b6b48cd8 *man/bipartite_projection.Rd
+6e0416ddc79c81fb2c55c6a5d2b6d23a *man/c.igraph.es.Rd
+a74af0ea02cd9a7aacc7ec062a2d9793 *man/c.igraph.vs.Rd
+7ae051da0688ce03f3bdc8347cc2f829 *man/canonical_permutation.Rd
+7f63e2f221eff120fd946dc9e6f8cb50 *man/categorical_pal.Rd
+ead25ca3420e6cfbc03eae3779cf2ebd *man/centr_betw.Rd
+d582e62536f97f4c233ac231733d7643 *man/centr_betw_tmax.Rd
+b89cc9147b5df0ce7aa6cac7ae527fef *man/centr_clo.Rd
+507af96cec0b1bab40b8c9fa2f5684d7 *man/centr_clo_tmax.Rd
+c0f8b560f38a476b47a156849f41ee43 *man/centr_degree.Rd
+3fc3f8453f9ee1fc84483668673164a4 *man/centr_degree_tmax.Rd
+43c1cfda35657e32db5bae005c7ebefd *man/centr_eigen.Rd
+7c49b03eff393c3141a54d6a1b9aab62 *man/centr_eigen_tmax.Rd
+4967d28aa07fe17d2c8d32287c76a631 *man/centralize.Rd
+c7f723a877338fb36ffa10c36c47724d *man/cliques.Rd
+6fc1a1098f415dd56a06ea9a89e7ec5c *man/closeness.Rd
+0970c948deda83b0cf339377457540c4 *man/cluster_edge_betweenness.Rd
+3e7224cbcaa7120dc32280d6c6456628 *man/cluster_fast_greedy.Rd
+06331358fa21f2422fc4ad53bfb31f52 *man/cluster_infomap.Rd
+e4c7c78cfd2dbdeb60c9979403798522 *man/cluster_label_prop.Rd
+338fddeb6fcaace67bebf33df821c32d *man/cluster_leading_eigen.Rd
+77fea04aaed7acfcce1a1ac0256cec26 *man/cluster_louvain.Rd
+33c941ee939bdf4e1b4df03847dc0746 *man/cluster_optimal.Rd
+1e522508ba1537268d1886ec7061861e *man/cluster_spinglass.Rd
+c9c30a30c7e9c628d71ec88b11341ef3 *man/cluster_walktrap.Rd
+c61a802eaec3e2767db69e88f9a79312 *man/cocitation.Rd
+58e7058504ca0d7830628fd3e324d15d *man/cohesive_blocks.Rd
+269d4d9ea5e0a43f26b47fe0f9a281c9 *man/communities.Rd
+1ed4f374ab70bf7eb9ad1326975b466f *man/compare.Rd
+e4fef82addf74c0357b57490d414cd1e *man/complementer.Rd
+b23046a8206e2138926923b383797224 *man/component_wise.Rd
+b07bc44662a7cc499484f45495dbc4c5 *man/components.Rd
+81b9eb46f1200483059dcb2fe5e29481 *man/compose.Rd
+e27c258062a5859edf8336b46d3337b5 *man/consensus_tree.Rd
+94129e9f948154a19ccd4eeaf1a80f6d *man/console.Rd
+603fd9022b00de72cec29a38789f7344 *man/constraint.Rd
+f23d7e6ff77dd0f833c9367b0237ee67 *man/contract.Rd
+7b578c13fb22e242e0d69b19bc9c6e19 *man/convex_hull.Rd
+dea3a87ace7dc4d3b69ad42e0e43c9cf *man/coreness.Rd
+58870ccd5dc72dbb14bffde67d0e2025 *man/count_isomorphisms.Rd
+92991409f78c725bcd2f6841541d0fb5 *man/count_motifs.Rd
+720ce924cd5214f41ac22d687e7d6356 *man/count_subgraph_isomorphisms.Rd
+e2c2e6883f13023956f55ecb85931225 *man/count_triangles.Rd
+fc701221f2a774802982cd096df1ff9d *man/curve_multiple.Rd
+454f7e2a59182a56871736f207106af2 *man/decompose.Rd
+9b3a8c9cd07a178c7e8e62c7c28eafc5 *man/degree.Rd
+2d32e60fac374fdba7e33dfee3f7b0aa *man/delete_edge_attr.Rd
+db1dfb05c3ed9f43cafd1f1f844da39f *man/delete_edges.Rd
+ec6271d1ac5b82c6207f533ec30e6cd7 *man/delete_graph_attr.Rd
+dc04bdbb3c95e06bd77c7bfbfcb8580e *man/delete_vertex_attr.Rd
+1e663c270c54978d9332d36b70205fad *man/delete_vertices.Rd
+9be721f748c66cdb4a0bb1c607f30f8b *man/dfs.Rd
+4dbe6daea6b6c8a4a740edbc8632ec01 *man/diameter.Rd
+77ecc13de99b70c7c4bc5b8bb2c24330 *man/difference.Rd
+63b6c01e2734c79503f96b701b12f18b *man/difference.igraph.Rd
+ce33e00f0609c6a76471de237257e02b *man/difference.igraph.es.Rd
+a9576dbdaba44bc9dda34cdfef88046d *man/difference.igraph.vs.Rd
+99d912bebd15ccfa2a511460eabcdcae *man/dim_select.Rd
+47d399b7ff71cc38366557f19fcc12b4 *man/disjoint_union.Rd
+c64506af38b9478c76eee6b0d0905a23 *man/distances.Rd
+77a7ff580f7f9fc538c2d502f1d5d5db *man/diverging_pal.Rd
+2dc8fd335ddeda98f3a6b2009dd395a9 *man/diversity.Rd
+1f6ea4d77c5b8264523f8c392bc792c7 *man/dominator_tree.Rd
+c85b670920070a8d18a0fff686053f45 *man/dyad_census.Rd
+36c8ebd4da9eecb7c3c63bb07d886ccf *man/each_edge.Rd
+8b671415648b10c9fec0e404e12a2257 *man/eccentricity.Rd
+ef251a69753a9b7063a6bca44cb715ed *man/edge.Rd
+c2c81f92cd0f4291161f73f1a6b7515f *man/edge_attr-set.Rd
+a6411875e8a5bc3d71beb63a498a72d8 *man/edge_attr.Rd
+9287d791f59c9d7ccd966d99f6dfa5bf *man/edge_attr_names.Rd
+7257668ed6406858b1642dff41e9fecb *man/edge_connectivity.Rd
+3b1308f67eb6c4c996aec515d6df0022 *man/edge_density.Rd
+f843cb4b5fb43bd746ba9876eb59b872 *man/ego.Rd
+d27efc8a7f1d6a8db5b1b8eff630db2e *man/eigen_centrality.Rd
+6992f1e3c46eb89cdb31e40cee9c1104 *man/embed_adjacency_matrix.Rd
+058111480b8b446184c45d840e4ac1f1 *man/embed_laplacian_matrix.Rd
+6e39a7c8c92f386b51414ed55bfb4f1b *man/ends.Rd
+4e27209153481d05089e7e126eb0382a *man/erdos.renyi.game.Rd
+6d0046d7525106b8227cfb81b19357cc *man/fit_hrg.Rd
+259275bd9858c7bed934192e64cc8ef7 *man/fit_power_law.Rd
74b968133daf808e2f5c631cc2654c22 *man/gclust.app.Rd
b4178b60ef1c7a22cddebb32f76a21c0 *man/gclust.rsvt.Rd
-8548a3561438dcf553a615a62294a9aa *man/get.edge.ids.Rd
+559b33660087dc23d4b6f5dfce99fad8 *man/get.edge.ids.Rd
dfb58aae066baf7dfae2f04674e5fb4b *man/getAICc.Rd
-0fbd30c6367ec7fbc10b9f3542f7c82e *man/girth.Rd
-d614b4ef4c9666b99087165b5f5419ef *man/gorder.Rd
-22af0feb4a59ccb57933f1748dde3ac1 *man/graph_.Rd
-d5b7e02fa71cca864f78d9858dddc0ac *man/graph_attr-set.Rd
-87e28cc96a013b72b9e20e12a00f7a3b *man/graph_attr.Rd
-fe0d99ff560eb2cd8f3c60b04649e965 *man/graph_attr_names.Rd
-0bd6eab2c2f2a29d77db42d09547e081 *man/graph_from_adj_list.Rd
-5fc78dbb1fa7a0dc9f635d30e08540ea *man/graph_from_adjacency_matrix.Rd
-f7a1dd6a5a341d4f9357a53b57add309 *man/graph_from_atlas.Rd
-06f3df86bad345b1c0b68442b4900f3e *man/graph_from_data_frame.Rd
-02c4641de052aa4d17ceb29485915bd9 *man/graph_from_edgelist.Rd
-be4047c1cf53cf45594b3dd94bad9e1d *man/graph_from_graphdb.Rd
-fd177c1244b8978a91a30530032e1271 *man/graph_from_graphnel.Rd
-a2cd741b195ce0ef54e62b52d90b694b *man/graph_from_incidence_matrix.Rd
-8d56abb3af392c4f71fe01e48edfff4a *man/graph_from_isomorphism_class.Rd
-de1b97cf645144302976c33e7993fef3 *man/graph_from_lcf.Rd
-d89a32a2f29beea3a77c648a3d323346 *man/graph_from_literal.Rd
-d9d5a401cab3a0c711170694e9e17d86 *man/graph_version.Rd
-a2323638f43d17d2542b59cb3303d991 *man/graphlet_basis.Rd
-2124a938a31648509028900f8fb17cf7 *man/groups.Rd
-3702ff90113cf5b7e9827c3e7545ce04 *man/gsize.Rd
-d7c3adc0ec9dbd8ea1c0f6a96bea225a *man/head_of.Rd
-91e55f6daa7a105dfc4d2b13504f4029 *man/hrg-methods.Rd
-47d7c68cc34318f9aa13a7746a010eae *man/hrg.Rd
-4c644dc8799db286764bb278a0811191 *man/hrg_tree.Rd
-6c40bbe78748414c56fcb2dd9e5fd8ed *man/hub_score.Rd
-d47552e7d68be057350306b8381b6919 *man/identical_graphs.Rd
-f5bfbeb9c8a3af8c136cd6aa72f108db *man/igraph-attribute-combination.Rd
-7f5da4ceaba7c96ef11d626f442c4ddf *man/igraph-dollar.Rd
-54acc64cc203f0661333e5257f7b51d1 *man/igraph-es-attributes.Rd
-5d2f8a7978b61bf8e1b1c6ba1cfdc011 *man/igraph-es-indexing.Rd
-afa8858090ee79dfba9aaa53ae21d108 *man/igraph-es-indexing2.Rd
-f12ff62050aba45a402fcb1e35be5227 *man/igraph-minus.Rd
-da7358d3713a59db241f1718a6d9527b *man/igraph-vs-attributes.Rd
-cf8c0956ec3ddda21ef76c137e1c3024 *man/igraph-vs-indexing.Rd
-eba1f7a15965cdae12ec5ac57a1efee0 *man/igraph-vs-indexing2.Rd
-9b8a6e97ae99b1ddc9a98a0b56553f5a *man/igraph_demo.Rd
-93517397d8b95a2681fb6191d392a90a *man/igraph_options.Rd
-e43a53dc076854140d1d0f7a48e3d4a6 *man/igraph_test.Rd
-a55b5466e0b979519b64835cd0a3c029 *man/igraph_version.Rd
-2d3f8486853c1ede38d26d28ec8c1a95 *man/incident.Rd
-03031f83b10a7a89d280fdcc62ca5c32 *man/incident_edges.Rd
-e83e036237832d65ab2cc4d65034a18b *man/intersection.Rd
-b001cba054b2743a131e4c8b77fabd4f *man/intersection.igraph.Rd
-4dc1bb8369c6ed43e51d55c347425027 *man/intersection.igraph.es.Rd
-83344ec591ef1ca339d84d08d5990e9b *man/intersection.igraph.vs.Rd
-4dfc8e3a5f3d777e55d47532f5875707 *man/is_chordal.Rd
-4f8875de0fcce429f3b371caefc892a8 *man/is_dag.Rd
-452cead424aa28544027144724321f60 *man/is_degseq.Rd
-a21b97cccaf40542c570be0c1288b465 *man/is_directed.Rd
-8e7ace8cbb9c9837b3ec758dbe097c37 *man/is_graphical.Rd
-05bcf0120965dbbfd561b29b58db76e8 *man/is_igraph.Rd
-b292b5608efb9384200b1d0f2f7c7fb4 *man/is_min_separator.Rd
-37cb14c551976936ca992a0a84fccb9c *man/is_named.Rd
-6a4a7f4d8e97368dac68a0f48c455a27 *man/is_separator.Rd
-e9ed66f532a25933daf45b1702b6cd3a *man/is_weighted.Rd
-71cb5f6ea28168c96188a77552ff546e *man/isomorphic.Rd
-ea956f4179bec462125cdb8ff4f2a717 *man/isomorphism_class.Rd
-fd50445a0f3ca0bad4d7ecc2164aec78 *man/isomorphisms.Rd
-b91f032838ce4df0ce874f9fd39828ff *man/ivs.Rd
-2b84fcff11e8d6b5f03f678ff45c3314 *man/keeping_degseq.Rd
-8925a2d061eb6df46e925a0721ad90ba *man/knn.Rd
-33aabf13f50e08ac82c99a41375b74b0 *man/laplacian_matrix.Rd
-9d6ae85fdc9ecbbe1bf27ca0dcab4250 *man/layout.deprecated.Rd
-52748dac68c0bf40a1e04550ee37f6d5 *man/layout.fruchterman.reingold.grid.Rd
-43268bf9eeac08ae46d09da4db6b57a3 *man/layout.spring.Rd
-2ea15460bf78ea00e48db1738055c0e5 *man/layout.svd.Rd
-fee83b0eb69d88faf916b2728d121cef *man/layout_.Rd
-9f8e2ddafc1cfdc24b693c123e8ce8ed *man/layout_as_bipartite.Rd
-54535e6409eba0bf2ab83d6f77e927b5 *man/layout_as_star.Rd
-593d4dae6aebd82bcf7d8396312ec7e2 *man/layout_as_tree.Rd
-e2cd455dc3b7dd627a595d5b96250e32 *man/layout_in_circle.Rd
-64ae8a405c850689756f180ee8982a51 *man/layout_nicely.Rd
-5bb6e898eea6bb5e407ee5867f5fdfb5 *man/layout_on_grid.Rd
-e592c443769d1a1a0297f1fc74345a0a *man/layout_on_sphere.Rd
-f65597ec9ae8da96bd50aff1c03df82e *man/layout_randomly.Rd
-9c704c34de38dcc7bedcc1084ba3f438 *man/layout_with_dh.Rd
-05220a521782937b617c1729b49a585e *man/layout_with_drl.Rd
-091f9c2f094b0e7aa160af0956549141 *man/layout_with_fr.Rd
-6393aa28d0a9de7f0d70e69c74b4a33a *man/layout_with_gem.Rd
-1e8c7441116449150dff1eb5c72d85c9 *man/layout_with_graphopt.Rd
-9741a391a852f6838e657079abdfb6cc *man/layout_with_kk.Rd
-2be543edb81ab164aa198f56f7b793c6 *man/layout_with_lgl.Rd
-2cb70129a7f35b5ef7a77ee5bfa8d8a1 *man/layout_with_mds.Rd
-feaa1135c7fc72bc1bda872584eded61 *man/layout_with_sugiyama.Rd
-578f44c6a20b7f2536d885e4c9a4e590 *man/local_scan.Rd
-20079a3b6002e90c4ca917df63a44b52 *man/make_.Rd
-16d14883b0678f2846dda3938fb68327 *man/make_bipartite_graph.Rd
-f0e5ea424809203ce113d256f9b9e20c *man/make_chordal_ring.Rd
-5db3d3730f04ae17efb279153118a9b9 *man/make_clusters.Rd
-39507e56a91cfba479508cae57ff1d8c *man/make_de_bruijn_graph.Rd
-d528bc8f5be5c1e8fbc68a954aac90dc *man/make_empty_graph.Rd
-6f81272db67b4fc23f66cf53797ebafb *man/make_full_bipartite_graph.Rd
-d0bc61da7952b2e4a76571c6d9954d2f *man/make_full_citation_graph.Rd
-3b62b8c1c5a054c923b44dd63478208d *man/make_full_graph.Rd
-164e0541cc25c3f613d9c0cd5cb15006 *man/make_graph.Rd
-936434f82ceb6e068d893c50a7a657f5 *man/make_kautz_graph.Rd
-13f0a8773a633b880924c1ded4a75cf7 *man/make_lattice.Rd
-f22a1d4cff51583e81679b1f7f27d627 *man/make_line_graph.Rd
-afeb6f173f1d7cab539e5aeb31468458 *man/make_ring.Rd
-e1b6288f1a7e3b28c075ced81b8fae61 *man/make_star.Rd
-3072bf647a5705f3f3891bc72eb228c8 *man/make_tree.Rd
-5e583097c858a8f02f81965fd0d95719 *man/match_vertices.Rd
-24e372c1b19ee62816b5d9e7096d4fd6 *man/matching.Rd
-d6ebfebc4087908306b2b94b08074d0d *man/max_cardinality.Rd
-9602c5aefcb2043d39b982f0340c3a6f *man/max_flow.Rd
-ef4273a5c4ae18aae0d99cfa9cfbb790 *man/merge_coords.Rd
-dc910ee178905057e1fd3706ef647270 *man/min_cut.Rd
-6c1dc0728374b210301f8405f51dc5a5 *man/min_separators.Rd
-60d1f362bf1bc9ae41e8ee10ca377c61 *man/min_st_separators.Rd
-1984779bdf14207798047ea855f411c6 *man/modularity.igraph.Rd
-c4fba7b6861ec7d12657fe44845046eb *man/motifs.Rd
-d5f5bd1708f65205548f714cce6a1812 *man/mst.Rd
-c77e5015482de8b1aec7423c08cbf6bd *man/neighbors.Rd
-f2cc5d52ed6be064971beaeef93ad647 *man/nexus.Rd
-1b748689d19e832426007937948faa80 *man/norm_coords.Rd
-9640a8fca94c9320bba0b34c799e149b *man/normalize.Rd
-5ecfd31475fbe1642438b5faba99c5a0 *man/page_rank.Rd
-be4d99ce100b571628564f13e16a47cc *man/path.Rd
-9480f29b2c3d7cb825d147a965a6574e *man/permute.Rd
-4c94ba42c4bd6661971d62cd020f9f12 *man/pipe.Rd
+76d3765c8ee6bc86138f51e556e572b7 *man/girth.Rd
+fd8af33cdd3c1b04fda79321548bf0a3 *man/gorder.Rd
+542b983f99f4bed35b29d4c7a34c15b5 *man/graph_.Rd
+610b94c11f838770c6f0f552805d693a *man/graph_attr-set.Rd
+bcd369a59f5f25e4db8a731e98b3d465 *man/graph_attr.Rd
+8a3e27d7faba0f0e1d01ddc94c02fe6c *man/graph_attr_names.Rd
+e68cca620253df2e5958cd5b8c81f32f *man/graph_from_adj_list.Rd
+3a53f96da5595f446c0a47603b27315b *man/graph_from_adjacency_matrix.Rd
+b9cab71ac8a1d25f9c0587d2ce2bf58d *man/graph_from_atlas.Rd
+d4d5866948eb380c502f92cd76dde124 *man/graph_from_data_frame.Rd
+b30e048182c1e4d332c9a86e14034d0d *man/graph_from_edgelist.Rd
+869ac7ca5450e44e71b94b1804293e20 *man/graph_from_graphdb.Rd
+88a6226915142e71ea7f8783ec2885b0 *man/graph_from_graphnel.Rd
+cb19cfe641da12189200c063d33f67a7 *man/graph_from_incidence_matrix.Rd
+a19b426acb909c7b944108f2237d5e9e *man/graph_from_isomorphism_class.Rd
+27424027699f97428365a76280a3dfe9 *man/graph_from_lcf.Rd
+4c137f53add76275c6e7acc3b7baa618 *man/graph_from_literal.Rd
+1383a2013dae1066755c8557d3ff4b82 *man/graph_id.Rd
+16ae85d5eb499c462fb828cba0f82a57 *man/graph_version.Rd
+38e009982d41dd557ed1e1665d997f83 *man/graphlet_basis.Rd
+52bc656657d35726cae1d1058fea79f5 *man/groups.Rd
+9d86786eee4eaadd13db6e7957f49c65 *man/gsize.Rd
+6679e71c730229b59e3a27359422146a *man/head_of.Rd
+52774b9fc73aab5df0139c260205fcdd *man/head_print.Rd
+d0a77f714bcdaa299ae67ce897de833c *man/hrg-methods.Rd
+4238c5dfb625b4181429b831f578ea6f *man/hrg.Rd
+dde4a84173f5e02c44403427ff740828 *man/hrg_tree.Rd
+027ae27aa7c98ac042975296fd6cad7d *man/hub_score.Rd
+ade97c3019d3e37c4745ab18d5318731 *man/identical_graphs.Rd
+cd4fd7d6dbd8d3b8bca793f50deae042 *man/igraph-attribute-combination.Rd
+ecf9477f4e65215a566f9a102f41b890 *man/igraph-dollar.Rd
+e2112c6fd6e0850e9b7a28691f319031 *man/igraph-es-attributes.Rd
+86dba1fe922fd6a5e5d8c56a379b1711 *man/igraph-es-indexing.Rd
+c45ba1d7f661547dfcb97a16294e1518 *man/igraph-es-indexing2.Rd
+9078fd73910ca0b53e3926394642d657 *man/igraph-minus.Rd
+b21fb3c5dd9c462ddd9588e13576ea75 *man/igraph-vs-attributes.Rd
+34cffb6ef9678b69fa0dcaa02d1ead79 *man/igraph-vs-indexing.Rd
+29e612a3df294ca3fb0c227695875e39 *man/igraph-vs-indexing2.Rd
+a3c2199327e088db50794ea9a1eb26fa *man/igraph_demo.Rd
+5d5f6c90d7b44dec10f6f5b456fde2e7 *man/igraph_options.Rd
+f34a914651b695dd86d6b04f1ef63e87 *man/igraph_test.Rd
+fff50a87d0cb4e8f9e12739d46536407 *man/igraph_version.Rd
+32caa344b0e6f0b72cf8911f9117802b *man/incident.Rd
+89bb9e657184c5618bcba79665eb3762 *man/incident_edges.Rd
+63abd479f22420c2809ea4de8ff934f4 *man/indent_print.Rd
+4d43970f72495ed573ed25801a9e2053 *man/intersection.Rd
+7c019a00e9a940b39699a7ebaaeb2918 *man/intersection.igraph.Rd
+0971dea4da68a6223cc4be0962131940 *man/intersection.igraph.es.Rd
+0aea8f48661994403488053067312bc0 *man/intersection.igraph.vs.Rd
+1cdfee019ad8edec2d5238161e781be1 *man/is_chordal.Rd
+3009676a0b688dcf494b71ae8242473b *man/is_dag.Rd
+05bcfbfcdcb1f4bd8dce8dfeaa9f3197 *man/is_degseq.Rd
+30feeb97d4d20ff122159054012cc5e7 *man/is_directed.Rd
+23f2a5e8ee76861ced5ef5bac2ee7084 *man/is_graphical.Rd
+f5247cd679487788f4c77253ecdde99e *man/is_igraph.Rd
+fe7704430d6b015fdc02bd8b3719f87f *man/is_min_separator.Rd
+9da1c2b9378f092b575328a02c26b28e *man/is_named.Rd
+c0401aba5ce2f302286af89d8b007e9d *man/is_printer_callback.Rd
+ad0cc429b7f4aad6d37e11eeb871a004 *man/is_separator.Rd
+d38af4a3937a9a457b10da6790f24e89 *man/is_weighted.Rd
+86cfe98b2da8f117b6f93ebab4489fdb *man/isomorphic.Rd
+7f923d381d201ad56aaf7e31f714c454 *man/isomorphism_class.Rd
+323a54fbd51343f91bc52daf889df809 *man/isomorphisms.Rd
+83585378bda03b7d1a14020c2f3f577f *man/ivs.Rd
+bf3f2cd91fde246ba9ee6eb4ec9b4dbc *man/keeping_degseq.Rd
+1f7ab911e02c5cbf789f61eef82e3626 *man/knn.Rd
+925c0cf7fda4be8beac88a6177bd21e4 *man/laplacian_matrix.Rd
+2fccef26f52b9406e1802569d67cf90a *man/layout.deprecated.Rd
+7f5682fdcc175fa55473f08f670a61bf *man/layout.fruchterman.reingold.grid.Rd
+cd028ca4b9a1b37e97f775886fecc35d *man/layout.spring.Rd
+2eaf9386ffca9813865380fa9bd4c3d6 *man/layout.svd.Rd
+edaa14845893e3eb478ddcd60742c0a7 *man/layout_.Rd
+9d24808b934ef032c59257eebb0b0a5f *man/layout_as_bipartite.Rd
+81c46b3d3fa3b243732660596d9de934 *man/layout_as_star.Rd
+7ecd4f4876efb0515d909346e54ab2f0 *man/layout_as_tree.Rd
+e5c245fd99f5b5b665b4a03d8b9c5b90 *man/layout_in_circle.Rd
+e697bd6106adad8c68bca54e36d50dc0 *man/layout_nicely.Rd
+535e7549b1fac28895ab6b6b4e2dee12 *man/layout_on_grid.Rd
+667d356c95ad2029bd9ee40f94f81390 *man/layout_on_sphere.Rd
+8f24f52986bfafd6c12f8702a6cf87bd *man/layout_randomly.Rd
+c85ca03d54e8c266673bc64664d27181 *man/layout_with_dh.Rd
+cf16360984e31d607f563c8b7738211e *man/layout_with_drl.Rd
+85745523d1f0fe960d41884c96f13110 *man/layout_with_fr.Rd
+e1788ecc362ec4bbb052fa62744ecade *man/layout_with_gem.Rd
+b2220009ecf47ffa8e9f0c17033672aa *man/layout_with_graphopt.Rd
+755b76fd4c0907db4f1e21ff0562c265 *man/layout_with_kk.Rd
+9ebf38f81ecd11cba3bb57a98b2cab74 *man/layout_with_lgl.Rd
+7b88253d8e03ce2bfe68b22c92e6b4df *man/layout_with_mds.Rd
+95fb63317bfb8c73330f8083f971c13d *man/layout_with_sugiyama.Rd
+8d56cc9d3954a96ef3b837e19728404d *man/local_scan.Rd
+34321539479c57648d5841fd73b73efd *man/make_.Rd
+f6b550e60179478f65a1d3f930a739df *man/make_bipartite_graph.Rd
+916e781ea047b3b63eb7a8c45cbabea1 *man/make_chordal_ring.Rd
+9339d3e5d57bfd4cc55066836fd02a16 *man/make_clusters.Rd
+6be060a9747c123833a1e076b8db13d9 *man/make_de_bruijn_graph.Rd
+82f0e07de4498cb2fd7f88bfcfca9c49 *man/make_empty_graph.Rd
+a06a6f448ec71a67c99ddb21aa80c94a *man/make_full_bipartite_graph.Rd
+2df957c1233ce27af6c5ebadbb582669 *man/make_full_citation_graph.Rd
+61083e01b040c7fada5b67374ae0a298 *man/make_full_graph.Rd
+06a7b12746e14a287267b7bfbd2ec69c *man/make_graph.Rd
+71dfa4171f2305fbe0e4f8198386abfe *man/make_kautz_graph.Rd
+56129b2d6cfcbea99d7f78a9ba55aee5 *man/make_lattice.Rd
+3f13f1863d99790749e3061af4ccd990 *man/make_line_graph.Rd
+4b9b6646b577b38e611fd5769fc944f5 *man/make_ring.Rd
+6a54842ec185a3ff101d450a770ce10e *man/make_star.Rd
+a983b7eb515e83fdd7fb8a33dc5f3a0d *man/make_tree.Rd
+8d2eb4e0567086188de0b0e86fbda036 *man/match_vertices.Rd
+6e6a9046b6f00625698527706d641615 *man/matching.Rd
+ac8256b00fa1ff2bc3aa93808e31f19a *man/max_cardinality.Rd
+a97c79a941a42c44436bdd5a15974131 *man/max_flow.Rd
+03c237202650dd8ceca57625409df013 *man/merge_coords.Rd
+e4d09d1506d7ab8c255664aead49c877 *man/min_cut.Rd
+7e3614e2abbe9234505a0155a313a3eb *man/min_separators.Rd
+f8b1f6530fdb70322c655bb4408a9048 *man/min_st_separators.Rd
+93e72820f27e7c225d8ea8e9a664cd5c *man/modularity.igraph.Rd
+4c7ec5283d11e07de2f55525f6841c40 *man/motifs.Rd
+0693778f29920d0560662cac7867b847 *man/mst.Rd
+c4c79697e674e2e674f092f6fb6ce5c4 *man/neighbors.Rd
+f93db27cfc12a7e50fdae78991753fa2 *man/nexus.Rd
+4e7ce11d910150405580445d98fb3044 *man/norm_coords.Rd
+ab1db31785dd133d0b069455cc137888 *man/normalize.Rd
+d99bab21d9f96b57969047ca9b09fe55 *man/page_rank.Rd
+0b8ba556a76c494b84e20400411ee6f0 *man/path.Rd
+19a6b9ab9dcf6b17c9326c52ab0b0cf3 *man/permute.Rd
+af6d2e9f5a6c77b0c3c5385fa1d12f39 *man/pipe.Rd
c74527bbb90ac46e47197a4a587435eb *man/plot.common.Rd
-cad87735f8a44423b46d8ea742dfc29a *man/plot.igraph.Rd
-dfa9f590f9f2ffb747df7aa91becce2f *man/plot.sir.Rd
-225e47ae770110ff85bf4d095682f4ee *man/plot_dendrogram.communities.Rd
-f00a7c8ebe851a4d54ea0ec0b1b22c33 *man/plot_dendrogram.igraphHRG.Rd
-473d2eb8d9cbe5407f71ba46bdac2d64 *man/plus-.igraph.Rd
-448866d911307690e368c5efb2ae01c9 *man/power_centrality.Rd
-b62370232f5becf5075014b5fdc26b38 *man/predict_edges.Rd
-615b4d4dd7531267ac4eb75d87eab020 *man/print.igraph.Rd
-d57f0f6c5d19af3ba6ac2e790f864019 *man/print.igraph.es.Rd
-a31b0f570d61eb10f9e37a6fce51fa4f *man/print.igraph.vs.Rd
-0e1d65b2b7aed4cabafa756829fe85c2 *man/print.igraphHRG.Rd
-d59b8d1a95a6f3704577a0028417cb10 *man/print.igraphHRGConsensus.Rd
-34ee0e22dbd736c5920964732c768cae *man/r_pal.Rd
-faa7b61a3a9a896fbba69456a2c7c8b5 *man/radius.Rd
-ef10cb0c51b3b357eca15e50fdd07b8a *man/random_walk.Rd
-062f052f27b8cf583a2555be5cb44b39 *man/read_graph.Rd
-722234f5312acaa2c9ed8528637a592d *man/reciprocity.Rd
-dcbfb6acf13e522c7fc980c900620764 *man/rep.igraph.Rd
-72be6e89f3c7c80ad288aeec1ae2ae53 *man/rev.igraph.es.Rd
-0d6b7e062a8d3944ddf060cd40fd1047 *man/rev.igraph.vs.Rd
-3cb49ba7cf1a25f19e8828321ce3873e *man/rewire.Rd
-2c7675cdd07144d1fdc73b54c9351069 *man/rglplot.Rd
-3234c78394d779d9afd48500c8335d89 *man/running_mean.Rd
-bf3ee03d3cfa2eb50ee9ad93bbd85bbc *man/sample_.Rd
-8df93ff90f9fb23a3bcdd8badc8cbb97 *man/sample_bipartite.Rd
-d5ce00b378da107ec2fc37763e2d16db *man/sample_correlated_gnp.Rd
-5fa79986e19cc1c0e171906e36d2fac5 *man/sample_correlated_gnp_pair.Rd
-e10647ff481fa0122c8bc5f7f456dada *man/sample_degseq.Rd
-8ddcd941f37392142712c33cdbb62c95 *man/sample_dirichlet.Rd
-20eab3d3e55c5d8c5afbac354f6c01bc *man/sample_dot_product.Rd
-413719af01335ff51ca12b207f6b8c5b *man/sample_fitness.Rd
-1d61ad78fc6dbcf870fa683b146e0c8b *man/sample_fitness_pl.Rd
-af14208df423fe62dead3c5b9a84a071 *man/sample_forestfire.Rd
-ef72b8f52e6f76d2374354380dd12053 *man/sample_gnm.Rd
-8290688f843ae5ba11f5b026cb74ab10 *man/sample_gnp.Rd
-b1cc338cea2adf8d7ea4a2cb58dcf8d0 *man/sample_grg.Rd
-500163b3ab3616d7eb4faf3dee677d74 *man/sample_growing.Rd
-c43122b207874d159a85d0e1fef41ec3 *man/sample_hierarchical_sbm.Rd
-661531ad452e4787aed3bdc16686f659 *man/sample_hrg.Rd
-15e601e6beac6346e68d3072ad49dfe8 *man/sample_islands.Rd
-242512fb3085d4d91011a11ace3915c2 *man/sample_k_regular.Rd
-5369681727cb19fad828466beea6e5f0 *man/sample_last_cit.Rd
-0af2eef3edb9be7db9b80c11dbc43b21 *man/sample_motifs.Rd
-5d786432acf735037457fa27141b8a2c *man/sample_pa.Rd
-51564e8ee5088f07e411cca9e2cae48e *man/sample_pa_age.Rd
-baeaf2b10de3172061559bf73a2b05dd *man/sample_pref.Rd
-edad97a22e1b47c5148d2fee168c4f4c *man/sample_sbm.Rd
-8d44db4c53823b86da59f27c68dba24c *man/sample_seq.Rd
-3dc67ec4dad01bd6525c88d73f9dc939 *man/sample_smallworld.Rd
-6a1972f48f9411b29f9eac24d46c40e5 *man/sample_sphere_surface.Rd
-3987de5c340ff1554edca08698d6929b *man/sample_sphere_volume.Rd
-1037d358d1f0d9a062be8180b741b3cd *man/sample_traits_callaway.Rd
-97aa7108cbf3a3ba1de425a798522688 *man/scan_stat.Rd
-2e4c6ad36ccdc5336e5254ac37dc7263 *man/scg-method.Rd
-f55dfd254afc5dc8ce8c59688a200c56 *man/scg.Rd
-45dda381388fbf2fbf1b3259db07aa72 *man/scg_eps.Rd
-5083d77b2a8ffa35826b7922becd47e1 *man/scg_group.Rd
-2d33cc20fab97eefce61536692049714 *man/scg_semi_proj.Rd
-27b5263d98bc203982383e4ed6359a73 *man/sequential_pal.Rd
-7c6b3bcc19b21d7ac7ae26426481dbbd *man/set_edge_attr.Rd
-4744c6f86206497f77067d6c62963928 *man/set_graph_attr.Rd
-35f4098793af0d09eabc40d35327a511 *man/set_vertex_attr.Rd
-9c8971b3e73f0a45902665bef7db3302 *man/shapes.Rd
-08daa44bd0dd941f7b866444b69c1b2c *man/similarity.Rd
-3fb66c817f34c8803168f693c4a8e867 *man/simplified.Rd
-7dc18d1c3bd0039ad3c5ac3b60b053ba *man/simplify.Rd
-b8d0c9f6c5f811e4aede7c247bd090a9 *man/sir.Rd
-d3bb4a412fb5cb471efb232014366c0a *man/spectrum.Rd
-e001600f733fc73b7aae95b99fc83faa *man/split_join_distance.Rd
-a757f57e07b4a56e4d3d397bce9e6619 *man/srand.Rd
-8193ddfde70d2dcac112dd45a9b5509e *man/st_cuts.Rd
-736e344890c7fad9664c9b89af710534 *man/st_min_cuts.Rd
-cd29e538c28e46d1fa01254fcd0139bd *man/stochastic_matrix.Rd
-3da3835bc4afc1a556179f53253a560c *man/strength.Rd
-fbf6daa1a792100c1abee1d41d213a40 *man/sub-.igraph.Rd
-af266e780f0a81c9da605e7237b8b879 *man/sub-sub-.igraph.Rd
-c30236e7c904a53f5d4a14051e46b329 *man/subcomponent.Rd
-984b4d4816340485669fdad6a168904a *man/subgraph.Rd
-07db79bc335f0e04a2642ca0edaa2b54 *man/subgraph_centrality.Rd
-141cc8cc55b86b6ff0ad53ac13e28a48 *man/subgraph_isomorphic.Rd
-3e0d417316ddb84b40e6d9b556fd4212 *man/subgraph_isomorphisms.Rd
-dd43518f1cb7fa06f74ff08cd73c3f5b *man/tail_of.Rd
-dcc36d6513810a05dc5aee4db1cf6d06 *man/tkigraph.Rd
-182d4ca047c072835f56925be5ae52c7 *man/tkplot.Rd
-dded70bc91fd4b32470d69c30c3c9288 *man/topo_sort.Rd
-40f46e1a4521ddcf3c933fa5a66f0f26 *man/transitivity.Rd
-650d83ad1f2e618ac55c77128357171a *man/triad_census.Rd
-3cb4abce82cc1b8875c0ddfe69cdf739 *man/unfold_tree.Rd
-f86491a5e94e80cce6a0de1b030e923f *man/union.Rd
-ce33c32b7c727661ab75efe75f3cba21 *man/union.igraph.Rd
-9d9e4f603d1669ca59c4c774432e8547 *man/union.igraph.es.Rd
-68863d16564c21e5f01e1e99cf8fce37 *man/union.igraph.vs.Rd
-81b2a8be8068135f8b364dd373ea8c8c *man/unique.igraph.es.Rd
-9904b84cbf70c88997eca93c650f8441 *man/unique.igraph.vs.Rd
-545164e6a85a8803ad908e69b6ede2ab *man/upgrade_graph.Rd
-42e6a14586647edc7ef491eabe9cc242 *man/vertex.Rd
+8e8f0fd300da89252af6aa569ef4dcad *man/plot.igraph.Rd
+4abd166aa81daddc7367daa00e3d265e *man/plot.sir.Rd
+d7d7159ac6a8932977f8273567ee0737 *man/plot_dendrogram.communities.Rd
+c3695e3dcd3d29a25daa5402a1c2e206 *man/plot_dendrogram.igraphHRG.Rd
+de2ca15b02fa7f502730e2726fc32d56 *man/plus-.igraph.Rd
+146bd2caad6341cca0f76bb9bd6eaacf *man/power_centrality.Rd
+fd46ec75fd2ede14f45431d123d15bbd *man/predict_edges.Rd
+439a6be6ac408c64dfe54b4b6f5686b4 *man/print.igraph.Rd
+ba7da45472fedccd67fdecec40eb255f *man/print.igraph.es.Rd
+ede6b6410a963c8ad79ef670d07d28d3 *man/print.igraph.vs.Rd
+bb01ffc0bd48788ce28e56dbf2b51199 *man/print.igraphHRG.Rd
+9d486521aba44c5ab178f2889eb00273 *man/print.igraphHRGConsensus.Rd
+195058bee8fee19b4eb87b4a93fb7ff3 *man/printer_callback.Rd
+0ad6fcd5bdf0453546189c4ae11cca14 *man/printr.Rd
+0fa7a9608075ef87ef06d026d96da0a5 *man/r_pal.Rd
+9823c518e709d06396e241ff48b83f1e *man/radius.Rd
+6532cf86666d2638476026bd84c9b316 *man/random_walk.Rd
+8ecc18060a298d59f014c0ddf2d1a168 *man/read_graph.Rd
+b17ed14c34af5830b54a187768058607 *man/reciprocity.Rd
+876551c8cd37422cb94f64ead21a6ff8 *man/rep.igraph.Rd
+e59650231ebd0d7c4ba7d77eac39a91b *man/rev.igraph.es.Rd
+92641bddaf9f9ffec1ed3d10f34dbd7d *man/rev.igraph.vs.Rd
+979bc338525073487d2f24d7420e8f48 *man/rewire.Rd
+72c8b2d0260fbd80f7b1a1968fdba1ee *man/rglplot.Rd
+ce204a0fec214014be7be38aa7fe9624 *man/running_mean.Rd
+b4c849b235316f063fbb6b683c5c4f23 *man/sample_.Rd
+4078c673516927d6200455a33bef4f5d *man/sample_bipartite.Rd
+2d997e1f7290f29073948f97f9350861 *man/sample_correlated_gnp.Rd
+226d5142eb56351ae843c3f4369cedb8 *man/sample_correlated_gnp_pair.Rd
+52adc73bc7db6096f6442ec4f32a3302 *man/sample_degseq.Rd
+a434b3635e53403004bd458c90bdab7c *man/sample_dirichlet.Rd
+938234e8469320764b72d6da09ab15a4 *man/sample_dot_product.Rd
+73d9ccc3b76bb58eb5b3b4c937e11871 *man/sample_fitness.Rd
+666742aa1951d21318b7a01a4b072f01 *man/sample_fitness_pl.Rd
+5a4be2a3697806d8a3101908410b8a37 *man/sample_forestfire.Rd
+9fc39369add1a088e6187148ae4e160a *man/sample_gnm.Rd
+5af23dda93426c846642bab3f1b20641 *man/sample_gnp.Rd
+1f697a4761b0f0b061ba24cae7ae9fb3 *man/sample_grg.Rd
+282ca01c580b32d2b7e5391d47810683 *man/sample_growing.Rd
+49997c3408f8fe9bbe40036d3cc534b1 *man/sample_hierarchical_sbm.Rd
+7c28c0905371c18fab150e5a644ccc89 *man/sample_hrg.Rd
+022f3ff510535527da9360c53be7ab66 *man/sample_islands.Rd
+5de1b411f9d9ea0799e2d17effee9266 *man/sample_k_regular.Rd
+d3944e615b1a11956b593d9de46a65e2 *man/sample_last_cit.Rd
+3ed39a0fd4846877324599d86e8dc8e7 *man/sample_motifs.Rd
+e090c27e32b8ba3b665a0e9538b1eefe *man/sample_pa.Rd
+78d38b8020e0fafc94bd5203644fcbad *man/sample_pa_age.Rd
+ab06bc222c9ed6ad195058bf3a7fc6a0 *man/sample_pref.Rd
+0a0dbf17a9eb8178bdcbf03c20e5d2f7 *man/sample_sbm.Rd
+dcccb371f2b36f9b5818edf61f18639a *man/sample_seq.Rd
+baf738b3c956878848725084f4fbc704 *man/sample_smallworld.Rd
+1d10b04e338f12dc717a348570968b25 *man/sample_sphere_surface.Rd
+519880b80455f0bd48ec876b3bac1e29 *man/sample_sphere_volume.Rd
+33a6081b60f4283c5a5cdf842a5f6c87 *man/sample_traits_callaway.Rd
+b334c043719ccfb5caf8bbfb0ba08cdd *man/scan_stat.Rd
+7239118709a8d586a1fdea139a7fa642 *man/scg-method.Rd
+aa0306c8eb8eeeef84db2e61531e5980 *man/scg.Rd
+c5354904efa120f0d76b79b7078d65aa *man/scg_eps.Rd
+05f7f4b3b7b2667210cdacca4eab9ba0 *man/scg_group.Rd
+ceeb5bf734eea11b217d3c3ed9729c90 *man/scg_semi_proj.Rd
+e8d4ae1be367c3048f143c8050d5c6da *man/sequential_pal.Rd
+7451a128d7564d62af25915f27c4500d *man/set_edge_attr.Rd
+c1e203375c64b6f149197195ff572d92 *man/set_graph_attr.Rd
+f07354e81f79b9ecb5529795798d61d3 *man/set_vertex_attr.Rd
+b9d826f62e1017adb28de815321b831b *man/shapes.Rd
+f4e4e2552b1dd51d643c911c212b5869 *man/similarity.Rd
+47b4badc0371fe8a228dc25f4fec58be *man/simplified.Rd
+3858fb7886e6c80928861d28ace00d31 *man/simplify.Rd
+e7f586c110dc3f930e9f71e53097bae3 *man/sir.Rd
+6b92d6c2888fc3ab745ab75fb09a733c *man/spectrum.Rd
+118d3ecbf649398333da1383be11bb99 *man/split_join_distance.Rd
+9b6fcfdbedbd1b584c3b4916c8061dde *man/srand.Rd
+b2564a561b033096f5eeeefd9f0b1be9 *man/st_cuts.Rd
+bab7581d7c4fbdba352d6d5a68157493 *man/st_min_cuts.Rd
+52f29a4fa679e8a3afd154f235869ebe *man/stochastic_matrix.Rd
+181c164daa619d19356514fd927c8ea3 *man/strength.Rd
+3975e30bc3b84d2b3a77a4aafc5f2e16 *man/sub-.igraph.Rd
+019cfd75d983372ee7babd4aed60b181 *man/sub-sub-.igraph.Rd
+787d1730c34490e36bddecae6b25567b *man/subcomponent.Rd
+00b03ade72884ccfb1db3dd92f334d15 *man/subgraph.Rd
+216aff0af0d5d87970679b5857e20013 *man/subgraph_centrality.Rd
+b796cce0838a38f976b97ef9ecbe597d *man/subgraph_isomorphic.Rd
+5ae4a6be94beb0dc9830f91c85438b8b *man/subgraph_isomorphisms.Rd
+5f6da998a7b6ed1c47695af9e6e1f73c *man/tail_of.Rd
+bcb1def4cda65610d735cba196500aad *man/tkigraph.Rd
+4051fa9bd00908190b91816eaa87dc90 *man/tkplot.Rd
+d3833f12bb816481ffeba680357e9e5c *man/topo_sort.Rd
+a8e392328d8aeb8f5077234b0b36ca87 *man/transitivity.Rd
+b30be370a2e7f1558836fbe0f75462ff *man/triad_census.Rd
+7f2ffe354eaf63c4bc4993abbdff6059 *man/unfold_tree.Rd
+83dbdd7ba97f4611b276aa89a0e364e4 *man/union.Rd
+32dc5293773b97a03b217bb4d080c72a *man/union.igraph.Rd
+0038c5916c00a7d9f03e51fe0087dc4a *man/union.igraph.es.Rd
+1574b0139de31725bd6369757c347748 *man/union.igraph.vs.Rd
+a63dc9b4dc3afaa9bcbfd22594845a61 *man/unique.igraph.es.Rd
+7134cd21de6b50d488a807a555db261c *man/unique.igraph.vs.Rd
+a6ecfd839feb64f11543f306f88dbba9 *man/upgrade_graph.Rd
+6e6e7e9a71fbd3fb6825c6978bf85eb7 *man/vertex.Rd
618a6de0b4fb2cafd10fb8c33a51733c *man/vertex.shape.pie.Rd
-bf900d751bb4be19ed7c1a46215f8c64 *man/vertex_attr-set.Rd
-fd45c207a24c9d13e14469e7b6553ba2 *man/vertex_attr.Rd
-907a592bb3ecfd2e53e2a0f1c18fe143 *man/vertex_attr_names.Rd
-590defb192b835867ff69d46acde5cc3 *man/vertex_connectivity.Rd
-abc23c6b293e4012236aa24d0a4b96ba *man/which_multiple.Rd
-689e238fb27fda01a75527e0189c945a *man/which_mutual.Rd
-6c4cb8a9f02895453080566affa20fc7 *man/with_edge_.Rd
-5c235e98409d868e164bd8ebd7de9688 *man/with_graph_.Rd
-dfa59de85fd19951adcd6f63ae7d3313 *man/with_vertex_.Rd
-966eecb5b28acd8b8d60d4dbc99da5bf *man/without_attr.Rd
-83dc6af5ee10c09054a6a3ec23d84b87 *man/without_loops.Rd
-28c5fefe65a49821092c31a1dcb0e092 *man/without_multiples.Rd
-cde880d64ac2352cd1873a9f3c425de3 *man/write_graph.Rd
+b8d1ddaebff850a72b061134495a01e5 *man/vertex_attr-set.Rd
+f5125d3f0d3074aa4c91c320ee486e58 *man/vertex_attr.Rd
+01cb988014cc9ad00475a27b2e08db35 *man/vertex_attr_names.Rd
+d7337c044d3d5e449d92a66a3d02e440 *man/vertex_connectivity.Rd
+919e92b231b9f54767bdd41d57945d0b *man/which_multiple.Rd
+9e4b0689e47f6b673a0eba4e1031aaf2 *man/which_mutual.Rd
+816d3fd68d54c7ddb9f23acb5e02ebae *man/with_edge_.Rd
+cb7181545fbc0698208272d2b1fc9100 *man/with_graph_.Rd
+2b0ecd1d9317164b0e873d095a3abf56 *man/with_igraph_opt.Rd
+2dd123c322fc5ee95577180ebf551a96 *man/with_vertex_.Rd
+d70d2d5acbf4aef8c351fa6f3dccaff9 *man/without_attr.Rd
+389b77dd4ea2ebee876242109ddca29d *man/without_loops.Rd
+13688074a765d15dfbb85a233e4da8d1 *man/without_multiples.Rd
+41e6b433c761d467b87665721cb3f89e *man/write_graph.Rd
752c6c39d6c94efc9d6ab8059c1b7335 *src/AMD/Include/amd.h
c1ec3247520fb501520b4fe077d20856 *src/AMD/Include/amd_internal.h
b2470d1e2bced70dbd2b7e2f85405a50 *src/AMD/Makefile
@@ -673,7 +525,7 @@ c28402b3ada915779c2e3f6ea105ade0 *src/CHOLMOD/Core/t_cholmod_triplet.c
43dea0a98ff00c4d001efdcf9e1107fe *src/CHOLMOD/Include/License.txt
aebdd50c54b3d11988fa4be5fb71d05f *src/CHOLMOD/Include/README.txt
403be4e598bd11adb647b463f7eb4192 *src/CHOLMOD/Include/cholmod.h
-890fe34ad312aca4a0976b28969d5767 *src/CHOLMOD/Include/cholmod_blas.h
+dc46c6e059283e2f11cb83825732e367 *src/CHOLMOD/Include/cholmod_blas.h
8c1e3f82c00d6a67dd5d9d3139bea5a5 *src/CHOLMOD/Include/cholmod_camd.h
bf7a358cf5641e22d1ae78fc9b350c47 *src/CHOLMOD/Include/cholmod_check.h
67ecb03414269c5dda2e161a330fe1f0 *src/CHOLMOD/Include/cholmod_cholesky.h
@@ -728,12 +580,12 @@ e14e53d0b36e1d0647348a326e8b3b54 *src/COLAMD/Include/colamd.h
0a80fb0db9cefb02e290ffd2f3431e6c *src/COLAMD/README.txt
ed584482056a57c97c84f0f2701f76a6 *src/COLAMD/Source/colamd.c
d9b27cdbf6cd3a08a921754ba6acbfc0 *src/COLAMD/Source/colamd_global.c
-e9746e10e53c52a8e9468e81ac0e9fe2 *src/DensityGrid.cpp
+2c69919a53414b5a1703a567fd1a813e *src/DensityGrid.cpp
11b90b027549d524c4e8af3cbbfcc307 *src/DensityGrid.h
-fc67113e1f6fbfdcda59cf39aab3ff00 *src/DensityGrid_3d.cpp
+11992a99485d4237e337397e77101aa9 *src/DensityGrid_3d.cpp
5cfb53cff37ca7d43a52db4f8e44ba94 *src/DensityGrid_3d.h
-196f552edb1ca1c8f9cf8a97a9e6f707 *src/Makevars.in
-3f6c3b45062c7e7e1bcc6f6e3695542c *src/Makevars.win
+0f32a2b8fe80cb42e196de02bc7c54eb *src/Makevars.in
+cb7dce946841c61ad83bc25e43921547 *src/Makevars.win
47ce39714f6f9d6ec3bd7c91624d87f4 *src/NetDataTypes.cpp
69166cb2f393e3ab50bebc72b16d3f7e *src/NetDataTypes.h
19c564585ab9700eb4356ee8eeb32403 *src/NetRoutines.cpp
@@ -745,47 +597,57 @@ e9b2be5ad0056f588187cf504cf60764 *src/SuiteSparse_config/SuiteSparse_config.c
917bb33fe32383364ed1174ebf623868 *src/SuiteSparse_config/SuiteSparse_config.mk
0ea19089dfd660f6a712ec073f2a24dd *src/SuiteSparse_config/SuiteSparse_config_GPU.mk
293d047331651328bfd9a3899c45e915 *src/SuiteSparse_config/SuiteSparse_config_Mac.mk
-379698a2a6027eab2a06b0b62cbd1b9a *src/adjlist.c
+7cbf14375f63b39c20ac81b319af4279 *src/adjlist.c
cd9fc819a7108d5bd6e3df27bc574f8f *src/arpack.c
84d831cf06a12ccddc98d577cf34638f *src/array.c
28757abe7ee47a2a3752132e6521dbe7 *src/array.pmt
-46ebbbc9a7d738bc44853dfa2125c4eb *src/atlas-edges.h
+267926cfbc6903038bb8c7569fe853ed *src/atlas-edges.h
f94137db5d049089a48e8542b40679c8 *src/atlas.c
-971302943c0b86513f8d197306d6855d *src/attributes.c
+a7bf705fa703ed691200ff83438d6e4f *src/attributes.c
7f8eedd101f3f975de419df961bc789d *src/basic_query.c
8cdb18f2170bd6eb311cb7ac9b12944f *src/bfgs.c
e0fb18ecf621c13a45bfd435b1638fce *src/bigint.c
976d10cf54420e8a8f2fc9f6e142d8fa *src/bigint.h
ba0b88f5f1576546416246735befd49e *src/bignum.c
-29893b4374ace98d58ab689ea1db4540 *src/bignum.h
-e8e1e6680b83ac2a2e4fdae9eb27e20c *src/bipartite.c
+4605cbc38e02812c0cec5b31d33f6f21 *src/bignum.h
+b2b3a16fe16c1e63a2eef5463a26081c *src/bipartite.c
3b088ee6a512aaf29884856942c7e7f8 *src/blas.c
-ce7bc18dbcd8c9b52277ac9e716040f4 *src/bliss.cc
-d1ea0ed591a4f82f6d1d0e04cbfd1cbb *src/bliss_bignum.hh
-bfed152afaeef7400072c3a9f959fdd8 *src/bliss_defs.hh
-7778a577e9617940886ea24bb867caa2 *src/bliss_eqrefhash.cc
-3f648579754a81b62cb537ce3e58bb7b *src/bliss_eqrefhash.hh
-b3ec002911064b0af0e307619040f2a0 *src/bliss_graph.cc
-d3be042bb3c162febb499d49193a5fc2 *src/bliss_graph.hh
-f1db9f7971b2bd2f3bfad2a44b45d223 *src/bliss_heap.cc
-8d97ac4d664820e45d31dc13cc5b0a57 *src/bliss_heap.hh
-e4e77314853892222e7f68ead863a590 *src/bliss_kqueue.hh
-021cc0c168fe6b164c9200732047b34c *src/bliss_kstack.hh
-b8dc4070f987308720f7e1a4f4d010c2 *src/bliss_orbit.cc
-d60c11f3c59f5772884b9806695a5c4b *src/bliss_orbit.hh
-d951312081f37121ffe1c304ae1e76a2 *src/bliss_partition.cc
-ad0761099301a344b21137f75758bf7c *src/bliss_partition.hh
-e8f493a4957107b381266cf23402ecd1 *src/bliss_timer.cc
-4fbcb31c629208df6e08de6fc5546e8a *src/bliss_timer.hh
-9dea494c0b450eacc3399124a835ca34 *src/bliss_utils.cc
-40ec60a85a52ae23d365b36be0663e80 *src/bliss_utils.hh
-895a5bac13f6db624449469b77ba816f *src/cattributes.c
-c91e3714a9addcb41a25331c72dfe09b *src/centrality.c
-5f28b17df959357c02ebeb9b567cd7e7 *src/cliques.c
-c674dafd0655f930666b309cd023d4f6 *src/clustertool.cpp
+edcf3afe464ddbeb584a664159dd8e64 *src/bliss.cc
+03691a516b0c665c6dc6f9de4bf4a50e *src/bliss/bignum.hh
+d68ac2b15e73f41afa201255b00180cc *src/bliss/bliss_heap.cc
+a908d17c67a15f1630dca13d3251548a *src/bliss/defs.cc
+909a84d005b4e83406e715606b6fb737 *src/bliss/defs.hh
+6119bd42fa0b0fcbffbbdf6ee249ee43 *src/bliss/graph.cc
+6e18bc268db869be993132d19604c5fc *src/bliss/graph.hh
+1f71a985781852d2472d3a5cfb17fd53 *src/bliss/heap.hh
+7e3eefe8a41743d132c7e1faf9d7d491 *src/bliss/igraph-changes.md
+cb75c3b12e2091449199f2620618b9d3 *src/bliss/kqueue.hh
+95cbe690c079c438da27195a44894528 *src/bliss/kstack.hh
+56935dcfed01d24b6c843cc4b4f746d6 *src/bliss/orbit.cc
+50697634bcf08172969b6cf844c675da *src/bliss/orbit.hh
+2dd0b46018cafcc2c38e90c9d03c06dc *src/bliss/partition.cc
+093219f44162aee9547d01a77e0cee0d *src/bliss/partition.hh
+1149a90b4858ef576be632eca8e94c0e *src/bliss/uintseqhash.cc
+270d32bee429d455348c9722111b2284 *src/bliss/uintseqhash.hh
+1dfd7ce22d1ad9ac0a334cd88340c352 *src/bliss/utils.cc
+585195404db8ae1959a36fc182500f4c *src/bliss/utils.hh
+b6fd9917844e2e249f85b28b4738fe06 *src/cattributes.c
+3d9225ea1e88dca1b84f565e42fdc42c *src/centrality.c
+c7b8351063a81705746396607cc7c350 *src/cliquer/README
+b42fa37ab354d950216d94923f82ec74 *src/cliquer/cliquer.c
+6048cb4559ad045e66933c7be080cf71 *src/cliquer/cliquer.h
+ef4bff214b7262783a2bf3a1924760f8 *src/cliquer/cliquer_graph.c
+113c0673e6102fa0103b1f4e01b1b6d0 *src/cliquer/cliquerconf.h
+5944482363f217cf4ec2e25bd0392179 *src/cliquer/graph.h
+f1ad39d0a3c6331ef95d7d2cb470ad28 *src/cliquer/misc.h
+eaeba91188cc59c857527b61acc8adce *src/cliquer/reorder.c
+164d316a2ead051b7054673bad48277d *src/cliquer/reorder.h
+f74032c3a8ce9b4672233a7819ead3ae *src/cliquer/set.h
+8d31d311c9b0194b7c8a2b87a991f776 *src/cliques.c
+e29b420a3b78dee545166a0c8a168f1f *src/clustertool.cpp
6ad201a1dcc21ac1abc526ff8fc5ec37 *src/cocitation.c
-02021ef565fd8ffb32fe28519d7d067f *src/cohesive_blocks.c
-2e1f5738906f7fab0e9f994ea65f0d1e *src/community.c
+769ebaa580beb5101d20afde32bf3d84 *src/cohesive_blocks.c
+7ec049657c84a22582f0c3461855d48f *src/community.c
c878447bf8cd5bd7d6ad60299325589f *src/complex.c
9828657420ac846bfe520574e68ef2c9 *src/components.c
d41d8cd98f00b204e9800998ecf8427e *src/config.h
@@ -846,7 +708,7 @@ ed31244ed5ef4ab0c2caa42b1a92dec0 *src/cs/cs_sqr.c
4ae2ad895b3ad8adcc0927dee0b33b3e *src/cs/cs_util.c
74e3d5634309a7716491939ecd8b993a *src/cs/cs_utsolve.c
ae2b99c6930b9d78a067b9f304e4d021 *src/debug.h
-9886eed995d6b524e1a0f57b79cad7d7 *src/decomposition.c
+18d23ac17e18fa4bff4b3d8268ff4563 *src/decomposition.c
634a82287e116db541c1c954a3cd9bdc *src/dgetv0.f
53aa0b92a01343a9780f33409ff71448 *src/distances.c
ae7917a56c25a07b9860819bebf32f40 *src/dlaqrb.f
@@ -859,7 +721,7 @@ cbd4968767585d82b4ea9762ce7a973b *src/dnaupd.f
7e7766bc466e28155a85211734e36426 *src/dneigh.f
92be5de027d3bf234c3adb3c1df81216 *src/dneupd.f
599f6e77589fa5338379452ab77ec143 *src/dngets.f
-e364abbd6786aa5772180af6879cdbd3 *src/dotproduct.c
+375ff494ab18d30adad217d6c5406a6d *src/dotproduct.c
03a845c6af6e800d15575f831ea2f18e *src/dqueue.c
e2ddc9e8d520337ca4fafc08d4bab6d1 *src/dqueue.pmt
efac25ebd52c48ef108adc8afb018f16 *src/drl_Node.h
@@ -868,7 +730,7 @@ ac508e551027fe56c57650557ae848b5 *src/drl_graph.cpp
0c4a475dc83152ac2a64f07bc13fbc60 *src/drl_graph.h
9b685020b218853e6c53e036b52b5f5e *src/drl_graph_3d.cpp
4ee344063b486976c812f82113d3106c *src/drl_graph_3d.h
-d09cfb486851114c28eb5b74a4692e08 *src/drl_layout.cpp
+084b0e967eabe754512016f676c9fb4a *src/drl_layout.cpp
4c1690cd89b50832fb6ba2398d14414b *src/drl_layout.h
a77f381105b0246c7a0719c0b669365b *src/drl_layout_3d.cpp
7e4c69a183df51fc7662e2a3f5c6e6be *src/drl_layout_3d.h
@@ -891,22 +753,22 @@ de4792cfaab6cdda8d557902c2310fcc *src/dstqrb.f
10246dd04cc987d389f1f369f4b1813b *src/dvout.f
d971c3cba371000e3ee5232179b380c3 *src/eigen.c
0accc0fa9659dc8f9f4c741decc84b1b *src/embedding.c
-f2de7b7be34e28680986231c4994aba7 *src/fast_community.c
-d0bfcf69eb5733db3c1c2de12f407bc2 *src/feedback_arc_set.c
-73856a07710b909efe4515ea1cd593b7 *src/flow.c
+7a18f357ae90d62a9be31318d8e4d152 *src/fast_community.c
+941a75d37de0179bd167016cb952806b *src/feedback_arc_set.c
+4e4d915b4db7cfa6a03ed14677d30a16 *src/flow.c
f51da6e3cf3d9e27793f855b469a3663 *src/foreign-dl-header.h
bb7f51b277f6b57706d4a525a86fa698 *src/foreign-dl-lexer.c
311ecd79cb537a22b01912b84f2a73dd *src/foreign-dl-lexer.l
-7e624363073352de0f5d152c3ef57876 *src/foreign-dl-parser.c
+b323e580df2bc80eccbd4d76e512fd45 *src/foreign-dl-parser.c
3682d35229a1a858fc0f39984250007a *src/foreign-dl-parser.h
-efaed2bbc90cd2438328a2c2e9a65ed8 *src/foreign-dl-parser.y
+8c31621922138e1e94eecfc45915d0c6 *src/foreign-dl-parser.y
3db22bd8908d6d05a56a0856702ee72a *src/foreign-gml-header.h
955e898325748a201742187e3c2c30ad *src/foreign-gml-lexer.c
c84b6be330a9184096434f55d6de9e87 *src/foreign-gml-lexer.l
827a6fda456b52478a9eeb1ab45fbfc7 *src/foreign-gml-parser.c
aa32853c573766b8d0a2475b09ebe237 *src/foreign-gml-parser.h
19ced477a34f97376c619eea0482f1f3 *src/foreign-gml-parser.y
-65afd90a3ab5f7f586304bbb36605eae *src/foreign-graphml.c
+bc15dc3106cb391c9b14f7fb33073f1b *src/foreign-graphml.c
6b3d524a6e9a9e187df1dbfbfd0afdbc *src/foreign-lgl-header.h
4e9d341f47bee27a4d03c689833df092 *src/foreign-lgl-lexer.c
fb60d3213c781454f82624410aed67d2 *src/foreign-lgl-lexer.l
@@ -922,16 +784,16 @@ bf1195fe1617392e785438d93fe0021d *src/foreign-ncol-lexer.l
6228545b60873edce3007a3b200efdde *src/foreign-pajek-header.h
46aa2a004b51f35fb195068a85959fca *src/foreign-pajek-lexer.c
1f9514ce1b24aaf239701148518861f1 *src/foreign-pajek-lexer.l
-8ab1c465db2c33736e330d94168463a7 *src/foreign-pajek-parser.c
+8f086277e8311a950d4575cf4ed564af *src/foreign-pajek-parser.c
afacd28c6079124a9c7169d3d51427d6 *src/foreign-pajek-parser.h
-8af7eae958466874c8c9c28bce72fb91 *src/foreign-pajek-parser.y
-05c1aac58e7912f0b763b5cf16e39013 *src/foreign.c
+7ff921252471c6d216ebeff1d4fc05a6 *src/foreign-pajek-parser.y
+694246f3791beb65c9d034ff2fd73150 *src/foreign.c
85aa6b11ac217d0125f2a637b2f44780 *src/forestfire.c
a13696b3db177831c57b0f4420a35bb1 *src/fortran_intrinsics.c
-e329c8b5331df44098797f3782160722 *src/games.c
+a2867e095441ec7484e0dd906fad4849 *src/games.c
9c4ac6869dba15f8f3726febbaa66170 *src/gengraph_box_list.cpp
-ffac9e0579529981e1c14cbfd6b9c69e *src/gengraph_box_list.h
-0792e2d1a7190e8d41e332e0ca92bab7 *src/gengraph_definitions.h
+884ddf7e6060db285d036f40cdbb5c0f *src/gengraph_box_list.h
+2f9813131916ddc631e671e48abcb169 *src/gengraph_definitions.h
669960a45a8d87d695aead1c4ff45263 *src/gengraph_degree_sequence.cpp
e91725a3e6fc82814f0838607077462c *src/gengraph_degree_sequence.h
aa2548014952552b00703886669949eb *src/gengraph_graph_molloy_hash.cpp
@@ -947,7 +809,7 @@ dfecde6d15a11f7fe08510ee52505a0d *src/gengraph_powerlaw.cpp
74f893284897e15ef1058d9359bcee1c *src/gengraph_random.cpp
0ec1db22781e6e2dfff3c076dc08cc0a *src/gengraph_random.h
7fca2f62df37344887866770376dfe96 *src/gengraph_vertex_cover.h
-3bd5bd3098edf9792af4c01e59beac03 *src/glet.c
+1f78b9a79ea04c9a441ca29048ea5c73 *src/glet.c
6aa4c0c48b808b45244efd507765e2b8 *src/glpk/COPYING
d895c230f75573dfd8c188a8647dd96f *src/glpk/README
e66651809cac5da60c8b80e9e4e79e08 *src/glpk/amd/COPYING
@@ -1110,6 +972,8 @@ aa24b037d218c2525ba09ead3425f554 *src/hrg_splittree_eq.h
d049469367b24df3aaa04a335e19ae1f *src/igraph_arpack_internal.h
0ba0b5c96c3f5ee66e361b402f6ba852 *src/igraph_blas_internal.h
8c23d74aac650a5a31f7aa2c5fd5e4cb *src/igraph_buckets.c
+7f4903acbb99fdeb4d2b1a70cc87b1bb *src/igraph_cliquer.c
+7fbb4277146260b1854a3533a71886e9 *src/igraph_cliquer.h
b19e0c7e19e68ea56da4bc4d4adb9d42 *src/igraph_error.c
89d68f6df7bcbf4d4076ac0b0e49c76d *src/igraph_estack.c
5724366acc9829a7710570238fb8757c *src/igraph_estack.h
@@ -1128,90 +992,91 @@ ec23eb8c9f95ac5333a7c4a955888c90 *src/igraph_hrg_types.cc
ea12c293520c96311f5df9e4de3871a0 *src/igraph_lapack_internal.h
1ea6795e5745f48a13b85a5d565ef2db *src/igraph_marked_queue.c
84c6ecb9eadc9a6615dada2a134ed3a4 *src/igraph_marked_queue.h
-783f7fc62be2829c0467d07ac846b90a *src/igraph_math.h
+933961d79a0658a7cbb9c14f64cae36e *src/igraph_math.h
d3872c797d7d9d20338f3988b3bffa1f *src/igraph_psumtree.c
ef0a9f0275dd11cd340293b9c350431b *src/igraph_set.c
d45e5264e0d3d4938d079599356bc688 *src/igraph_stack.c
276b378aa4479d729baf29fdca1dd84b *src/igraph_strvector.c
-f988c64c2045ca1b71eeda347e45905f *src/igraph_threading.h
+b5c3cdfed8c984310dae4ee4e3008ee3 *src/igraph_threading.h
78c519533ba34d958b11a20b183c3dfb *src/igraph_trie.c
4aa482a23cfc790fe9de29e1f8867038 *src/igraph_types_internal.h
-99c57c3a70ce472c78f5a5ec3fb23bce *src/igraph_version.h
+11acc8cd9a1ae935a9cc81abde6ab6c7 *src/igraph_version.h
0d9165112b0f0c8b86842e679b44359b *src/include/igraph.h
-37472f54aeb9a7c18f07db1e9bea2761 *src/include/igraph_adjlist.h
-75c807b296c812f666ab218a80b61d2e *src/include/igraph_arpack.h
-623fd0301b11d9b7e7d518410be151bc *src/include/igraph_array.h
+aa1ddee44c5ee4595a1598653829f359 *src/include/igraph_adjlist.h
+2947ecbc2e4cfd62b210777d1769a492 *src/include/igraph_arpack.h
+7854959b8ca1605d515dfc0bb749dbf9 *src/include/igraph_array.h
9001525eae9a131c06ec404e2027450e *src/include/igraph_array_pmt.h
-0e9277d3c012dfb936cb3dcccf9a6d04 *src/include/igraph_attributes.h
-f206398b5b1ebd455a888fd4e039df3b *src/include/igraph_bipartite.h
-5c8be918cb0f086369f60069fb96a31e *src/include/igraph_blas.h
-82e0de14549bd32301dfc35f040141da *src/include/igraph_centrality.h
-08c3846da4ba18485b169257ab2e6247 *src/include/igraph_cliques.h
-e45a8025313dd0029619f82777b1abe5 *src/include/igraph_cocitation.h
+956164a937a281c9a9ef44cb1b2ffd2e *src/include/igraph_attributes.h
+ded7ce911117cb185695afb6a588fc97 *src/include/igraph_bipartite.h
+faa2b57d3c505aae29ba301ca089d76f *src/include/igraph_blas.h
+6e5565f431ef173b7f5ec52367c5ed94 *src/include/igraph_centrality.h
+f11a5b678aef9889d9332745639ec32e *src/include/igraph_cliques.h
+082b594fc181b155990f2d8db1b79bb4 *src/include/igraph_cocitation.h
1914da75cb7d341220431e0ace1c15d7 *src/include/igraph_cohesive_blocks.h
-3b0614e0c2f1b3fd0cc1abd56178ab44 *src/include/igraph_community.h
-6b70a9038174acc3f988b831296c366a *src/include/igraph_complex.h
-c0501c548df97a52edccec56c888b743 *src/include/igraph_components.h
-e5242123fcea4d208db42746628e146c *src/include/igraph_constants.h
-49689ad5d8365f90ee241f37eddc996f *src/include/igraph_constructors.h
-16b3e1150995475d75000a4d3f3da6e9 *src/include/igraph_conversion.h
-5628489dc4a2f581a70e63de6d0de7f8 *src/include/igraph_datatype.h
-854fe9d404b9297dfe28cb345e16184c *src/include/igraph_dqueue.h
-1f7fa9c5233d679f978df2fce00db6f6 *src/include/igraph_dqueue_pmt.h
-fe6c31d313aa3c790c33f9e336cc8dad *src/include/igraph_eigen.h
-3eebe0dd5dd4fdc8e33317dcf747f5e2 *src/include/igraph_embedding.h
-d58a291f8865cf4fe45092185076ef19 *src/include/igraph_epidemics.h
-4015ea0ddca5a576656fca68e1ee9d46 *src/include/igraph_error.h
-2887c1f547c4ffd5bceaa6edb2d3c471 *src/include/igraph_flow.h
-87156e6fa6bdf23bd94526021c603f59 *src/include/igraph_foreign.h
-3a43cba5ced27eb95b115bb6a2d24516 *src/include/igraph_games.h
-9aaf4a333500cdd37d1813ce68e598bc *src/include/igraph_graphlets.h
-1717da324eb54cd1e1f71c10c8ae53b5 *src/include/igraph_heap.h
-7db2e0e75dfd1cc2da3126e9f5e62f14 *src/include/igraph_heap_pmt.h
-e09223330884413f8ad790dbecb6fe70 *src/include/igraph_hrg.h
-3245b2c2ff708563207e8691bb9ce5b5 *src/include/igraph_interface.h
-96e9fa6414a7f6b9a58cb0aea6d9dc50 *src/include/igraph_interrupt.h
-626c2ad06dbf67663fa9e477fb579806 *src/include/igraph_iterators.h
-5ee9175be30a58b456d2a9b0abb85e2a *src/include/igraph_lapack.h
-c00447123b9c1a88afef448d7516b4c2 *src/include/igraph_layout.h
+c9a459ff27462adf30561f7ee7155115 *src/include/igraph_community.h
+8660919371566588f510185e3e21bf3a *src/include/igraph_complex.h
+8275aa1fef31df669f6e1993b48c8c21 *src/include/igraph_components.h
+b544e4e21d17cdbb0a4fd824bc2efbef *src/include/igraph_constants.h
+3cd3abdd075d2e83ad9c12fd24b51fa4 *src/include/igraph_constructors.h
+bf0205c865296fa089dce1a3f6daf923 *src/include/igraph_conversion.h
+e4486a2829d55bc33af9aebaed854e73 *src/include/igraph_datatype.h
+7d750771b04760596f670262e85bc625 *src/include/igraph_decls.h
+6b8fbce9eb547d9a3f70960beae5f494 *src/include/igraph_dqueue.h
+2dad489dd70513edda99fdc2775d6e76 *src/include/igraph_dqueue_pmt.h
+02a566979aa6b3239c4a7dbe4b83e397 *src/include/igraph_eigen.h
+b2cee5042f804f3ed96637f65209f6f3 *src/include/igraph_embedding.h
+d98ac998006e57d634782a18be1e232c *src/include/igraph_epidemics.h
+4657126fe1d8359d88c76a0413d27366 *src/include/igraph_error.h
+fa609453980084c3b1188e705d1d41b7 *src/include/igraph_flow.h
+7f5c2907a852a74197eb6db7b0ba0a36 *src/include/igraph_foreign.h
+0d4685499eadf6f58eac24efa221ee08 *src/include/igraph_games.h
+6c12467abd243ddd24e805ec303ae7fb *src/include/igraph_graphlets.h
+07e8998bcdaf2b9b02a4f361829146fb *src/include/igraph_heap.h
+3e82c52e24b7b05c5641d25ad96519f0 *src/include/igraph_heap_pmt.h
+d9f977bbc91d976c84510b520564e3cf *src/include/igraph_hrg.h
+36fc610a83a89ef4ee4e19834c199ffe *src/include/igraph_interface.h
+ac0a83d2845c3dd265ba6004fee7cddc *src/include/igraph_interrupt.h
+b1673f54b1fcfd69ba0f09c02041df13 *src/include/igraph_iterators.h
+ff2d40874fa7a6e84eef8a98dfb6ea08 *src/include/igraph_lapack.h
+4af6de21f70c59f3dbcb01cb2a342a8f *src/include/igraph_layout.h
4183af0a346c6f9c9d23174c0712122c *src/include/igraph_lsap.h
-5f74e30a6cc5e2afcaa04c850b1d62e2 *src/include/igraph_matching.h
-9a93437b27e1ea58e601ee4a9b3bd941 *src/include/igraph_matrix.h
-86c0e0f30484ae675d06cb5ac8ffac43 *src/include/igraph_matrix_pmt.h
-d3bb0da57b31cb5ab0ce4429a7078a27 *src/include/igraph_memory.h
-030d41f451590d25e199bdb9dd9b7a15 *src/include/igraph_microscopic_update.h
-8ee4888b80c021ed79c30c5b6b7de3d2 *src/include/igraph_mixing.h
-a3e4fbbeb4dba712d7958dca6b594c5b *src/include/igraph_motifs.h
-c78c1c89ccd2d19cb96d2ca011e55d84 *src/include/igraph_neighborhood.h
-cb2f513f20d1b9e1fc768b4a01ba949a *src/include/igraph_nongraph.h
-e86604269fd6942eadb6f4c6f37986de *src/include/igraph_operators.h
-9fa4a86d827b66db5e090e0e07366b77 *src/include/igraph_paths.h
+ad6c57810e93d79ddf745811da8c46d9 *src/include/igraph_matching.h
+12702fb73ccc61a0dc3e1c0b38cccf5a *src/include/igraph_matrix.h
+8c7d74bf17373bd953fb62f990ef26da *src/include/igraph_matrix_pmt.h
+dee5f5c00fed24f26d8163a4bc56dfd4 *src/include/igraph_memory.h
+477a9f9cf3b49fbe347c02eb12cbf37f *src/include/igraph_microscopic_update.h
+f78e9fb0e8746215373afcb07b27f7a6 *src/include/igraph_mixing.h
+180e8d4c013442dc9d199230b8ff1bf7 *src/include/igraph_motifs.h
+84f7f0e433e4bebea6b2c47d30d75140 *src/include/igraph_neighborhood.h
+e6bdd82b265ee153792ea3d111ffcc44 *src/include/igraph_nongraph.h
+ce7ea8a3cf2b52540203c8c63e7ad797 *src/include/igraph_operators.h
+6ca08d60986df712fe7135e85b3115c5 *src/include/igraph_paths.h
e78b1f96059bbfaeafdb0477067edf51 *src/include/igraph_pmt.h
c7e18522a9ed70278190d35aad0c2788 *src/include/igraph_pmt_off.h
-8f739083243bd8c0146a4c4b44bfe258 *src/include/igraph_progress.h
-7e39b7c3cdc2c7793b47222dec147610 *src/include/igraph_psumtree.h
-5445a7660a7f5a2aed7c1aca66a040d4 *src/include/igraph_qsort.h
-70b876685a343319ffaa3e57a61ee94d *src/include/igraph_random.h
-56f4889324a204a891acded5cf6792d0 *src/include/igraph_scan.h
+3b2537a5dd66fb92e83a48e96b946f61 *src/include/igraph_progress.h
+5e1010f0e8a7f1a6b21b3b29e168ab90 *src/include/igraph_psumtree.h
+10469921eafe6c9feac553762d2c31e3 *src/include/igraph_qsort.h
+41f7d71d2d94e60305c40f7e86d41014 *src/include/igraph_random.h
+4e29c5978f5d5e8c3cc51002caeaecde *src/include/igraph_scan.h
320603e1a9f5f6b5d9564f933fc70282 *src/include/igraph_scg.h
-1c38c4ad71bc32f3701965af38c42035 *src/include/igraph_separators.h
+f0dff906f7eefb0e05c6fb787192ca7b *src/include/igraph_separators.h
77af613883e73a35e659d57940a0ad08 *src/include/igraph_sparsemat.h
-817c003ae01fb4cee9c8412545ffacd6 *src/include/igraph_spmatrix.h
-3a1098682a2b8318c1d040237e730872 *src/include/igraph_stack.h
-961b488b4455466255c740b779ffd37d *src/include/igraph_stack_pmt.h
-161ecbcf55c9af968ba800562168695a *src/include/igraph_statusbar.h
-ae8f253b9c1ebb15d454116b4af0c247 *src/include/igraph_structural.h
-325e434438ca624456bfa3e7e675c036 *src/include/igraph_strvector.h
-54813dc234e4b95869093015fa9eab9f *src/include/igraph_threading.h.in
-d22c3634d4677a6585641cd8c463887d *src/include/igraph_topology.h
-9066c301497c3f3c34d31cb2a71329f9 *src/include/igraph_transitivity.h
-7f2373fa6dfb143ea9e3a5cdd4d5ad85 *src/include/igraph_types.h
-577c03aaaa1f82a272c35381af3ad910 *src/include/igraph_vector.h
-383762630cb8bf896dda3d74e16d5173 *src/include/igraph_vector_pmt.h
-64f1a9c71d6f9b2c68f09d63540c231e *src/include/igraph_vector_ptr.h
+518fa1cce77c5716c3eede6bfb85c4db *src/include/igraph_spmatrix.h
+d7670fedfb54c946d0b5c3b49de6f29e *src/include/igraph_stack.h
+0ec8e445a707456786fe923cf713e0ee *src/include/igraph_stack_pmt.h
+ec210a55193a8dbebbc8b696388dd66e *src/include/igraph_statusbar.h
+0db0faaf2b5b27f3f1acd455406f994d *src/include/igraph_structural.h
+9ff3e263ef874fcb86b2e64f8fb314f7 *src/include/igraph_strvector.h
+3ddb62acc79793027a3a080dce9e4944 *src/include/igraph_threading.h.in
+1df04917c52097285d7582d0d777f2e2 *src/include/igraph_topology.h
+828fb14f89518cd2c7c67f83c3932a38 *src/include/igraph_transitivity.h
+3bad9fef1bb4e076a789e6232b0ffed4 *src/include/igraph_types.h
+44d28cae8836814959c5432513815a33 *src/include/igraph_vector.h
+f8ca736112f2dd18d1642c1d12751397 *src/include/igraph_vector_pmt.h
+d7714d256605e29a7e1d26004ad01559 *src/include/igraph_vector_ptr.h
58c8dccae0eda3cbda698d40a73c5deb *src/include/igraph_vector_type.h
-2342032bb31be02392e38f58c90fde46 *src/include/igraph_version.h.in
-050ea429bcfd86ad679748fa9cbaa8b6 *src/include/igraph_visitor.h
+d6b0b1202056041712190dee1e95902b *src/include/igraph_version.h.in
+fb7795744937901c3130cd8a5d4222b5 *src/include/igraph_visitor.h
0ceee7df894ce42f555f5effe0240702 *src/infomap.cc
d7095b8ca721c2507d81152d722308e8 *src/infomap_FlowGraph.cc
bbf84d35c2016510d97be2b41be84017 *src/infomap_FlowGraph.h
@@ -1219,32 +1084,33 @@ bbf84d35c2016510d97be2b41be84017 *src/infomap_FlowGraph.h
75a431e98e5b7b785bc372f211d432d0 *src/infomap_Greedy.h
7edc0e07208e9487e1fb8656d6493ec5 *src/infomap_Node.cc
9df7c5839a5cf0aa081a637ea9389446 *src/infomap_Node.h
+1eb40fbf0a581bddadec6d0faf8c685f *src/init.c
14be091d75db4df0c8261c571a3c235f *src/interrupt.c
491b61dbc3c8a265485f6b29eb5b84aa *src/iterators.c
e9e8f2dac33c5cc7bfe1da70a95cc05f *src/ivout.f
-5e6f8a30ab44c555920fb5e190ee48d4 *src/lad.c
+78de777e574d89c1f3bb0a6f25f9bccf *src/lad.c
f95ab29a3f1862dc2133f145ef2b8387 *src/lapack.c
-944bc5f5cdc345aebd7988a9b76b7fe6 *src/layout.c
-4f7b469bb975af226464e9566c043569 *src/layout_dh.c
-e9f5de5a325c01c520ac96f81ae8aa19 *src/layout_fr.c
-6bd4b13078318989464833728953da47 *src/layout_gem.c
-9a12cc013eec9145c563599e69c9f6b0 *src/layout_kk.c
-1080de49342aac0ca288d2db820e22bd *src/lazyeval.c
+a7df6e16bbf2c8daee0f5392b3d04dc1 *src/layout.c
+a4d2a269bb68cd053e9346dddf368584 *src/layout_dh.c
+1e43eb788e8bafae353dd0f127609418 *src/layout_fr.c
+13624439921d6e2b5a0c72731f0cec17 *src/layout_gem.c
+9fa436dd96c8eaccf4f2a3a6f219b5e2 *src/layout_kk.c
+7881243c282b5f14b81c3a652e02d111 *src/lazyeval.c
201a9c70e7ebac764daf2578e9753397 *src/lsap.c
-fbbb25d689af1199a667bb5dbc2c11b3 *src/matching.c
+14545fd5a7696734b84b8c7277347ff3 *src/matching.c
6235a73cc32cfaad6c3413719e36d16c *src/math.c
57dbb4060ac063511e83d2c23c04c1e0 *src/matrix.c
4ff709482db7e3630c81937607e072b1 *src/matrix.pmt
6f99b8e27ee426917236833013db4ce5 *src/maximal_cliques.c
09c8159e923bc5d13cb081d6f8c4657a *src/maximal_cliques_template.h
-4ae56c99425d054546ce50eee102c70d *src/memory.c
-38fc41da5fa51c0be97f084498a9d8d5 *src/microscopic_update.c
+d276cc56bd81d89acb004d9f1ac56236 *src/memory.c
+67b0710d886724edb73cdc3be8f9d876 *src/microscopic_update.c
8a97bea8b83111ca8fb2f2886db91fc1 *src/mixing.c
-2abdabfdf646e8dc092679df31ecd5e4 *src/motifs.c
+2fbaa3b96fe70f50291706b827a55a1b *src/motifs.c
8abad248bfc770d94c3496b6426a531e *src/operators.c
13711e38459b1fc13a31384f665405d7 *src/optimal_modularity.c
7f4dba9bcfbe0db2a808ba15ab2f9329 *src/other.c
-d27219d9ea7116704ecd446de3502e9b *src/paths.c
+3715e9fefcdddbce4e9be24490cbd077 *src/paths.c
a6595cc90c64e0aab7a336856a219e53 *src/plfit/arithmetic_ansi.h
098651533f8c80ffeef3d3e43bf39783 *src/plfit/arithmetic_sse_double.h
896685565ace49c58c8587e52c9fdfcb *src/plfit/arithmetic_sse_float.h
@@ -1263,19 +1129,19 @@ ec39eb232b03766144d5ce70434cd470 *src/plfit/plfit.h
e7ea89c52ae68ed4acd40cee7848cc98 *src/plfit/plfit.inc
23aa3f72d6724222f7563bb22fa011df *src/plfit/zeta.c
2cb90ff85be06e53110d04f2ee7574e3 *src/plfit/zeta.h
-5219cdfa910aac54c77dc3ba3d87105b *src/pottsmodel_2.cpp
+cbdfab62d68296ad1ac2197dc1a7f567 *src/pottsmodel_2.cpp
b39bce59a0e9fdfe1b028aca69f040d3 *src/pottsmodel_2.h
3b4575360f029b448db3946a22672a8d *src/progress.c
-09ff2ff1c1daad014e1b03bc2ea1f3b1 *src/prpack.cpp
+bf3a89b33370546ff924815b517926b5 *src/prpack.cpp
f239c9f27078f7fc0ade177796514f7a *src/prpack.h
9cdd08531c091877493dc38d6d9a76a6 *src/prpack/prpack.h
d270166efd776ce2b037b5e33c9e65c9 *src/prpack/prpack.inc
0bd04ba0eae9e7e3c81786f64d64f5d7 *src/prpack/prpack_base_graph.cpp
9204c4b68e204d547368fe45215f1933 *src/prpack/prpack_base_graph.h
-11ef113ef2afa4d58490fcd2b150c070 *src/prpack/prpack_csc.h
+981c6153aaed917674373a7f848d33af *src/prpack/prpack_csc.h
6dd85cebd13f0a8636f2410131e7a096 *src/prpack/prpack_csr.h
16f1218cac357f6853a1ef4a56a97a1e *src/prpack/prpack_edge_list.h
-13554f0c55678a78ba701e20669282db *src/prpack/prpack_igraph_graph.cpp
+8c1c34c537ac91600dd9bb6dde40e298 *src/prpack/prpack_igraph_graph.cpp
f4725104dcd769f5b8c536e1e7e7a629 *src/prpack/prpack_igraph_graph.h
4d3341314d147c7713eabf7bf2b28808 *src/prpack/prpack_preprocessed_ge_graph.cpp
23b18b1935c305ff6f8ea72ace07fcb0 *src/prpack/prpack_preprocessed_ge_graph.h
@@ -1288,7 +1154,7 @@ b1c479ed32faf5a58f406615ce6f48bd *src/prpack/prpack_preprocessed_scc_graph.h
f705b565d4dc23052d5ec58dc2f63d33 *src/prpack/prpack_preprocessed_schur_graph.h
7dbb50744056002b707ae5232924d448 *src/prpack/prpack_result.cpp
9a2d350363928141ef4785e6f0e2cfd5 *src/prpack/prpack_result.h
-041cf12b9a1bf4bf64970211f15b1318 *src/prpack/prpack_solver.cpp
+d3bbd80d26189bd89221be9eae9685f8 *src/prpack/prpack_solver.cpp
aa69309ad88c68bd3aef2d3b9f78d8ac *src/prpack/prpack_solver.h
3108bd08055e25c22b24cd7aee26f8c5 *src/prpack/prpack_utils.cpp
d8e4562102dd19aa2b0ebb8b9ffc761a *src/prpack/prpack_utils.h
@@ -1297,11 +1163,11 @@ d8e4562102dd19aa2b0ebb8b9ffc761a *src/prpack/prpack_utils.h
f9a82bcf4a3a750ab39528bc8d304053 *src/qsort_r.c
e786dc518261ef5f38e1baba523457ab *src/random.c
b0e44ade8f91b8ea8609d6f7d54d2ae5 *src/random_walk.c
-391ab7cd3f42decd92736699cbda417f *src/rinterface.c
+c983b4ef45ba2344ef4966ba8cbb96db *src/rinterface.c
55c344dc2daf18e33b5e11a248013759 *src/rinterface.h
-8ded947de0b87f80bf2ca9191dd2f0b1 *src/rinterface_extra.c
-e14049547150220f7e9adbbe7d498d89 *src/sbm.c
-6e1336d05a0466d5c0cc830116a22eaf *src/scan.c
+63b9199bb474d623e913a480111ece06 *src/rinterface_extra.c
+9ff59160d545d276ac2419396cd07b77 *src/sbm.c
+57c6afe96c89270e09ba578385afcca1 *src/scan.c
aea038197b2d7bf291ffae04eb916e1e *src/scg.c
0c45c2990b0c5da3975c486a76988a88 *src/scg_approximate_methods.c
57172adf7c8ab509ba78ca5249e491dc *src/scg_exact_scg.c
@@ -1309,15 +1175,15 @@ f02cb493011fc03a7afd0f73429e7444 *src/scg_headers.h
026c19e5e315a61afa720d1a1a02b2b2 *src/scg_kmeans.c
689526007c1e806566487866a1507dfd *src/scg_optimal_method.c
bd4eee538520a213640c06c511215412 *src/scg_utils.c
-fe76b21dffc13a149499515906044064 *src/second.f
-900f269653a3550d5804bdd246d46e80 *src/separators.c
+86e001901ddbd58540c49d9e1440358e *src/second.f
+8d56d35bdce5f2672a17d82fbd9a66f2 *src/separators.c
af447f07a45af2b4f7edaee5d0a877a7 *src/simpleraytracer/Color.cpp
be39147aa9a658a401d5d8e304bfbb68 *src/simpleraytracer/Color.h
605d507fd74ae304c92e9a08d23443fa *src/simpleraytracer/Light.cpp
a06dcdf977661620d9a30542d0708979 *src/simpleraytracer/Light.h
b9106690e86aab37621da51d42ba6673 *src/simpleraytracer/Point.cpp
a62fbead2d3a236d5303cc9085c8b2eb *src/simpleraytracer/Point.h
-8106fda17eb6d6f99a80f111d30d3ac5 *src/simpleraytracer/RIgraphRay.cpp
+1dd5be0de737299119ccbcde22702bb7 *src/simpleraytracer/RIgraphRay.cpp
a799c64d3087459d00e419f3fe8d6570 *src/simpleraytracer/Ray.cpp
2e3885be19867ed6a3562aeadf9e5271 *src/simpleraytracer/Ray.h
1feae5499e54a7b2015c14e67dbf25e7 *src/simpleraytracer/RayTracer.cpp
@@ -1334,20 +1200,21 @@ fc6fc5c9aa5a5187e6a2b1643f72ed4a *src/simpleraytracer/unit_limiter.cpp
10c5f89c9426685c966b72e159221f1a *src/simpleraytracer/unit_limiter.h
2afac75f121c2b327f3a2310c2d2cfb8 *src/sir.c
eee880ddc507c1a7add8ffa2a86ffc78 *src/spanning_trees.c
-f58958b871663e26442111eb4242f114 *src/sparsemat.c
+5650b3b4026735368885edeb7a2a9b20 *src/sparsemat.c
6bb03a8313135637cc13b229466c5fb2 *src/spectral_properties.c
c09d0e9140d619f214444c71395afbe6 *src/spmatrix.c
eca023c1e47dc08d757a306ce363251c *src/st-cuts.c
6900ecd75c77fa349fd21b96ac3948cf *src/stack.pmt
b5163c86a9a4ff980ad7a02f9303d2b7 *src/stat.h
0a0892716e6bfe89fa6cccb8d9685b2f *src/statusbar.c
-70c0a6a6052cf99b350d710849b1a4ef *src/structural_properties.c
-9bf218baeb55418532e13ff952319dbb *src/structure_generators.c
+27f32259a23155957327848bdc703dbc *src/structural_properties.c
+4b25fd34efc37a6b0a490e9f6c046cff *src/structural_properties_internal.h
+9e40c726081420d388e187f8d0fbadeb *src/structure_generators.c
8fa4711e4da6193579f9dda3dda2b5d6 *src/sugiyama.c
-b75142ca495ff1275ac3ffd5982d853b *src/topology.c
-50ad754b8d0b5dd84e7083b1e4b434c1 *src/triangles.c
-279f73c47d166d3c9a7a8a46677163aa *src/triangles_template.h
-72543eb9f61505227afa82bcd98a9aab *src/triangles_template1.h
+f97445842b82e98c855b014788b70de5 *src/topology.c
+8637a769b8bfd68002637252da0ea70e *src/triangles.c
+5b20a3297338f3156a70a9ad255eb74d *src/triangles_template.h
+7f3088b31e11c80c0de807760fa173ce *src/triangles_template1.h
2475f0aeb10d27edef133c0533a11d63 *src/type_indexededgelist.c
79ff3df7bfa26151b9893cffeba4d002 *src/types.c
cfb66084ea2bfc7648ab47ed1018e8a4 *src/uuid/COPYING
@@ -1358,7 +1225,7 @@ c733862ac29e8bbd01a49b5ac7d4a780 *src/uuid/Makevars.in
d2b39a0b3d72632db235a9c6d36ef344 *src/uuid/compare.c
76087d772af7d37cab53b1a56cf72ade *src/uuid/config.h.in
d0026e30bb2f3feb7ac1db9827dd4820 *src/uuid/copy.c
-50e3c817e70104f83a75afb978071f5f *src/uuid/gen_uuid.c
+0bf618d5e3f7bbff90c60455fa89b697 *src/uuid/gen_uuid.c
7374a713629b202c4fb82d650e510acb *src/uuid/isnull.c
b671656493c2119636a4e981e9aad857 *src/uuid/pack.c
dcc91eb622c08bf2fca11680c71b92cc *src/uuid/parse.c
@@ -1369,8 +1236,8 @@ e51bd355555086e18222fbe3dff9d59f *src/uuid/unparse.c
aad9fd83e8f3cc7eb80e2ab0b2c4f84c *src/uuid/uuidd.h
9e16418d043b96a6061ffb43150c5abd *src/uuid/win32/config.h
b345cf8deb9563717b23547730686212 *src/vector.c
-97226f108c97b7abda68537cfdcb3c8a *src/vector.pmt
-50416ee45e4b1e7e1c465d3c440963aa *src/vector_ptr.c
+8749146ce7952b9a4fbf34ed6b814d83 *src/vector.pmt
+6911588db261b2ab842d009b28d8d902 *src/vector_ptr.c
86dd274efc3061285ec0d3930f21fc2f *src/version.c
e593dc778e53754657c788127e1a1ab0 *src/visitors.c
3e539674df5de90da12ae880863af9c6 *src/walktrap.cpp
@@ -1381,3 +1248,156 @@ d4677977768e0f15fb39a1d42bb4a7e7 *src/walktrap_communities.h
4708174b9d0a7ad332731d356b1f51fd *src/walktrap_heap.cpp
50c30f2b5e618bc971622ee539994586 *src/walktrap_heap.h
5125d305fe99bd9f8a0f550eb758a30f *src/zeroin.c
+69ac2fe32f6046d4f6bb82ac12d76d42 *tests/testthat.R
+3a5ec4e3cc8d87587b31237c5541f86e *tests/testthat/celegansneural.gml.gz
+28cd0567bf26075c39c14d11c4c829aa *tests/testthat/dyad.census.R
+34d03342fd57be47bdcf3079baea1efa *tests/testthat/football.gml.gz
+157659d4b0f46abf1b2893b2e52a9fc1 *tests/testthat/power.gml.gz
+d44acbb3efd8c507e3dbb2004a4dc52f *tests/testthat/test-constructor-modifiers.R
+222570e74d422f0698d5b13a9ab876e1 *tests/testthat/test-graph-ids.R
+1a0309528fa3062366defba21221c741 *tests/testthat/test-index-es.R
+4788e269746f1dab1c81dd3c451e25ba *tests/testthat/test-isomorphism.R
+72eaaa03dc1634f01b6627dc4b579331 *tests/testthat/test-make.R
+69b30e1a71abb8ba4183e53802995c5a *tests/testthat/test-make_graph.R
+22c63ccc32ad7bcc1ca5858e1f7682f1 *tests/testthat/test-new-layout-api.R
+3c946c65dbee1987ac5fd0991ab4cbdd *tests/testthat/test-notable.R
+7687fdcb891047a342172e1feab863b5 *tests/testthat/test-old-data-type.R
+f4383004c3666fcdda76b140c9be5f91 *tests/testthat/test-random_walk.R
+9611d2c9cb947b58c40443fe2368bbc3 *tests/testthat/test-version.R
+ec4d2c7247fdbb3cb6e5f8299d51925d *tests/testthat/test-versions.R
+9f5cff46fd4d9d30ce1849ced84a6c9d *tests/testthat/test-vs-es-printing.R
+89c1da084e2516de1600992f2c91adbc *tests/testthat/test-vs-es-quirks.R
+ec51b0fd41e6535ff41a81d3855e0b45 *tests/testthat/test-vs-es.R
+b0783b265ed1ce213fc45bfc8ef0abf6 *tests/testthat/test-vs-operators.R
+4c1ba73219c8dfd973fc878c0e2ed3b7 *tests/testthat/test-weakref.R
+85ec5222dcf11a56e1c119cefcd8c9d1 *tests/testthat/test_add.edges.R
+9d640d7ac3411dad252fa61e191968fd *tests/testthat/test_add.vertices.R
+13cae003d2c04d379736320d7dac41f9 *tests/testthat/test_adjacency.spectral.embedding.R
+b93a3944e3c6b752dac2e225ce10d2ea *tests/testthat/test_all.st.cuts.R
+542a9710d4d20713093a35d9b5000c7a *tests/testthat/test_alpha.centrality.R
+505493c56ee9fd269286cf68a3701fd7 *tests/testthat/test_are.connected.R
+1186c6125dd7536cc593a14912cacb2a *tests/testthat/test_arpack.R
+e282694af0f688cb034709e529f70ea2 *tests/testthat/test_articulation.points.R
+8979b7079adec68a4eebc1fdcfec25b8 *tests/testthat/test_as.directed.R
+e48a4e35ddf3d28d072f439de1eb0499 *tests/testthat/test_as.undirected.R
+3d24bf6e4a3f12e23306a6075f786b84 *tests/testthat/test_assortativity.R
+795eb9d342b6953248fd9578ad6f4868 *tests/testthat/test_attributes.R
+8b60ef73553267334628adff510abcb0 *tests/testthat/test_authority.score.R
+3809cd4a3febab2fe0a453bc8cabc030 *tests/testthat/test_average.path.length.R
+6b49e3650ff1719aa1f44db76b47ba4d *tests/testthat/test_ba.game.R
+0a5a3daca2a7c84fcebfbe44f771f794 *tests/testthat/test_betweenness.R
+4f381a3bdebfbf215316ec09037f3c02 *tests/testthat/test_biconnected.components.R
+5082b11e39d7b485770e6400656841e7 *tests/testthat/test_bipartite.projection.R
+6a8d5c5cba60d5c0bcc9087023ec8cad *tests/testthat/test_bipartite.random.game.R
+8582a01c00fe03d6cc8336be5ea1555d *tests/testthat/test_bonpow.R
+3a8a8485e09a9be56b8aa61943d1b2cf *tests/testthat/test_bug-1019624.R
+a0f71df068480720e927de8b86f061d9 *tests/testthat/test_bug-1032819.R
+6de97cc0e6c5f0eccb17bcebed244070 *tests/testthat/test_bug-1033045.R
+254a3cf2d08007ad5803d244a99abdfb *tests/testthat/test_bug-1073705-indexing.R
+8eb54ffc45a7662db609689ab1da7ee2 *tests/testthat/test_bug-1073800-clique.R
+2c96af4031e6a3b8b018a8ce8735eb07 *tests/testthat/test_canonical.permutation.R
+f254ac34fc9203ce26ad62ed19d30976 *tests/testthat/test_cliques.R
+ac1d66133bea5969e51bd75e13c354d8 *tests/testthat/test_closeness.R
+c45762e40c0ee3cb70d305d06db47f0d *tests/testthat/test_clusters.R
+8d2c03d0914792d2f1679d3909be2a18 *tests/testthat/test_communities.R
+4a2a8e80da2d290077446c5cccca7998 *tests/testthat/test_constraint.R
+2786c19359b36de1d6c2d90c305fde9e *tests/testthat/test_contract.vertices.R
+a4762ac8213e2d36626defccac985e1a *tests/testthat/test_correlated.R
+df25b65676954132724105f0c45d76fc *tests/testthat/test_count.multiple.R
+401b5276d52c308093b1d9ebf252ec66 *tests/testthat/test_decompose.graph.R
+3bce5671201a06ebd58d90ad350a01a8 *tests/testthat/test_degree.R
+5512dce75135fa587c083313a70c6b19 *tests/testthat/test_degree.sequence.game.R
+8ceeede3d4b00fd625b2f111a1ce60af *tests/testthat/test_delete.edges.R
+a2667985a9407d55df61cd8b56c58b5d *tests/testthat/test_delete.vertices.R
+6fef9d7dba6ac8269458d0d5764e0052 *tests/testthat/test_diameter.R
+c5526915b4f853835809c7fb5898822f *tests/testthat/test_dimSelect.R
+94f8ad23a61bb3dc9d46ff310b712611 *tests/testthat/test_dominator.tree.R
+541d7ff02723427f2026be1a0eb7a737 *tests/testthat/test_dot.product.game.R
+5d9a8a58619b8bb5c7645e2a4dbbc309 *tests/testthat/test_dyad.census.R
+faf67f6d469e7e3ccf0e78ea4096d660 *tests/testthat/test_edge.betweenness.R
+82fe00c577b8f8ec3430f7848f2c2fd8 *tests/testthat/test_edge.betweenness.community.R
+078a1606ee3392ef9d8408b2b146ab60 *tests/testthat/test_edge.connectivity.R
+fecffc869c851602342b441a3a418b77 *tests/testthat/test_edgenames.R
+4781c4417c2f526009605d601b832ba6 *tests/testthat/test_evcent.R
+85edbfa6a1db6972776e62292a19dc8b *tests/testthat/test_fartherst.nodes.R
+80cf1f5676bd09a700e490ed4b439cfb *tests/testthat/test_fastgreedy.community.R
+542aafbf6ff22a659f339ea8ffff8276 *tests/testthat/test_forestfire.R
+36eccc1dd3d999a3941e7d034d1e6d17 *tests/testthat/test_get.adjacency.R
+50bebe4a8abd9402f1e335bcc2d7aefc *tests/testthat/test_get.adjlist.R
+51873b120dd3fd8fba64430e3a5daec8 *tests/testthat/test_get.all.shortest.paths.R
+849cff0f46c9170797641ba66cba5595 *tests/testthat/test_get.diameter.R
+c4ba0a587f9530519bf13ea2acb58843 *tests/testthat/test_get.edge.R
+f9249efa32145fc1c8c12a36f945cbdf *tests/testthat/test_get.edgelist.R
+ded360a0009f7c4f67dc2b0352a0fb8a *tests/testthat/test_get.incidence.R
+713863c8a73e169cd24293f85d08fc74 *tests/testthat/test_get.shortest.paths.R
+03b481f55a65183b3b0e8ad203897960 *tests/testthat/test_girth.R
+f2214f9cf209e9878e4da3c57232f17f *tests/testthat/test_graph.adhesion.R
+6616d546c5d1fc6e253cde6c4fdee6db *tests/testthat/test_graph.adjacency.R
+f7f7d009ae1a05610d9410b8bcc9d3a5 *tests/testthat/test_graph.adjlist.R
+9ba1d7ad6342b0bef83bf1aaa52aae50 *tests/testthat/test_graph.atlas.R
+cf3ba37d89177cbbdc45c3c175355921 *tests/testthat/test_graph.bfs.R
+499b455adea86ee71817783a4a65f577 *tests/testthat/test_graph.bipartite.R
+879c434fba2bfd905c539be92ebe91fa *tests/testthat/test_graph.complementer.R
+c13bf09188f949377f0eac6d68a84042 *tests/testthat/test_graph.compose.R
+2aa42f162d1bcb6b9582281130432efb *tests/testthat/test_graph.coreness.R
+5f4e9c1eb0d4699236654074358b5115 *tests/testthat/test_graph.data.frame.R
+68161b1dacafdfeef13eccd9efd7ae5f *tests/testthat/test_graph.de.bruijn.R
+8723a905ccf9bd8987926a579d0442a5 *tests/testthat/test_graph.density.R
+de6d23c1d3d6e7b16d3159f56185e434 *tests/testthat/test_graph.edgelist.R
+df43bbc9223f5d6496e5715f1881abd6 *tests/testthat/test_graph.eigen.R
+f894160c868e9392d2727cf9a6dc5af6 *tests/testthat/test_graph.formula.R
+e2efb24c4db5b274ac18017ed480d2d9 *tests/testthat/test_graph.isoclass.R
+6f3d4507996dbcc43920adce657a738f *tests/testthat/test_graph.kautz.R
+0a80082ebc39ec4cdca090a3e1c11c67 *tests/testthat/test_graph.knn.R
+9d869da1cc161a645c293d10dc341590 *tests/testthat/test_graph.maxflow.R
+1159c879ec2285bbaa08209a1d2c5add *tests/testthat/test_graph.mincut.R
+530fba9e8d790c38aca699b1a568de00 *tests/testthat/test_graph.subisomorphic.lad.R
+eb55c1cd65d26a7530d9460ec396dfb2 *tests/testthat/test_graph.subisomorphic.vf2.R
+eba8e06baddc6b0a8ddfbe7e48cebac2 *tests/testthat/test_graphNEL.R
+23d6a1e8db6602fd9b120b24b39725f1 *tests/testthat/test_graphlets.R
+3e58a33bfda76293340465d7aac08c86 *tests/testthat/test_hrg.R
+a570ca5f125efa4d98d030585f2004d2 *tests/testthat/test_hsbm.R
+534070cbc470a2fcc3bc59095ee11e6f *tests/testthat/test_igraph.options.R
+026f3752506a2ec286066504e9d37a85 *tests/testthat/test_independent.vertex.sets.R
+e466a39d382b5505b953292b62c50366 *tests/testthat/test_indexing.R
+ff070d086e04573751eb22de047f4b7c *tests/testthat/test_indexing2.R
+c78a920d52351d67639476e2aac25a8d *tests/testthat/test_indexing3.R
+7748209eb0003b8d2c5d4ee90606878e *tests/testthat/test_is.bipartite.R
+d501b567e3e573c4d999ac1ace4bb665 *tests/testthat/test_is.chordal.R
+52138bea453eda91c667da3742007912 *tests/testthat/test_iterators.R
+764d5cb76819f0a268562b2f6f59f82b *tests/testthat/test_label.propagation.community.R
+c8c475e2e86016609574169e78c716ea *tests/testthat/test_laplacian.spectral.embedding.R
+418d9fcc91a880b0fb839eb0fe002a41 *tests/testthat/test_largest.cliques.R
+fce5463a31d7da19e21761e1d3bfbe9d *tests/testthat/test_largest.independent.vertex.sets.R
+76c4bcfe67ae3b21a0aef80ef6db25be *tests/testthat/test_layout.fr.R
+bfeeecbfd9aeea87ba0c0b2cae9f627c *tests/testthat/test_layout.kk.R
+6a2aed874635751a944a0f28f08f2c9a *tests/testthat/test_layout.mds.R
+7e921347ce3b1b198f167e574067d1db *tests/testthat/test_layout.merge.R
+dea0f7483ea375c42c7a00e6217a09eb *tests/testthat/test_leading.eigenvector.community.R
+b373b6fd97fabb47114c76e104fa86bb *tests/testthat/test_maximal_cliques.R
+751e142d0005412034ca097b97c9a153 *tests/testthat/test_minimal.st.separators.R
+e376dbc01376d61de29507390ea4a4a0 *tests/testthat/test_minimum.size.separators.R
+27b029baf39ed4c32ba0d69d5f7ed5a0 *tests/testthat/test_modularity_matrix.R
+76e7ce19e8352b279c775ebed2f69153 *tests/testthat/test_motifs.R
+993e177c45db6a718a6784b34330c659 *tests/testthat/test_multilevel.community.R
+46d54173d41a303f3390ca543721ccb5 *tests/testthat/test_neighborhood.R
+9f34f2b64e709ee9d3d3069464f88c15 *tests/testthat/test_neighbors.R
+24cbc821daf29547b37847071891286a *tests/testthat/test_operators.R
+46c39f7c2bed29cc43dc7ce9cfefa10b *tests/testthat/test_operators3.R
+b45cd48a81d66aec4e4c28a9bd9da016 *tests/testthat/test_operators4.R
+de9a71750cfede9c47f11418dd2bd351 *tests/testthat/test_optimal.community.R
+560990b6b9e50c3585297bbea2a8313b *tests/testthat/test_pajek.R
+89b900f0d5dd8a0d46c1d9010d9c93f2 *tests/testthat/test_print.R
+acfd49645b89a10f93eab7ea814815eb *tests/testthat/test_psumtree.R
+c16adef7ce46505194e165e819a6ee7f *tests/testthat/test_sample.R
+071bf3fb054279e535ccb9936ecb1944 *tests/testthat/test_sbm.game.R
+5996191f90b8e86be20a5840a2089aa1 *tests/testthat/test_scan.R
+9274bc5af61b2058a08fe4d377aedab0 *tests/testthat/test_sdf.R
+307c4bdb58bd0229816f4363a5b12186 *tests/testthat/test_sgm.R
+5ececc4dc384fa67819917344078e366 *tests/testthat/test_sir.R
+802bc718931dca81b4750a5e028fc945 *tests/testthat/test_sphere.R
+f7f321f4b3ae913bf5ff88ee468b21af *tests/testthat/test_transitivity.R
+59b470781b4cbb8184b85b2f292cc9a0 *tests/testthat/test_triangles.R
+7f8ca4c58a09baf998e26774fc6a6290 *tests/testthat/test_unfold.tree.R
+2426bc82153054e1f00534d6c81e47b9 *tests/testthat/test_walktrap.community.R
+d8d7a03abfc121b96fad591afb9fbca7 *tests/testthat/test_watts.strogatz.game.R
diff --git a/NAMESPACE b/NAMESPACE
index 04daa57..0ac2fbd 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,4 +1,4 @@
-# Generated by roxygen2 (4.1.1): do not edit by hand
+# Generated by roxygen2: do not edit by hand
S3method("$",igraph)
S3method("$",igraph.es)
@@ -38,6 +38,9 @@ S3method(compare,membership)
S3method(difference,igraph)
S3method(difference,igraph.es)
S3method(difference,igraph.vs)
+S3method(graph_id,igraph)
+S3method(graph_id,igraph.es)
+S3method(graph_id,igraph.vs)
S3method(groups,communities)
S3method(groups,default)
S3method(intersection,igraph)
@@ -72,7 +75,6 @@ S3method(rglplot,igraph)
S3method(scg,Matrix)
S3method(scg,igraph)
S3method(scg,matrix)
-S3method(str,igraph)
S3method(summary,cohesiveBlocks)
S3method(summary,igraph)
S3method(time_bins,sir)
@@ -139,7 +141,6 @@ export(as_adjacency_matrix)
export(as_bipartite)
export(as_data_frame)
export(as_edgelist)
-export(as_graphnel)
export(as_ids)
export(as_incidence_matrix)
export(as_long_data_frame)
@@ -432,11 +433,11 @@ export(graph_from_atlas)
export(graph_from_data_frame)
export(graph_from_edgelist)
export(graph_from_graphdb)
-export(graph_from_graphnel)
export(graph_from_incidence_matrix)
export(graph_from_isomorphism_class)
export(graph_from_lcf)
export(graph_from_literal)
+export(graph_id)
export(graph_version)
export(graphlet_basis)
export(graphlet_proj)
@@ -452,6 +453,7 @@ export(growing.random.game)
export(gsize)
export(has.multiple)
export(head_of)
+export(head_print)
export(hierarchical_sbm)
export(hierarchy)
export(hrg)
@@ -490,6 +492,7 @@ export(igraphtest)
export(in_circle)
export(incident)
export(incident_edges)
+export(indent_print)
export(independence.number)
export(independent.vertex.sets)
export(induced.subgraph)
@@ -530,6 +533,7 @@ export(is_matching)
export(is_max_matching)
export(is_min_separator)
export(is_named)
+export(is_printer_callback)
export(is_separator)
export(is_simple)
export(is_subgraph_isomorphic_to)
@@ -689,6 +693,8 @@ export(predict_edges)
export(pref)
export(preference.game)
export(print.igraph)
+export(print_all)
+export(printer_callback)
export(r_pal)
export(radius)
export(random.graph.game)
@@ -852,6 +858,7 @@ export(with_fr)
export(with_gem)
export(with_graph_)
export(with_graphopt)
+export(with_igraph_opt)
export(with_kk)
export(with_lgl)
export(with_mds)
@@ -863,9 +870,53 @@ export(without_multiples)
export(write.graph)
export(write_graph)
import(methods)
+importFrom(grDevices,as.raster)
+importFrom(grDevices,col2rgb)
+importFrom(grDevices,dev.new)
+importFrom(grDevices,palette)
+importFrom(grDevices,rainbow)
+importFrom(graphics,barplot)
+importFrom(graphics,hist)
+importFrom(graphics,layout)
+importFrom(graphics,layout.show)
+importFrom(graphics,legend)
+importFrom(graphics,lines)
+importFrom(graphics,par)
+importFrom(graphics,plot)
+importFrom(graphics,polygon)
+importFrom(graphics,rasterImage)
+importFrom(graphics,segments)
+importFrom(graphics,symbols)
+importFrom(graphics,text)
+importFrom(graphics,xspline)
+importFrom(graphics,xyinch)
importFrom(magrittr,"%>%")
+importFrom(pkgconfig,get_config)
+importFrom(pkgconfig,set_config)
+importFrom(pkgconfig,set_config_in)
+importFrom(stats,IQR)
importFrom(stats,as.dendrogram)
importFrom(stats,as.hclust)
+importFrom(stats,ave)
+importFrom(stats,coef)
importFrom(stats,median)
+importFrom(stats,na.omit)
importFrom(stats,quantile)
-useDynLib(igraph)
+importFrom(stats,rect.hclust)
+importFrom(stats,reorder)
+importFrom(stats,runif)
+importFrom(stats,sd)
+importFrom(stats,vcov)
+importFrom(utils,URLencode)
+importFrom(utils,browseURL)
+importFrom(utils,capture.output)
+importFrom(utils,edit)
+importFrom(utils,head)
+importFrom(utils,packageDescription)
+importFrom(utils,packageName)
+importFrom(utils,read.table)
+importFrom(utils,setTxtProgressBar)
+importFrom(utils,tail)
+importFrom(utils,txtProgressBar)
+importFrom(utils,write.table)
+useDynLib(igraph, .registration = TRUE, .fixes = "C_")
diff --git a/R/adjacency.R b/R/adjacency.R
index d4a110e..24a8b5f 100644
--- a/R/adjacency.R
+++ b/R/adjacency.R
@@ -50,10 +50,9 @@ graph.adjacency.dense <- function(adjmatrix, mode=c("directed", "undirected", "m
stop("not a square matrix")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_weighted_adjacency", adjmatrix,
- as.numeric(mode), weighted, diag,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_weighted_adjacency, adjmatrix,
+ as.numeric(mode), weighted, diag)
} else {
adjmatrix <- as.matrix(adjmatrix)
@@ -63,9 +62,8 @@ graph.adjacency.dense <- function(adjmatrix, mode=c("directed", "undirected", "m
if (!diag) { diag(adjmatrix) <- 0 }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_graph_adjacency", adjmatrix, as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_graph_adjacency, adjmatrix, as.numeric(mode))
}
res
diff --git a/R/attributes.R b/R/attributes.R
index 96bdc2f..5eed848 100644
--- a/R/attributes.R
+++ b/R/attributes.R
@@ -57,8 +57,7 @@ graph_attr <- function(graph, name) {
if (missing(name)) {
graph.attributes(graph)
} else {
- base::.Call("R_igraph_mybracket2", graph, 9L, 2L,
- PACKAGE="igraph")[[as.character(name)]]
+ .Call(C_R_igraph_mybracket2, graph, 9L, 2L)[[as.character(name)]]
}
}
@@ -117,8 +116,7 @@ set_graph_attr <- function(graph, name, value) {
stop("Not a graph object")
}
- base::.Call("R_igraph_mybracket3_set", graph, 9L, 2L, name, value,
- PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket3_set, graph, 9L, 2L, name, value)
}
#' @export
@@ -127,8 +125,7 @@ graph.attributes <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- base::.Call("R_igraph_mybracket2_copy", graph, 9L, 2L,
- PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_copy, graph, 9L, 2L)
}
#' @export
@@ -142,8 +139,7 @@ graph.attributes <- function(graph) {
stop("Value must be a named list with unique names")
}
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 2L, value,
- PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 2L, value)
}
@@ -180,8 +176,8 @@ vertex_attr <- function(graph, name, index=V(graph)) {
vertex.attributes(graph, index = index)
}
} else {
- myattr <- base::.Call("R_igraph_mybracket2", graph, 9L, 3L,
- PACKAGE="igraph")[[as.character(name)]]
+ myattr <-
+ .Call(C_R_igraph_mybracket2, graph, 9L, 3L)[[as.character(name)]]
if (! missing(index)) {
index <- as.igraph.vs(graph, index)
myattr <- myattr[index]
@@ -257,7 +253,7 @@ i_set_vertex_attr <- function(graph, name, index=V(graph), value,
name <- as.character(name)
vc <- vcount(graph)
- vattrs <- base::.Call("R_igraph_mybracket2", graph, 9L, 3L, PACKAGE="igraph")
+ vattrs <- .Call(C_R_igraph_mybracket2, graph, 9L, 3L)
if (single) {
vattrs[[name]][[index]] <- value
} else {
@@ -265,7 +261,7 @@ i_set_vertex_attr <- function(graph, name, index=V(graph), value,
}
length(vattrs[[name]]) <- vc
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 3L, vattrs, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 3L, vattrs)
}
#' @export
@@ -279,12 +275,12 @@ vertex.attributes <- function(graph, index = V(graph)) {
index <- as.igraph.vs(graph, index)
}
- res <- base::.Call("R_igraph_mybracket2_copy", graph, 9L, 3L, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mybracket2_copy, graph, 9L, 3L)
if (!missing(index) &&
(length(index) != vcount(graph) || any(index != V(graph)))) {
- for (i in seq_along(value)) {
- value[[i]] <- value[[i]][index]
+ for (i in seq_along(res)) {
+ res[[i]] <- res[[i]][index]
}
}
res
@@ -323,8 +319,7 @@ vertex.attributes <- function(graph, index = V(graph)) {
}
}
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 3L, value,
- PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 3L, value)
}
@@ -358,8 +353,7 @@ edge_attr <- function(graph, name, index=E(graph)) {
} else {
name <- as.character(name)
index <- as.igraph.es(graph, index)
- myattr <- base::.Call("R_igraph_mybracket2", graph, 9L, 4L,
- PACKAGE="igraph")[[name]]
+ myattr <- .Call(C_R_igraph_mybracket2, graph, 9L, 4L)[[name]]
myattr[index]
}
}
@@ -430,7 +424,7 @@ i_set_edge_attr <- function(graph, name, index=E(graph), value,
if (!missing(index) && check) index <- as.igraph.es(graph, index)
ec <- ecount(graph)
- eattrs <- base::.Call("R_igraph_mybracket2", graph, 9L, 4L, PACKAGE="igraph")
+ eattrs <- .Call(C_R_igraph_mybracket2, graph, 9L, 4L)
if (single) {
eattrs[[name]][[index]] <- value
} else {
@@ -438,7 +432,7 @@ i_set_edge_attr <- function(graph, name, index=E(graph), value,
}
length(eattrs[[name]]) <- ec
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 4L, eattrs, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 4L, eattrs)
}
#' @export
@@ -452,12 +446,12 @@ edge.attributes <- function(graph, index = E(graph)) {
index <- as.igraph.es(graph, index)
}
- res <- base::.Call("R_igraph_mybracket2_copy", graph, 9L, 4L, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mybracket2_copy, graph, 9L, 4L)
if (!missing(index) &&
(length(index) != ecount(graph) || any(index != E(graph)))) {
- for (i in seq_along(value)) {
- value[[i]] <- value[[i]][index]
+ for (i in seq_along(res)) {
+ res[[i]] <- res[[i]][index]
}
}
res
@@ -497,8 +491,7 @@ edge.attributes <- function(graph, index = E(graph)) {
}
}
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 4L, value,
- PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 4L, value)
}
#' List names of graph attributes
@@ -518,7 +511,7 @@ graph_attr_names <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- res <- base::.Call("R_igraph_mybracket2_names", graph, 9L, 2L, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mybracket2_names, graph, 9L, 2L)
if (is.null(res)) { res <- character() }
res
}
@@ -543,7 +536,7 @@ vertex_attr_names <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- res <- base::.Call("R_igraph_mybracket2_names", graph, 9L, 3L, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mybracket2_names, graph, 9L, 3L)
if (is.null(res)) { res <- character() }
res
@@ -568,7 +561,7 @@ edge_attr_names <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- res <- base::.Call("R_igraph_mybracket2_names", graph, 9L, 4L, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mybracket2_names, graph, 9L, 4L)
if (is.null(res)) { res <- character() }
res
}
@@ -598,10 +591,10 @@ delete_graph_attr <- function(graph, name) {
stop("No such graph attribute: ", name)
}
- gattr <- base::.Call("R_igraph_mybracket2", graph, 9L, 2L, PACKAGE="igraph")
+ gattr <- .Call(C_R_igraph_mybracket2, graph, 9L, 2L)
gattr[[name]] <- NULL
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 2L, gattr, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 2L, gattr)
}
#' Delete a vertex attribute
@@ -630,10 +623,10 @@ delete_vertex_attr <- function(graph, name) {
stop("No such vertex attribute: ", name)
}
- vattr <- base::.Call("R_igraph_mybracket2", graph, 9L, 3L, PACKAGE="igraph")
+ vattr <- .Call(C_R_igraph_mybracket2, graph, 9L, 3L)
vattr[[name]] <- NULL
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 3L, vattr, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 3L, vattr)
}
#' Delete an edge attribute
@@ -662,10 +655,10 @@ delete_edge_attr <- function(graph, name) {
stop("No such edge attribute: ", name)
}
- eattr <- base::.Call("R_igraph_mybracket2", graph, 9L, 4L, PACKAGE="igraph")
+ eattr <- .Call(C_R_igraph_mybracket2, graph, 9L, 4L)
eattr[[name]] <- NULL
- base::.Call("R_igraph_mybracket2_set", graph, 9L, 4L, eattr, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 4L, eattr)
}
#############
diff --git a/R/auto.R b/R/auto.R
index 162e5e6..24b7788 100644
--- a/R/auto.R
+++ b/R/auto.R
@@ -3,10 +3,9 @@ gorder <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_vcount", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_vcount, graph)
res
@@ -19,10 +18,9 @@ graph_from_lcf <- function(n, shifts, repeats=1) {
shifts <- as.numeric(shifts)
repeats <- as.integer(repeats)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_lcf_vector", n, shifts, repeats,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_lcf_vector, n, shifts, repeats)
res <- set.graph.attribute(res, 'name', 'LCF graph')
res
@@ -35,10 +33,9 @@ graph_from_adj_list <- function(adjlist, mode=c("out", "in", "all", "total"), du
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
duplicate <- as.logical(duplicate)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_adjlist", adjlist, mode, duplicate,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_adjlist, adjlist, mode, duplicate)
res
}
@@ -52,10 +49,9 @@ sample_forestfire <- function(nodes, fw.prob, bw.factor=1, ambs=1, directed=TRUE
ambs <- as.integer(ambs)
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_forest_fire_game", nodes, fw.prob, bw.factor, ambs, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_forest_fire_game, nodes, fw.prob, bw.factor, ambs, directed)
res <- set.graph.attribute(res, 'name', 'Forest fire model')
res <- set.graph.attribute(res, 'fw.prob', fw.prob)
@@ -72,10 +68,9 @@ sample_islands <- function(islands.n, islands.size, islands.pin, n.inter) {
islands.pin <- as.numeric(islands.pin)
n.inter <- as.integer(n.inter)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_simple_interconnected_islands_game", islands.n, islands.size, islands.pin, n.inter,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_simple_interconnected_islands_game, islands.n, islands.size, islands.pin, n.inter)
res <- set.graph.attribute(res, 'name', 'Interconnected islands model')
res <- set.graph.attribute(res, 'islands.n', islands.n)
@@ -94,10 +89,9 @@ sample_fitness <- function(no.of.edges, fitness.out, fitness.in=NULL, loops=FALS
loops <- as.logical(loops)
multiple <- as.logical(multiple)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_static_fitness_game", no.of.edges, fitness.out, fitness.in, loops, multiple,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_static_fitness_game, no.of.edges, fitness.out, fitness.in, loops, multiple)
res <- set.graph.attribute(res, 'name', 'Static fitness model')
res <- set.graph.attribute(res, 'loops', loops)
@@ -116,10 +110,9 @@ sample_fitness_pl <- function(no.of.nodes, no.of.edges, exponent.out, exponent.i
multiple <- as.logical(multiple)
finite.size.correction <- as.logical(finite.size.correction)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_static_power_law_game", no.of.nodes, no.of.edges, exponent.out, exponent.in, loops, multiple, finite.size.correction,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_static_power_law_game, no.of.nodes, no.of.edges, exponent.out, exponent.in, loops, multiple, finite.size.correction)
res <- set.graph.attribute(res, 'name', 'Static power law model')
res <- set.graph.attribute(res, 'exponent.out', exponent.out)
@@ -138,10 +131,9 @@ sample_k_regular <- function(no.of.nodes, k, directed=FALSE, multiple=FALSE) {
directed <- as.logical(directed)
multiple <- as.logical(multiple)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_k_regular_game", no.of.nodes, k, directed, multiple,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_k_regular_game, no.of.nodes, k, directed, multiple)
res <- set.graph.attribute(res, 'name', 'k-regular graph')
res <- set.graph.attribute(res, 'k', k)
@@ -157,10 +149,9 @@ sample_sbm <- function(n, pref.matrix, block.sizes, directed=FALSE, loops=FALSE)
directed <- as.logical(directed)
loops <- as.logical(loops)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sbm_game", n, pref.matrix, block.sizes, directed, loops,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sbm_game, n, pref.matrix, block.sizes, directed, loops)
res <- set.graph.attribute(res, 'name', 'Stochastic block-model')
res <- set.graph.attribute(res, 'loops', loops)
@@ -175,10 +166,9 @@ hsbm.1.game <- function(n, m, rho, C, p) {
C <- as.matrix(structure(as.double(C), dim=dim(C)))
p <- as.numeric(p)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hsbm_game", n, m, rho, C, p,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hsbm_game, n, m, rho, C, p)
res <- set.graph.attribute(res, 'name', 'Hierarchical stochastic block model')
res <- set.graph.attribute(res, 'm', m)
@@ -195,10 +185,9 @@ hsbm.list.game <- function(n, mlist, rholist, Clist, p) {
if (!all(sapply(Clist, is.matrix))) { stop("%I is not a list of matrices") }
p <- as.numeric(p)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hsbm_list_game", n, mlist, rholist, Clist, p,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hsbm_list_game, n, mlist, rholist, Clist, p)
res <- set.graph.attribute(res, 'name', 'Hierarchical stochastic block model')
res <- set.graph.attribute(res, 'p', p)
@@ -213,10 +202,9 @@ sample_correlated_gnp <- function(old.graph, corr, p=old.graph$p, permutation=NU
p <- as.numeric(p)
if (!is.null(permutation)) permutation <- as.numeric(permutation)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_correlated_game", old.graph, corr, p, permutation,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_correlated_game, old.graph, corr, p, permutation)
res <- set.graph.attribute(res, 'name', 'Correlated random graph')
res <- set.graph.attribute(res, 'corr', corr)
@@ -233,10 +221,9 @@ sample_correlated_gnp_pair <- function(n, corr, p, directed=FALSE, permutation=N
directed <- as.logical(directed)
if (!is.null(permutation)) permutation <- as.numeric(permutation)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_correlated_pair_game", n, corr, p, directed, permutation,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_correlated_pair_game, n, corr, p, directed, permutation)
res
}
@@ -247,10 +234,9 @@ sample_dot_product <- function(vecs, directed=FALSE) {
vecs <- as.matrix(structure(as.double(vecs), dim=dim(vecs)))
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_dot_product_game", vecs, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_dot_product_game, vecs, directed)
res
}
@@ -263,10 +249,9 @@ sample_sphere_surface <- function(dim, n=1, radius=1, positive=TRUE) {
radius <- as.numeric(radius)
positive <- as.logical(positive)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sample_sphere_surface", dim, n, radius, positive,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sample_sphere_surface, dim, n, radius, positive)
res
}
@@ -279,10 +264,9 @@ sample_sphere_volume <- function(dim, n=1, radius=1, positive=TRUE) {
radius <- as.numeric(radius)
positive <- as.logical(positive)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sample_sphere_volume", dim, n, radius, positive,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sample_sphere_volume, dim, n, radius, positive)
res
}
@@ -293,10 +277,9 @@ sample_dirichlet <- function(n, alpha) {
n <- as.integer(n)
alpha <- as.numeric(alpha)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sample_dirichlet", n, alpha,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sample_dirichlet, n, alpha)
res
}
@@ -312,10 +295,9 @@ page_rank_old <- function(graph, vids=V(graph), directed=TRUE, niter=1000, eps=0
damping <- as.numeric(damping)
old <- as.logical(old)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_pagerank_old", graph, vids-1, directed, niter, eps, damping, old,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_pagerank_old, graph, vids-1, directed, niter, eps, damping, old)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name", vids)
}
@@ -350,10 +332,9 @@ page_rank <- function(graph, algo=c("prpack", "arpack", "power"), vids=V(graph),
}
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_personalized_pagerank", graph, algo, vids-1, directed, damping, personalized, weights, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_personalized_pagerank, graph, algo, vids-1, directed, damping, personalized, weights, options)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res$vector) <- vertex_attr(graph, "name", vids)
}
@@ -366,10 +347,9 @@ distance_table <- function(graph, directed=TRUE) {
if (!is_igraph(graph)) { stop("Not a graph object") }
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_path_length_hist", graph, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_path_length_hist, graph, directed)
res
}
@@ -382,10 +362,9 @@ simplify <- function(graph, remove.multiple=TRUE, remove.loops=TRUE, edge.attr.c
remove.loops <- as.logical(remove.loops)
edge.attr.comb <- igraph.i.attribute.combination(edge.attr.comb)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_simplify", graph, remove.multiple, remove.loops, edge.attr.comb,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_simplify, graph, remove.multiple, remove.loops, edge.attr.comb)
res
}
@@ -395,10 +374,9 @@ is_dag <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_dag", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_dag, graph)
res
}
@@ -408,10 +386,9 @@ is_simple <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_simple", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_simple, graph)
res
}
@@ -421,10 +398,9 @@ any_multiple <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_has_multiple", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_has_multiple, graph)
res
}
@@ -445,10 +421,9 @@ eigen_centrality <- function(graph, directed=FALSE, scale=TRUE, weights=NULL, op
}
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_eigenvector_centrality", graph, directed, scale, weights, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_eigenvector_centrality, graph, directed, scale, weights, options)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res$vector) <- vertex_attr(graph, "name", )
}
@@ -470,10 +445,9 @@ hub_score <- function(graph, scale=TRUE, weights=NULL, options=arpack_defaults)
}
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hub_score", graph, scale, weights, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hub_score, graph, scale, weights, options)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res$vector) <- vertex_attr(graph, "name", )
}
@@ -495,10 +469,9 @@ authority_score <- function(graph, scale=TRUE, weights=NULL, options=arpack_defa
}
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_authority_score", graph, scale, weights, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_authority_score, graph, scale, weights, options)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res$vector) <- vertex_attr(graph, "name", )
}
@@ -511,10 +484,9 @@ which_mutual <- function(graph, es=E(graph)) {
if (!is_igraph(graph)) { stop("Not a graph object") }
es <- as.igraph.es(graph, es)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_mutual", graph, es-1,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_mutual, graph, es-1)
res
}
@@ -524,10 +496,9 @@ max_cardinality <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_maximum_cardinality_search", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_maximum_cardinality_search, graph)
if (igraph_opt("return.vs.es")) {
res$alpha <- create_vs(graph, res$alpha)
}
@@ -548,10 +519,9 @@ knn <- function(graph, vids=V(graph), weights=NULL) {
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_avg_nearest_neighbor_degree", graph, vids-1, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_avg_nearest_neighbor_degree, graph, vids-1, weights)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res$knn) <- vertex_attr(graph, "name", vids)
}
@@ -574,10 +544,9 @@ strength <- function(graph, vids=V(graph), mode=c("all", "out", "in", "total"),
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_strength", graph, vids-1, mode, loops, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_strength, graph, vids-1, mode, loops, weights)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name", vids)
}
@@ -591,10 +560,9 @@ centralize <- function(scores, theoretical.max=0, normalized=TRUE) {
theoretical.max <- as.numeric(theoretical.max)
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization", scores, theoretical.max, normalized,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization, scores, theoretical.max, normalized)
res
@@ -608,10 +576,9 @@ centr_degree <- function(graph, mode=c("all", "out", "in", "total"), loops=TRUE,
loops <- as.logical(loops)
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_degree", graph, mode, loops, normalized,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_degree, graph, mode, loops, normalized)
res
}
@@ -624,10 +591,9 @@ centr_degree_tmax <- function(graph=NULL, nodes=0, mode=c("all", "out", "in", "t
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
loops <- as.logical(loops)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_degree_tmax", graph, nodes, mode, loops,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_degree_tmax, graph, nodes, mode, loops)
res
}
@@ -640,10 +606,9 @@ centr_betw <- function(graph, directed=TRUE, nobigint=TRUE, normalized=TRUE) {
nobigint <- as.logical(nobigint)
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_betweenness", graph, directed, nobigint, normalized,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_betweenness, graph, directed, nobigint, normalized)
res
}
@@ -655,10 +620,9 @@ centr_betw_tmax <- function(graph=NULL, nodes=0, directed=TRUE) {
nodes <- as.integer(nodes)
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_betweenness_tmax", graph, nodes, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_betweenness_tmax, graph, nodes, directed)
res
}
@@ -670,10 +634,9 @@ centr_clo <- function(graph, mode=c("out", "in", "all", "total"), normalized=TRU
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_closeness", graph, mode, normalized,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_closeness, graph, mode, normalized)
res
}
@@ -685,10 +648,9 @@ centr_clo_tmax <- function(graph=NULL, nodes=0, mode=c("out", "in", "all", "tota
nodes <- as.integer(nodes)
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_closeness_tmax", graph, nodes, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_closeness_tmax, graph, nodes, mode)
res
}
@@ -702,10 +664,9 @@ centr_eigen <- function(graph, directed=FALSE, scale=TRUE, options=arpack_defaul
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_eigenvector_centrality", graph, directed, scale, options, normalized,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_eigenvector_centrality, graph, directed, scale, options, normalized)
res
}
@@ -718,10 +679,9 @@ centr_eigen_tmax <- function(graph=NULL, nodes=0, directed=FALSE, scale=TRUE) {
directed <- as.logical(directed)
scale <- as.logical(scale)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_centralization_eigenvector_centrality_tmax", graph, nodes, directed, scale,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_centralization_eigenvector_centrality_tmax, graph, nodes, directed, scale)
res
}
@@ -733,10 +693,9 @@ assortativity_nominal <- function(graph, types, directed=TRUE) {
types <- as.numeric(types)-1
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_assortativity_nominal", graph, types, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_assortativity_nominal, graph, types, directed)
res
}
@@ -749,10 +708,9 @@ assortativity <- function(graph, types1, types2=NULL, directed=TRUE) {
if (!is.null(types2)) types2 <- as.numeric(types2)
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_assortativity", graph, types1, types2, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_assortativity, graph, types1, types2, directed)
res
}
@@ -763,10 +721,9 @@ assortativity_degree <- function(graph, directed=TRUE) {
if (!is_igraph(graph)) { stop("Not a graph object") }
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_assortativity_degree", graph, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_assortativity_degree, graph, directed)
res
}
@@ -778,10 +735,9 @@ contract <- function(graph, mapping, vertex.attr.comb=igraph_opt("vertex.attr.co
mapping <- as.numeric(mapping)-1
vertex.attr.comb <- igraph.i.attribute.combination(vertex.attr.comb)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_contract_vertices", graph, mapping, vertex.attr.comb,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_contract_vertices, graph, mapping, vertex.attr.comb)
res
}
@@ -793,10 +749,9 @@ eccentricity <- function(graph, vids=V(graph), mode=c("all", "out", "in", "total
vids <- as.igraph.vs(graph, vids)
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_eccentricity", graph, vids-1, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_eccentricity, graph, vids-1, mode)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name", vids)
}
@@ -809,10 +764,9 @@ radius <- function(graph, mode=c("all", "out", "in", "total")) {
if (!is_igraph(graph)) { stop("Not a graph object") }
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_radius", graph, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_radius, graph, mode)
res
}
@@ -831,10 +785,9 @@ diversity <- function(graph, weights=NULL, vids=V(graph)) {
}
vids <- as.igraph.vs(graph, vids)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_diversity", graph, weights, vids-1,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_diversity, graph, weights, vids-1)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name", vids)
}
@@ -847,10 +800,9 @@ is_degseq <- function(out.deg, in.deg=NULL) {
out.deg <- as.numeric(out.deg)
if (!is.null(in.deg)) in.deg <- as.numeric(in.deg)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_degree_sequence", out.deg, in.deg,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_degree_sequence, out.deg, in.deg)
res
}
@@ -861,10 +813,9 @@ is_graphical <- function(out.deg, in.deg=NULL) {
out.deg <- as.numeric(out.deg)
if (!is.null(in.deg)) in.deg <- as.numeric(in.deg)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_graphical_degree_sequence", out.deg, in.deg,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_graphical_degree_sequence, out.deg, in.deg)
res
}
@@ -888,10 +839,9 @@ bipartite_projection_size <- function(graph, types=NULL) {
stop("Not a bipartite graph, supply `types' argument")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_bipartite_projection_size", graph, types,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_bipartite_projection_size, graph, types)
res
}
@@ -901,10 +851,9 @@ bipartite_mapping <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_bipartite", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_bipartite, graph)
res
}
@@ -914,10 +863,9 @@ articulation_points <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_articulation_points", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_articulation_points, graph)
if (igraph_opt("return.vs.es")) {
res <- create_vs(graph, res)
}
@@ -929,10 +877,9 @@ biconnected_components <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_biconnected_components", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_biconnected_components, graph)
if (igraph_opt("return.vs.es")) {
for (i_ in seq_along(res$tree_edges)) {
res$tree_edges[[i_]] <- create_es(graph, res$tree_edges[[i_]])
@@ -962,10 +909,9 @@ similarity.jaccard <- function(graph, vids=V(graph), mode=c("all", "out", "in",
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
loops <- as.logical(loops)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_similarity_jaccard", graph, vids-1, mode, loops,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_similarity_jaccard, graph, vids-1, mode, loops)
res
}
@@ -978,10 +924,9 @@ similarity.dice <- function(graph, vids=V(graph), mode=c("all", "out", "in", "to
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
loops <- as.logical(loops)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_similarity_dice", graph, vids-1, mode, loops,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_similarity_dice, graph, vids-1, mode, loops)
res
}
@@ -993,10 +938,9 @@ similarity.invlogweighted <- function(graph, vids=V(graph), mode=c("all", "out",
vids <- as.igraph.vs(graph, vids)
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_similarity_inverse_log_weighted", graph, vids-1, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_similarity_inverse_log_weighted, graph, vids-1, mode)
res
}
@@ -1011,10 +955,9 @@ sample_hrg <- function(hrg) {
hrg <- lapply(hrg[c("left","right","prob","edges","vertices")],
as.numeric)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hrg_game", hrg,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hrg_game, hrg)
res <- set.graph.attribute(res, 'name', 'Hierarchical random graph model')
res
@@ -1030,10 +973,9 @@ hrg_tree <- function(hrg) {
hrg <- lapply(hrg[c("left","right","prob","edges","vertices")],
as.numeric)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hrg_dendrogram", hrg,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hrg_dendrogram, hrg)
res
}
@@ -1051,10 +993,9 @@ consensus_tree <- function(graph, hrg=NULL, start=FALSE, num.samples=10000) {
start <- as.logical(start)
num.samples <- as.integer(num.samples)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hrg_consensus", graph, hrg, start, num.samples,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hrg_consensus, graph, hrg, start, num.samples)
res
}
@@ -1065,10 +1006,9 @@ hrg <- function(graph, prob) {
if (!is_igraph(graph)) { stop("Not a graph object") }
prob <- as.numeric(prob)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hrg_create", graph, prob,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hrg_create, graph, prob)
class(res) <- "igraphHRG"
res
@@ -1088,10 +1028,9 @@ graphlets <- function(graph, weights=NULL, niter=1000) {
}
niter <- as.integer(niter)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_graphlets", graph, weights, niter,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_graphlets, graph, weights, niter)
if (igraph_opt("return.vs.es")) {
for (i_ in seq_along(res$cliques)) {
res$cliques[[i_]] <- create_vs(graph, res$cliques[[i_]])
@@ -1105,10 +1044,9 @@ dyad_census <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_dyad_census", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_dyad_census, graph)
res
}
@@ -1118,10 +1056,9 @@ triad_census <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_triad_census", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_triad_census, graph)
res
}
@@ -1132,10 +1069,9 @@ count_triangles <- function(graph, vids=V(graph)) {
if (!is_igraph(graph)) { stop("Not a graph object") }
vids <- as.igraph.vs(graph, vids)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_adjacent_triangles", graph, vids-1,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_adjacent_triangles, graph, vids-1)
res
}
@@ -1145,10 +1081,9 @@ triangles <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_list_triangles", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_list_triangles, graph)
if (igraph_opt("return.vs.es")) {
res <- create_vs(graph, res)
}
@@ -1170,10 +1105,9 @@ max_flow <- function(graph, source, target, capacity=NULL) {
capacity <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_maxflow", graph, source-1, target-1, capacity,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_maxflow, graph, source-1, target-1, capacity)
if (igraph_opt("return.vs.es")) {
res$partition1 <- create_vs(graph, res$partition1)
}
@@ -1190,10 +1124,9 @@ dominator_tree <- function(graph, root, mode=c("out", "in")) {
root <- as.igraph.vs(graph, root)
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_dominator_tree", graph, root-1, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_dominator_tree, graph, root-1, mode)
if (igraph_opt("return.vs.es")) {
res$dom <- create_vs(graph, res$dom)
}
@@ -1210,10 +1143,9 @@ st_cuts <- function(graph, source, target) {
source <- as.igraph.vs(graph, source)
target <- as.igraph.vs(graph, target)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_all_st_cuts", graph, source-1, target-1,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_all_st_cuts, graph, source-1, target-1)
if (igraph_opt("return.vs.es")) {
for (i_ in seq_along(res$cuts)) {
res$cuts[[i_]] <- create_es(graph, res$cuts[[i_]])
@@ -1242,10 +1174,9 @@ st_min_cuts <- function(graph, source, target, capacity=NULL) {
capacity <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_all_st_mincuts", graph, source-1, target-1, capacity,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_all_st_mincuts, graph, source-1, target-1, capacity)
if (igraph_opt("return.vs.es")) {
for (i_ in seq_along(res$cuts)) {
res$cuts[[i_]] <- create_es(graph, res$cuts[[i_]])
@@ -1265,10 +1196,9 @@ is_separator <- function(graph, candidate) {
if (!is_igraph(graph)) { stop("Not a graph object") }
candidate <- as.igraph.vs(graph, candidate)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_separator", graph, candidate-1,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_separator, graph, candidate-1)
res
}
@@ -1279,10 +1209,9 @@ is_min_separator <- function(graph, candidate) {
if (!is_igraph(graph)) { stop("Not a graph object") }
candidate <- as.igraph.vs(graph, candidate)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_minimal_separator", graph, candidate-1,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_minimal_separator, graph, candidate-1)
res
}
@@ -1292,10 +1221,9 @@ min_st_separators <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_all_minimal_st_separators", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_all_minimal_st_separators, graph)
if (igraph_opt("return.vs.es")) {
for (i_ in seq_along(res)) {
res[[i_]] <- create_vs(graph, res[[i_]])
@@ -1309,10 +1237,9 @@ min_separators <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_minimum_size_separators", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_minimum_size_separators, graph)
if (igraph_opt("return.vs.es")) {
for (i_ in seq_along(res)) {
res[[i_]] <- create_vs(graph, res[[i_]])
@@ -1326,10 +1253,9 @@ graph.isoclass <- function(graph) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isoclass", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isoclass, graph)
res
}
@@ -1340,10 +1266,9 @@ graph.isomorphic <- function(graph1, graph2) {
if (!is_igraph(graph1)) { stop("Not a graph object") }
if (!is_igraph(graph2)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isomorphic", graph1, graph2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isomorphic, graph1, graph2)
res
}
@@ -1355,10 +1280,9 @@ graph_from_isomorphism_class <- function(size, number, directed=TRUE) {
number <- as.integer(number)
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isoclass_create", size, number, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isoclass_create, size, number, directed)
res
}
@@ -1409,10 +1333,9 @@ graph.isomorphic.vf2 <- function(graph1, graph2, vertex.color1, vertex.color2, e
edge.color2 <- as.integer(edge.color2)-1L
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isomorphic_vf2", graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isomorphic_vf2, graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2)
res
}
@@ -1463,10 +1386,9 @@ graph.count.isomorphisms.vf2 <- function(graph1, graph2, vertex.color1, vertex.c
edge.color2 <- as.integer(edge.color2)-1L
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_count_isomorphisms_vf2", graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_count_isomorphisms_vf2, graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2)
res
}
@@ -1517,10 +1439,9 @@ graph.subisomorphic.vf2 <- function(graph1, graph2, vertex.color1, vertex.color2
edge.color2 <- as.integer(edge.color2)-1L
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_subisomorphic_vf2", graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_subisomorphic_vf2, graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2)
res
}
@@ -1571,10 +1492,9 @@ graph.count.subisomorphisms.vf2 <- function(graph1, graph2, vertex.color1, verte
edge.color2 <- as.integer(edge.color2)-1L
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_count_subisomorphisms_vf2", graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_count_subisomorphisms_vf2, graph1, graph2, vertex.color1, vertex.color2, edge.color1, edge.color2)
res
}
@@ -1585,10 +1505,9 @@ graph.isomorphic.34 <- function(graph1, graph2) {
if (!is_igraph(graph1)) { stop("Not a graph object") }
if (!is_igraph(graph2)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isomorphic_34", graph1, graph2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isomorphic_34, graph1, graph2)
res
}
@@ -1599,10 +1518,9 @@ canonical_permutation <- function(graph, sh="fm") {
if (!is_igraph(graph)) { stop("Not a graph object") }
sh <- switch(igraph.match.arg(sh), "f"=0, "fl"=1, "fs"=2, "fm"=3, "flm"=4, "fsm"=5)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_canonical_permutation", graph, sh,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_canonical_permutation, graph, sh)
res
}
@@ -1613,26 +1531,23 @@ permute <- function(graph, permutation) {
if (!is_igraph(graph)) { stop("Not a graph object") }
permutation <- as.numeric(permutation)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_permute_vertices", graph, permutation,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_permute_vertices, graph, permutation)
res
}
#' @export
-graph.isomorphic.bliss <- function(graph1, graph2, sh1="fm", sh2="fm") {
+graph.isomorphic.bliss <- function(graph1, graph2, sh="fm") {
# Argument checks
if (!is_igraph(graph1)) { stop("Not a graph object") }
if (!is_igraph(graph2)) { stop("Not a graph object") }
- sh1 <- switch(igraph.match.arg(sh1), "f"=0, "fl"=1, "fs"=2, "fm"=3, "flm"=4, "fsm"=5)
- sh2 <- switch(igraph.match.arg(sh2), "f"=0, "fl"=1, "fs"=2, "fm"=3, "flm"=4, "fsm"=5)
+ sh <- switch(igraph.match.arg(sh), "f"=0, "fl"=1, "fs"=2, "fm"=3, "flm"=4, "fsm"=5)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isomorphic_bliss", graph1, graph2, sh1, sh2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isomorphic_bliss, graph1, graph2, sh)
res
}
@@ -1643,10 +1558,9 @@ automorphisms <- function(graph, sh="fm") {
if (!is_igraph(graph)) { stop("Not a graph object") }
sh <- switch(igraph.match.arg(sh), "f"=0, "fl"=1, "fs"=2, "fm"=3, "flm"=4, "fsm"=5)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_automorphisms", graph, sh,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_automorphisms, graph, sh)
res
}
@@ -1661,10 +1575,9 @@ scg_eps <- function(V, groups, mtype=c("symmetric", "laplacian", "stochastic"),
if (!is.null(p)) p <- as.numeric(p)
norm <- switch(igraph.match.arg(norm), "row"=1, "col"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_scg_norm_eps", V, groups, mtype, p, norm,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_scg_norm_eps, V, groups, mtype, p, norm)
res
}
@@ -1687,10 +1600,9 @@ embed_adjacency_matrix <- function(graph, no, weights=NULL, which=c("lm", "la",
cvec <- as.numeric(cvec)
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_adjacency_spectral_embedding", graph, no, weights, which, scaled, cvec, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_adjacency_spectral_embedding, graph, no, weights, which, scaled, cvec, options)
res
}
@@ -1717,10 +1629,9 @@ embed_laplacian_matrix <- function(graph, no, weights=NULL, which=c("lm", "la",
scaled <- as.logical(scaled)
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_laplacian_spectral_embedding", graph, no, weights, which, degmode, type, scaled, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_laplacian_spectral_embedding, graph, no, weights, which, degmode, type, scaled, options)
res
}
@@ -1736,10 +1647,9 @@ spectrum <- function(graph, algorithm=c("arpack", "auto", "lapack", "comp_auto",
which.tmp[ names(which) ] <- which ; which <- which.tmp
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_eigen_adjacency", graph, algorithm, which, options,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_eigen_adjacency, graph, algorithm, which, options)
res
}
@@ -1752,10 +1662,9 @@ sir <- function(graph, beta, gamma, no.sim=100) {
gamma <- as.numeric(gamma)
no.sim <- as.integer(no.sim)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sir", graph, beta, gamma, no.sim,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sir, graph, beta, gamma, no.sim)
class(res) <- "sir"
res
@@ -1766,10 +1675,9 @@ convex_hull <- function(data) {
# Argument checks
data <- as.matrix(structure(as.double(data), dim=dim(data)))
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_convex_hull", data,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_convex_hull, data)
res
}
@@ -1779,10 +1687,9 @@ dim_select <- function(sv) {
# Argument checks
sv <- as.numeric(sv)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_dim_select", sv,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_dim_select, sv)
res
}
diff --git a/R/basic.R b/R/basic.R
index 6501eac..2447f83 100644
--- a/R/basic.R
+++ b/R/basic.R
@@ -58,9 +58,8 @@ get.edge <- function(graph, id) {
stop("No such edge")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_get_edge", graph, as.numeric(id)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_get_edge, graph, as.numeric(id)-1)
res+1
}
@@ -80,7 +79,7 @@ get.edge <- function(graph, id) {
#' @export
head_of <- function(graph, es) {
- create_vs(graph, ends(graph, es, names = FALSE)[,1])
+ create_vs(graph, ends(graph, es, names = FALSE)[,2])
}
#' Tails of the edge(s) in a graph
@@ -98,5 +97,5 @@ head_of <- function(graph, es) {
#' @export
tail_of <- function(graph, es) {
- create_vs(graph, ends(graph, es, names = FALSE)[,2])
+ create_vs(graph, ends(graph, es, names = FALSE)[,1])
}
diff --git a/R/bipartite.R b/R/bipartite.R
index b7aed83..5018742 100644
--- a/R/bipartite.R
+++ b/R/bipartite.R
@@ -48,7 +48,8 @@
#' \sQuote{\code{type}} vertex attribute. You must supply this argument if the
#' graph has no \sQuote{\code{type}} vertex attribute.
#' @param multiplicity If \code{TRUE}, then igraph keeps the multiplicity of
-#' the edges as an edge attribute. E.g. if there is an A-C-B and also an A-D-B
+#' the edges as an edge attribute called \sQuote{weight}.
+#' E.g. if there is an A-C-B and also an A-D-B
#' triple in the bipartite graph (but no more X, such that A-X-B is also in the
#' graph), then the multiplicity of the A-B edge in the projection will be 2.
#' @param probe1 This argument can be used to specify the order of the
@@ -118,10 +119,10 @@ bipartite_projection <- function(graph, types=NULL,
warning("`probe1' ignored if only one projection is requested")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_bipartite_projection", graph, types,
- as.integer(probe1), which, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_bipartite_projection, graph, types,
+ as.integer(probe1), which)
if (remove.type) {
if (is_igraph(res[[1]])) {
res[[1]] <- delete_vertex_attr(res[[1]], "type")
diff --git a/R/centrality.R b/R/centrality.R
index 4ec07bf..d4895d8 100644
--- a/R/centrality.R
+++ b/R/centrality.R
@@ -202,11 +202,12 @@ arpack_defaults <- list(bmat="I", n=0, which="XX", nev=1, tol=0.0,
#' ## First three eigenvalues of the adjacency matrix of a graph
#' ## We need the 'Matrix' package for this
#' if (require(Matrix)) {
+#' set.seed(42)
#' g <- sample_gnp(1000, 5/1000)
#' M <- as_adj(g, sparse=TRUE)
#' f2 <- function(x, extra=NULL) { cat("."); as.vector(M %*% x) }
#' baev <- arpack(f2, sym=TRUE, options=list(n=vcount(g), nev=3, ncv=8,
-#' which="LM", maxiter=200))
+#' which="LM", maxiter=2000))
#' }
#' @export
@@ -235,9 +236,8 @@ arpack <- function(func, extra=NULL, sym=FALSE, options=arpack_defaults,
warning("Symmetric matrix, setting `complex' to FALSE")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_arpack", func, extra, options, env, sym,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_arpack, func, extra, options, env, sym)
if (complex) {
rew <- arpack.unpack.complex(res$vectors, res$values,
@@ -270,10 +270,9 @@ arpack.unpack.complex <- function(vectors, values, nev) {
values <- as.matrix(structure(as.double(values), dim=dim(values)))
nev <- as.integer(nev)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_arpack_unpack_complex", vectors, values, nev,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_arpack_unpack_complex, vectors, values, nev)
res
}
@@ -431,6 +430,8 @@ eigen_defaults <- list(pos="LM", howmany=1L, il=-1L, iu=-1L,
#' \code{weight} edge attribute. Note that if there are negative edge weights
#' and the direction of the edges is considered, then the eigenvector might be
#' complex. In this case only the real part is reported.
+#' This function interprets weights as connection strength. Higher
+#' weights spread the centrality better.
#' @param options A named list, to override some ARPACK options. See
#' \code{\link{arpack}} for details.
#' @return A named list with components: \item{vector}{A vector containing the
@@ -559,6 +560,9 @@ diversity <- diversity
#' @param weights Optional positive weight vector for calculating weighted
#' scores. If the graph has a \code{weight} edge attribute, then this is used
#' by default.
+#' This function interprets edge weights as connection strengths. In the
+#' random surfer model, an edge with a larger weight is more likely to be
+#' selected by the surfer.
#' @param options A named list, to override some ARPACK options. See
#' \code{\link{arpack}} for details.
#' @return A named list with members:
@@ -606,6 +610,9 @@ hub_score <- hub_score
#' @param weights Optional positive weight vector for calculating weighted
#' scores. If the graph has a \code{weight} edge attribute, then this is used
#' by default.
+#' This function interprets edge weights as connection strengths. In the
+#' random surfer model, an edge with a larger weight is more likely to be
+#' selected by the surfer.
#' @param options A named list, to override some ARPACK options. See
#' \code{\link{arpack}} for details.
#' @return A named list with members:
@@ -703,6 +710,9 @@ authority_score <- authority_score
#' that is used. If \code{weights} is a numerical vector then it used, even if
#' the graph has a \code{weights} edge attribute. If this is \code{NA}, then no
#' edge weights are used (even if the graph has a \code{weight} edge attribute.
+#' This function interprets edge weights as connection strengths. In the
+#' random surfer model, an edge with a larger weight is more likely to be
+#' selected by the surfer.
#' @param options Either a named list, to override some ARPACK options. See
#' \code{\link{arpack}} for details; or a named list to override the default
#' options for the power method (if \code{algo="power"}). The default options
diff --git a/R/cliques.R b/R/cliques.R
index 770f340..6ab08ce 100644
--- a/R/cliques.R
+++ b/R/cliques.R
@@ -96,9 +96,8 @@ cliques <- function(graph, min=NULL, max=NULL) {
max <- 0
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_cliques", graph, as.numeric(min), as.numeric(max),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_cliques, graph, as.numeric(min), as.numeric(max))
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -115,9 +114,8 @@ largest_cliques <- function(graph) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_largest_cliques", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_largest_cliques, graph)
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -163,19 +161,18 @@ max_cliques <- function(graph, min=NULL, max=NULL,
} else {
tmpfile <- FALSE
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_maximal_cliques_file", graph, subset, file,
- as.numeric(min), as.numeric(max), PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_maximal_cliques_file, graph, subset, file,
+ as.numeric(min), as.numeric(max))
if (tmpfile) {
buffer <- read.graph.toraw(file)
write.graph.fromraw(buffer, origfile)
}
invisible(NULL)
} else {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_maximal_cliques", graph, subset,
- as.numeric(min), as.numeric(max),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_maximal_cliques, graph, subset,
+ as.numeric(min), as.numeric(max))
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -202,10 +199,9 @@ count_max_cliques <- function(graph, min=NULL, max=NULL,
subset <- as.integer(as.igraph.vs(graph, subset)-1)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_maximal_cliques_count", graph, subset, min, max,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_maximal_cliques_count, graph, subset, min, max)
res
}
@@ -217,9 +213,8 @@ clique_num <- function(graph) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_clique_number", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_clique_number, graph)
}
@@ -304,10 +299,9 @@ ivs <- function(graph, min=NULL, max=NULL) {
max <- 0
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_independent_vertex_sets", graph, as.numeric(min),
- as.numeric(max),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_independent_vertex_sets, graph, as.numeric(min),
+ as.numeric(max))
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -324,9 +318,8 @@ largest_ivs <- function(graph) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_largest_independent_vertex_sets", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_largest_independent_vertex_sets, graph)
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -343,9 +336,8 @@ maximal_ivs <- function(graph) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_maximal_independent_vertex_sets", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_maximal_independent_vertex_sets, graph)
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -362,7 +354,6 @@ ivs_size <- function(graph) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_independence_number", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_independence_number, graph)
}
diff --git a/R/cocitation.R b/R/cocitation.R
index 2a55cdc..d71e056 100644
--- a/R/cocitation.R
+++ b/R/cocitation.R
@@ -61,9 +61,8 @@ cocitation <- function(graph, v=V(graph)) {
stop("Not a graph object")
}
v <- as.igraph.vs(graph, v)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_cocitation", graph, v-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_cocitation, graph, v-1)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
rownames(res) <- vertex_attr(graph, "name", v)
colnames(res) <- vertex_attr(graph, "name")
@@ -78,9 +77,8 @@ bibcoupling <- function(graph, v=V(graph)) {
stop("Not a graph object")
}
v <- as.igraph.vs(graph, v)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_bibcoupling", graph, v-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_bibcoupling, graph, v-1)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
rownames(res) <- vertex_attr(graph, "name", v)
colnames(res) <- vertex_attr(graph, "name")
diff --git a/R/cohesive.blocks.R b/R/cohesive.blocks.R
index ded7482..a74f557 100644
--- a/R/cohesive.blocks.R
+++ b/R/cohesive.blocks.R
@@ -241,10 +241,9 @@ cohesive_blocks <- function(graph, labels=TRUE) {
# Argument checks
if (!is_igraph(graph)) { stop("Not a graph object") }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_cohesive_blocks", graph,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_cohesive_blocks, graph)
class(res) <- "cohesiveBlocks"
if (labels && "name" %in% vertex_attr_names(graph)) {
res$labels <- V(graph)$name
@@ -365,6 +364,8 @@ summary.cohesiveBlocks <- function(object, ...) {
#' @rdname cohesive_blocks
#' @method plot cohesiveBlocks
#' @export
+#' @importFrom grDevices rainbow
+#' @importFrom graphics plot
plot.cohesiveBlocks <- function(x, y,
colbar=rainbow(max(cohesion(x))+1),
@@ -377,6 +378,7 @@ plot.cohesiveBlocks <- function(x, y,
#' @rdname cohesive_blocks
#' @export
+#' @importFrom graphics plot
plot_hierarchy <- function(blocks,
layout=layout_as_tree(hierarchy(blocks),
diff --git a/R/community.R b/R/community.R
index 3992198..6ce67b0 100644
--- a/R/community.R
+++ b/R/community.R
@@ -261,11 +261,6 @@ print.membership <- function(x, ...) print(unclass(x), ...)
as_membership <- function(x) add_class(x, "membership")
-
-#' @include printr.R
-
-head_print <- printr$head_print
-
#' @rdname communities
#' @method print communities
#' @export
@@ -430,10 +425,9 @@ modularity.igraph <- function(x, membership, weights=NULL, ...) {
membership <- as.numeric(membership)
if (!is.null(weights)) weights <- as.numeric(weights)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_modularity", x, membership-1, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_modularity, x, membership-1, weights)
res
}
@@ -466,10 +460,9 @@ modularity_matrix <- function(graph, membership, weights=NULL) {
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_modularity_matrix", graph, membership, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_modularity_matrix, graph, membership, weights)
res
}
@@ -716,7 +709,7 @@ as_phylo.communities <- function(x, use.modularity=FALSE, ...) {
obj <- list(edge=edge, edge.length=edge.length/2, tip.label=labels,
Nnode=N)
class(obj) <- "phylo"
- reorder(obj)
+ ape::reorder.phylo(obj)
}
#' @rdname communities
@@ -798,9 +791,8 @@ community.to.membership2 <- function(merges, vcount, steps) {
mode(merges) <- "numeric"
mode(vcount) <- "numeric"
mode(steps) <- "numeric"
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_community_to_membership2", merges-1, vcount, steps,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_community_to_membership2, merges-1, vcount, steps)
res+1
}
@@ -839,7 +831,8 @@ community.to.membership2 <- function(merges, vcount, steps) {
#' attribute then that will be used. If \code{NULL} and no such attribute is
#' present then the edges will have equal weights. Set this to \code{NA} if the
#' graph was a \sQuote{weight} edge attribute, but you don't want to use it for
-#' community detection.
+#' community detection. A larger edge weight means a stronger connection
+#' for this function.
#' @param vertex This parameter can be used to calculate the community of a
#' given vertex without calculating all communities. Note that if this argument
#' is present then some other arguments are ignored.
@@ -948,15 +941,14 @@ cluster_spinglass <- function(graph, weights=NULL, vertex=NULL, spins=25,
implementation <- switch(igraph.match.arg(implementation),
"orig"=0, "neg"=1)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (is.null(vertex)) {
- res <- .Call("R_igraph_spinglass_community", graph, weights,
+ res <- .Call(C_R_igraph_spinglass_community, graph, weights,
as.numeric(spins), as.logical(parupdate),
as.numeric(start.temp),
as.numeric(stop.temp), as.numeric(cool.fact),
as.numeric(update.rule), as.numeric(gamma),
- as.numeric(implementation), as.numeric(gamma.minus),
- PACKAGE="igraph")
+ as.numeric(implementation), as.numeric(gamma.minus))
res$algorithm <- "spinglass"
res$vcount <- vcount(graph)
res$membership <- res$membership + 1
@@ -965,10 +957,9 @@ cluster_spinglass <- function(graph, weights=NULL, vertex=NULL, spins=25,
}
class(res) <- "communities"
} else {
- res <- .Call("R_igraph_spinglass_my_community", graph, weights,
+ res <- .Call(C_R_igraph_spinglass_my_community, graph, weights,
as.igraph.vs(graph, vertex)-1, as.numeric(spins),
- as.numeric(update.rule), as.numeric(gamma),
- PACKAGE="igraph")
+ as.numeric(update.rule), as.numeric(gamma))
res$community <- res$community + 1
}
res
@@ -989,7 +980,9 @@ cluster_spinglass <- function(graph, weights=NULL, vertex=NULL, spins=25,
#' @aliases walktrap.community
#' @param graph The input graph, edge directions are ignored in directed
#' graphs.
-#' @param weights The edge weights.
+#' @param weights The edge weights. Larger edge weights increase the
+#' probability that an edge is selected by the random walker. In other
+#' words, larger edge weights correspond to stronger connections.
#' @param steps The length of the random walks to perform.
#' @param merges Logical scalar, whether to include the merge matrix in the
#' result.
@@ -1035,10 +1028,9 @@ cluster_walktrap <- function(graph, weights=E(graph)$weight, steps=4,
weights <- as.numeric(weights)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_walktrap_community", graph, weights, as.numeric(steps),
- as.logical(merges), as.logical(modularity), as.logical(membership),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_walktrap_community, graph, weights, as.numeric(steps),
+ as.logical(merges), as.logical(modularity), as.logical(membership))
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1080,6 +1072,8 @@ cluster_walktrap <- function(graph, weights=E(graph)$weight, steps=4,
#' @param graph The graph to analyze.
#' @param weights The edge weights. Supply \code{NULL} to omit edge weights. By
#' default the \sQuote{\code{weight}} edge attribute is used, if it is present.
+#' Edge weights are used to calculate weighted edge betweenness. This means
+#' that edges are interpreted as distances, not as connection strengths.
#' @param directed Logical constant, whether to calculate directed edge
#' betweenness for directed graphs. It is ignored for undirected graphs.
#' @param edge.betweenness Logical constant, whether to return the edge
@@ -1121,7 +1115,7 @@ cluster_walktrap <- function(graph, weights=E(graph)$weight, steps=4,
#' @keywords graphs
#' @examples
#'
-#' g <- barabasi.game(100,m=2)
+#' g <- sample_pa(100, m = 2, directed = FALSE)
#' eb <- cluster_edge_betweenness(g)
#'
#' g <- make_full_graph(10) %du% make_full_graph(10)
@@ -1143,13 +1137,12 @@ cluster_edge_betweenness <- function(graph, weights=E(graph)$weight,
weights <- as.numeric(weights)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_community_edge_betweenness", graph, weights,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_community_edge_betweenness, graph, weights,
as.logical(directed),
as.logical(edge.betweenness),
as.logical(merges), as.logical(bridges),
- as.logical(modularity), as.logical(membership),
- PACKAGE="igraph")
+ as.logical(modularity), as.logical(membership))
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1185,6 +1178,7 @@ cluster_edge_betweenness <- function(graph, weights=E(graph)$weight,
#' The length must match the number of edges in the graph. By default the
#' \sQuote{\code{weight}} edge attribute is used as weights. If it is not
#' present, then all edges are considered to have the same weight.
+#' Larger edge weights correspond to stronger connections.
#' @return \code{cluster_fast_greedy} returns a \code{\link{communities}}
#' object, please see the \code{\link{communities}} manual page for details.
#' @author Tamas Nepusz \email{ntamas@@gmail.com} and Gabor Csardi
@@ -1218,10 +1212,9 @@ cluster_fast_greedy <- function(graph, merges=TRUE, modularity=TRUE,
weights <- as.numeric(weights)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_community_fastgreedy", graph, as.logical(merges),
- as.logical(modularity), as.logical(membership), weights,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_community_fastgreedy, graph, as.logical(merges),
+ as.logical(modularity), as.logical(membership), weights)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1236,8 +1229,7 @@ cluster_fast_greedy <- function(graph, merges=TRUE, modularity=TRUE,
igraph.i.levc.arp <- function(externalP, externalE) {
f <- function(v) {
v <- as.numeric(v)
- base::.Call("R_igraph_i_levc_arp", externalP, externalE, v,
- PACKAGE="igraph");
+ .Call(C_R_igraph_i_levc_arp, externalP, externalE, v)
}
f
}
@@ -1275,9 +1267,10 @@ igraph.i.levc.arp <- function(externalP, externalE) {
#' symmetric matrix.
#' @param steps The number of steps to take, this is actually the number of
#' tries to make a step. It is not a particularly useful parameter.
-#' #' @param weights An optional weight vector. The \sQuote{weight} edge attribute
+#' @param weights An optional weight vector. The \sQuote{weight} edge attribute
#' is used if present. Supply \sQuote{\code{NA}} here if you want to ignore the
-#' \sQuote{weight} edge attribute.
+#' \sQuote{weight} edge attribute. Larger edge weights correspond to stronger
+#' connections between vertices.
#' @param start \code{NULL}, or a numeric membership vector, giving the start
#' configuration of the algorithm.
#' @param options A named list to override some ARPACK options.
@@ -1351,12 +1344,11 @@ cluster_leading_eigen <- function(graph, steps=-1, weights=NULL,
if (!is.null(start)) { start <- as.numeric(start)-1 }
options.tmp <- arpack_defaults; options.tmp[ names(options) ] <- options ; options <- options.tmp
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_community_leading_eigenvector", graph, steps,
+ res <- .Call(C_R_igraph_community_leading_eigenvector, graph, steps,
weights, options, start, callback, extra, env,
- environment(igraph.i.levc.arp),
- PACKAGE="igraph")
+ environment(igraph.i.levc.arp))
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1393,7 +1385,8 @@ cluster_leading_eigen <- function(graph, steps=-1, weights=NULL,
#' @param weights An optional weight vector. It should contain a positive
#' weight for all the edges. The \sQuote{weight} edge attribute is used if
#' present. Supply \sQuote{\code{NA}} here if you want to ignore the
-#' \sQuote{weight} edge attribute.
+#' \sQuote{weight} edge attribute. Larger edge weights correspond to
+#' stronger connections.
#' @param initial The initial state. If \code{NULL}, every vertex will have a
#' different label at the beginning. Otherwise it must be a vector with an
#' entry for each vertex. Non-negative values denote different labels, negative
@@ -1436,10 +1429,9 @@ cluster_label_prop <- function(graph, weights=NULL, initial=NULL,
if (!is.null(initial)) initial <- as.numeric(initial)
if (!is.null(fixed)) fixed <- as.logical(fixed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_community_label_propagation", graph, weights, initial, fixed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_community_label_propagation, graph, weights, initial, fixed)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1479,7 +1471,7 @@ cluster_label_prop <- function(graph, weights=NULL, initial=NULL,
#' @param weights Optional positive weight vector. If the graph has a
#' \code{weight} edge attribute, then this is used by default. Supply \code{NA}
#' here if the graph has a \code{weight} edge attribute, but you want to ignore
-#' it.
+#' it. Larger edge weights correspond to stronger connections.
#' @return \code{cluster_louvain} returns a \code{\link{communities}}
#' object, please see the \code{\link{communities}} manual page for details.
#' @author Tom Gregorovic, Tamas Nepusz \email{ntamas@@gmail.com}
@@ -1516,10 +1508,9 @@ cluster_louvain <- function(graph, weights=NULL) {
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_community_multilevel", graph, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_community_multilevel, graph, weights)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1557,6 +1548,7 @@ cluster_louvain <- function(graph, weights=NULL) {
#' @param weights Optional positive weight vector for optimizing weighted
#' modularity. If the graph has a \code{weight} edge attribute, then this is
#' used by default. Supply \code{NA} to ignore the weights of a weighted graph.
+#' Larger edge weights correspond to stronger connections.
#' @return \code{cluster_optimal} returns a \code{\link{communities}} object,
#' please see the \code{\link{communities}} manual page for details.
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
@@ -1602,10 +1594,9 @@ cluster_optimal <- function(graph, weights=NULL) {
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_community_optimal_modularity", graph, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_community_optimal_modularity, graph, weights)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
}
@@ -1631,10 +1622,13 @@ cluster_optimal <- function(graph, weights=NULL) {
#' The length must match the number of edges in the graph. By default the
#' \sQuote{\code{weight}} edge attribute is used as weights. If it is not
#' present, then all edges are considered to have the same weight.
+#' Larger edge weights correspond to stronger connections.
#' @param v.weights If not \code{NULL}, then a numeric vector of vertex
#' weights. The length must match the number of vertices in the graph. By
#' default the \sQuote{\code{weight}} vertex attribute is used as weights. If
#' it is not present, then all vertices are considered to have the same weight.
+#' A larger vertex weight means a larger probability that the random surfer
+#' jumps to that vertex.
#' @param nb.trials The number of attempts to partition the network (can be any
#' integer value equal or larger than 1).
#' @param modularity Logical scalar, whether to calculate the modularity score
@@ -1689,11 +1683,10 @@ cluster_infomap <- function(graph, e.weights=NULL, v.weights=NULL,
}
nb.trials <- as.integer(nb.trials)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_community_infomap", graph, e.weights,
- v.weights, nb.trials,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_community_infomap, graph, e.weights,
+ v.weights, nb.trials)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
@@ -1711,6 +1704,7 @@ cluster_infomap <- function(graph, e.weights=NULL, v.weights=NULL,
#' @rdname communities
#' @method plot communities
#' @export
+#' @importFrom graphics plot
plot.communities <- function(x, y,
col=membership(x),
@@ -1836,6 +1830,10 @@ plot_dendrogram.communities <- function(x,
}
}
+#' @importFrom grDevices palette
+#' @importFrom graphics plot
+#' @importFrom stats rect.hclust
+
dendPlotHclust <- function(communities, rect=length(communities),
colbar=palette(), hang=-1, ann=FALSE,
main="", sub="", xlab="", ylab="", ...,
@@ -1849,12 +1847,17 @@ dendPlotHclust <- function(communities, rect=length(communities),
invisible(ret)
}
+#' @importFrom graphics plot
+
dendPlotDendrogram <- function(communities, hang=-1, ...,
use.modularity=FALSE) {
plot(as.dendrogram(communities, hang=hang, use.modularity=use.modularity),
...)
}
+#' @importFrom grDevices palette
+#' @importFrom graphics plot
+
dendPlotPhylo <- function(communities, colbar=palette(),
col=colbar[membership(communities)],
mark.groups=communities(communities),
@@ -1991,9 +1994,8 @@ i_compare <- function (comm1, comm2, method=c("vi", "nmi", "split.join",
}
method <- switch(igraph.match.arg(method), vi = 0, nmi = 1,
split.join = 2, rand = 3, adjusted.rand = 4)
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- res <- .Call("R_igraph_compare_communities", comm1, comm2,
- method, PACKAGE = "igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_compare_communities, comm1, comm2, method)
res
}
@@ -2041,9 +2043,8 @@ split_join_distance <- function(comm1, comm2) {
} else {
as.numeric(comm2)
}
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- res <- .Call("R_igraph_split_join_distance", comm1, comm2,
- PACKAGE = "igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_split_join_distance, comm1, comm2)
unlist(res)
}
diff --git a/R/components.R b/R/components.R
index 80400c6..ae8ed69 100644
--- a/R/components.R
+++ b/R/components.R
@@ -32,9 +32,8 @@ count_components <- function(graph, mode=c("weak", "strong")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "weak"=1, "strong"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_no_clusters", graph, as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_no_clusters, graph, as.numeric(mode))
}
#' @rdname components
@@ -43,6 +42,7 @@ count_components <- function(graph, mode=c("weak", "strong")) {
#' @param mul.size Logical. If TRUE the relative frequencies will be multiplied
#' by the cluster sizes.
#' @export
+#' @importFrom graphics hist
component_distribution <- function(graph, cumulative=FALSE, mul.size=FALSE,
...) {
@@ -74,9 +74,8 @@ is_connected <- function(graph, mode=c("weak", "strong")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "weak"=1, "strong"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_is_connected", graph, as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_is_connected, graph, as.numeric(mode))
}
@@ -122,11 +121,9 @@ decompose <- function(graph, mode=c("weak", "strong"), max.comps=NA,
if (is.na(max.comps)) {
max.comps=-1
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_decompose", graph, as.numeric(mode),
- as.numeric(max.comps), as.numeric(min.vertices),
- PACKAGE="igraph"
- )
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_decompose, graph, as.numeric(mode),
+ as.numeric(max.comps), as.numeric(min.vertices))
}
diff --git a/R/console.R b/R/console.R
index 5d50af4..432e880 100644
--- a/R/console.R
+++ b/R/console.R
@@ -55,6 +55,8 @@
0L
}
+#' @importFrom utils txtProgressBar setTxtProgressBar
+
.igraph.progress.txt <- function(percent, message) {
pb <- get(".igraph.pb", asNamespace("igraph"))
if (percent==0) {
diff --git a/R/conversion.R b/R/conversion.R
index b1e30ba..f7aa2b3 100644
--- a/R/conversion.R
+++ b/R/conversion.R
@@ -30,9 +30,9 @@ get.adjacency.dense <- function(graph, type=c("both", "upper", "lower"),
type <- switch(type, "upper"=0, "lower"=1, "both"=2)
if (edges || is.null(attr)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_get_adjacency", graph, as.numeric(type),
- as.logical(edges), PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_get_adjacency, graph, as.numeric(type),
+ as.logical(edges))
} else {
attr <- as.character(attr)
if (! attr %in% edge_attr_names(graph)) {
@@ -240,9 +240,9 @@ as_edgelist <- function(graph, names=TRUE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- matrix(.Call("R_igraph_get_edgelist", graph, TRUE,
- PACKAGE="igraph"), ncol=2)
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- matrix(.Call(C_R_igraph_get_edgelist, graph, TRUE),
+ ncol=2)
res <- res+1
if (names && "name" %in% vertex_attr_names(graph)) {
res <- matrix(V(graph)$name[ res ], ncol=2)
@@ -322,9 +322,8 @@ as.directed <- function(graph, mode=c("mutual", "arbitrary")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "arbitrary"=0, "mutual"=1)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_to_directed", graph, as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_to_directed, graph, as.numeric(mode))
}
#' @rdname as.directed
@@ -341,10 +340,9 @@ as.undirected <- function(graph, mode=c("collapse", "each", "mutual"), edge.attr
mode <- switch(igraph.match.arg(mode), "collapse"=1, "each"=0, "mutual"=2)
edge.attr.comb <- igraph.i.attribute.combination(edge.attr.comb)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_to_undirected", graph, mode, edge.attr.comb,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_to_undirected, graph, mode, edge.attr.comb)
res
}
@@ -387,9 +385,8 @@ as_adj_list <- function(graph, mode=c("all", "out", "in", "total")) {
mode <- igraph.match.arg(mode)
mode <- as.numeric(switch(mode, "out"=1, "in"=2, "all"=3, "total"=3))
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_get_adjlist", graph, mode,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_get_adjlist, graph, mode)
res <- lapply(res, function(x) V(graph)[x + 1])
if (is_named(graph)) names(res) <- V(graph)$name
res
@@ -406,9 +403,8 @@ as_adj_edge_list <- function(graph, mode=c("all", "out", "in", "total")) {
mode <- igraph.match.arg(mode)
mode <- as.numeric(switch(mode, "out"=1, "in"=2, "all"=3, "total"=3))
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_get_adjedgelist", graph, mode,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_get_adjedgelist, graph, mode)
res <- lapply(res, function(x) E(graph)[x + 1])
if (is_named(graph)) names(res) <- V(graph)$name
res
@@ -518,7 +514,7 @@ graph_from_graphnel <- function(graphNEL, name=TRUE, weight=TRUE,
#' way to represent graphs. These functions are provided to convert between
#' the igraph and the graphNEL objects.
#'
-#' \code{as_graphnel} converts and igraph graph to a graphNEL graph. It
+#' \code{as_graphnel} converts an igraph graph to a graphNEL graph. It
#' converts all graph/vertex/edge attributes. If the igraph graph has a
#' vertex attribute \sQuote{\code{name}}, then it will be used to assign
#' vertex names in the graphNEL graph. Otherwise numeric igraph vertex ids
@@ -579,7 +575,7 @@ as_graphnel <- function(graph) {
}
names(al) <- name
- res <- new("graphNEL", nodes=name, edgeL=al, edgemode=edgemode)
+ res <- graph::graphNEL(nodes=name, edgeL=al, edgemode=edgemode)
## Add graph attributes (other than 'directed')
## Are this "officially" supported at all?
@@ -626,10 +622,9 @@ as_graphnel <- function(graph) {
get.incidence.dense <- function(graph, types, names, attr) {
if (is.null(attr)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
## Function call
- res <- .Call("R_igraph_get_incidence", graph, types,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_get_incidence, graph, types)
if (names && "name" %in% vertex_attr_names(graph)) {
rownames(res$res) <- V(graph)$name[ res$row_ids+1 ]
@@ -801,7 +796,7 @@ as_data_frame <- function(x, what=c("edges", "vertices", "both")) {
what <- igraph.match.arg(what)
if (what %in% c("vertices", "both")) {
- ver <- .Call("R_igraph_mybracket2", x, 9L, 3L, PACKAGE="igraph")
+ ver <- .Call(C_R_igraph_mybracket2, x, 9L, 3L)
class(ver) <- "data.frame"
rn <- if (is_named(x)) { V(x)$name } else { seq_len(vcount(x)) }
rownames(ver) <- rn
@@ -810,7 +805,7 @@ as_data_frame <- function(x, what=c("edges", "vertices", "both")) {
if (what %in% c("edges", "both")) {
el <- as_edgelist(x)
edg <- c(list(from=el[,1]), list(to=el[,2]),
- .Call("R_igraph_mybracket2", x, 9L, 4L, PACKAGE="igraph"))
+ .Call(C_R_igraph_mybracket2, x, 9L, 4L))
class(edg) <- "data.frame"
rownames(edg) <- seq_len(ecount(x))
}
@@ -906,14 +901,14 @@ as_long_data_frame <- function(graph) {
if (!is_igraph(graph)) { stop("Not a graph object") }
- ver <- .Call("R_igraph_mybracket2", graph, 9L, 3L, PACKAGE="igraph")
+ ver <- .Call(C_R_igraph_mybracket2, graph, 9L, 3L)
class(ver) <- "data.frame"
rn <- if (is_named(graph)) { V(graph)$name } else { seq_len(vcount(graph)) }
rownames(ver) <- rn
el <- as_edgelist(graph, names = FALSE)
edg <- c(list(from=el[,1]), list(to=el[,2]),
- .Call("R_igraph_mybracket2", graph, 9L, 4L, PACKAGE="igraph"))
+ .Call(C_R_igraph_mybracket2, graph, 9L, 4L))
class(edg) <- "data.frame"
rownames(edg) <- seq_len(ecount(graph))
diff --git a/R/decomposition.R b/R/decomposition.R
index 5cb0fc6..e32d66d 100644
--- a/R/decomposition.R
+++ b/R/decomposition.R
@@ -91,9 +91,9 @@ is_chordal <- function(graph, alpha = NULL, alpham1 = NULL,
alpham1 <- as.numeric(alpham1)-1
fillin <- as.logical(fillin)
newgraph <- as.logical(newgraph)
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- res <- .Call("R_igraph_is_chordal", graph, alpha, alpham1,
- fillin, newgraph, PACKAGE = "igraph")
+ on.exit(.Call(C_R_igraph_finalizer))
+ res <- .Call(C_R_igraph_is_chordal, graph, alpha, alpham1,
+ fillin, newgraph)
if (fillin) { res$fillin <- res$fillin + 1 }
res
}
diff --git a/R/embedding.R b/R/embedding.R
index d2a75d9..b452d99 100644
--- a/R/embedding.R
+++ b/R/embedding.R
@@ -49,9 +49,10 @@
#' spectral embedding. Should be smaller than the number of vertices. The
#' largest \code{no}-dimensional non-zero singular values are used for the
#' spectral embedding.
-#' @param weights Optional positive weight vector for calculating weighted
-#' closeness. If the graph has a \code{weight} edge attribute, then this is
-#' used by default.
+#' @param weights Optional positive weight vector for calculating a weighted
+#' embedding. If the graph has a \code{weight} edge attribute, then this is
+#' used by default. In a weighted embedding, the edge weights are used instead
+#' of the binary adjacencny matrix.
#' @param which Which eigenvalues (or singular values, for directed graphs) to
#' use. \sQuote{lm} means the ones with the largest magnitude, \sQuote{la} is
#' the ones (algebraic) largest, and \sQuote{sa} is the (algebraic) smallest
@@ -166,9 +167,11 @@ dim_select <- dim_select
#' spectral embedding. Should be smaller than the number of vertices. The
#' largest \code{no}-dimensional non-zero singular values are used for the
#' spectral embedding.
-#' @param weights Optional positive weight vector for calculating weighted
-#' closeness. If the graph has a \code{weight} edge attribute, then this is
-#' used by default.
+#' @param weights Optional positive weight vector for calculating a weighted
+#' embedding. If the graph has a \code{weight} edge attribute, then this is
+#' used by default. For weighted embedding, edge weights are used instead
+#' of the binary adjacency matrix, and vertex stregth (see
+#' \code{\link{strength}}) is used instead of the degrees.
#' @param which Which eigenvalues (or singular values, for directed graphs) to
#' use. \sQuote{lm} means the ones with the largest magnitude, \sQuote{la} is
#' the ones (algebraic) largest, and \sQuote{sa} is the (algebraic) smallest
@@ -259,10 +262,9 @@ sample_sphere_surface <- function(dim, n=1, radius=1, positive=TRUE) {
radius <- as.numeric(radius)
positive <- as.logical(positive)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sample_sphere_surface", dim, n, radius, positive,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sample_sphere_surface, dim, n, radius, positive)
res
}
@@ -301,10 +303,9 @@ sample_sphere_volume <- function(dim, n=1, radius=1, positive=TRUE) {
radius <- as.numeric(radius)
positive <- as.logical(positive)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sample_sphere_volume", dim, n, radius, positive,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sample_sphere_volume, dim, n, radius, positive)
res
}
@@ -338,10 +339,9 @@ sample_dirichlet <- function(n, alpha) {
n <- as.integer(n)
alpha <- as.numeric(alpha)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_sample_dirichlet", n, alpha,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_sample_dirichlet, n, alpha)
res
}
diff --git a/R/epi.R b/R/epi.R
index 9e748d5..2223def 100644
--- a/R/epi.R
+++ b/R/epi.R
@@ -27,6 +27,7 @@ time_bins <- function(x, middle=TRUE)
#' @method time_bins sir
#' @rdname sir
#' @export
+#' @importFrom stats IQR
time_bins.sir <- function(x, middle=TRUE) {
sir <- x
@@ -49,7 +50,7 @@ time_bins.sir <- function(x, middle=TRUE) {
#' @rdname sir
#' @export
-median.sir <- function(x, na.rm=FALSE) {
+median.sir <- function(x, na.rm=FALSE, ...) {
sir <- x
if (!inherits(sir, "sir")) {
stop("This is not an SIR model output")
@@ -136,6 +137,7 @@ quantile.sir <- function(x, comp=c("NI", "NS", "NR"), prob, ...) {
#' infectious diseases and its applications (2nd ed.). London: Griffin.
#' @method plot sir
#' @export
+#' @importFrom graphics plot lines
#' @keywords graphs
#' @examples
#'
diff --git a/R/fit.R b/R/fit.R
index de2d752..3e893a2 100644
--- a/R/fit.R
+++ b/R/fit.R
@@ -177,10 +177,9 @@ power.law.fit.new <- function(data, xmin=-1, force.continuous=FALSE) {
xmin <- as.numeric(xmin)
force.continuous <- as.logical(force.continuous)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_power_law_fit", data, xmin, force.continuous,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_power_law_fit, data, xmin, force.continuous)
res
}
diff --git a/R/flow.R b/R/flow.R
index 124394a..5348b02 100644
--- a/R/flow.R
+++ b/R/flow.R
@@ -100,14 +100,12 @@ min_cut <- function(graph, source=NULL, target=NULL, capacity=NULL,
}
value.only <- as.logical(value.only)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (is.null(target) && is.null(source)) {
if (value.only) {
- res <- .Call("R_igraph_mincut_value", graph, capacity,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mincut_value, graph, capacity)
} else {
- res <- .Call("R_igraph_mincut", graph, capacity,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_mincut, graph, capacity)
res$cut <- res$cut + 1
res$partition1 <- res$partition1 + 1
res$partition2 <- res$partition2 + 1
@@ -122,10 +120,9 @@ min_cut <- function(graph, source=NULL, target=NULL, capacity=NULL,
}
} else {
if (value.only) {
- res <- .Call("R_igraph_st_mincut_value", graph,
+ res <- .Call(C_R_igraph_st_mincut_value, graph,
as.igraph.vs(graph, source)-1,
- as.igraph.vs(graph, target)-1, capacity,
- PACKAGE="igraph")
+ as.igraph.vs(graph, target)-1, capacity)
} else {
stop("Calculating minimum s-t cuts is not implemented yet")
}
@@ -216,14 +213,12 @@ vertex_connectivity <- function(graph, source=NULL, target=NULL, checks=TRUE) {
}
if (is.null(source) && is.null(target)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_vertex_connectivity", graph, as.logical(checks),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_vertex_connectivity, graph, as.logical(checks))
} else if (!is.null(source) && !is.null(target)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_st_vertex_connectivity", graph, as.igraph.vs(graph, source)-1,
- as.igraph.vs(graph, target)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_st_vertex_connectivity, graph, as.igraph.vs(graph, source)-1,
+ as.igraph.vs(graph, target)-1)
} else {
stop("either give both source and target or neither")
}
@@ -301,14 +296,12 @@ edge_connectivity <- function(graph, source=NULL, target=NULL, checks=TRUE) {
}
if (is.null(source) && is.null(target)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_edge_connectivity", graph, as.logical(checks),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_edge_connectivity, graph, as.logical(checks))
} else if (!is.null(source) && !is.null(target)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_st_edge_connectivity", graph,
- as.igraph.vs(graph, source)-1, as.igraph.vs(graph, target)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_st_edge_connectivity, graph,
+ as.igraph.vs(graph, source)-1, as.igraph.vs(graph, target)-1)
} else {
stop("either give both source and target or neither")
}
@@ -322,10 +315,9 @@ edge_disjoint_paths <- function(graph, source, target) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_edge_disjoint_paths", graph,
- as.igraph.vs(graph, source)-1, as.igraph.vs(graph, target)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_edge_disjoint_paths, graph,
+ as.igraph.vs(graph, source)-1, as.igraph.vs(graph, target)-1)
}
#' @export
@@ -336,10 +328,9 @@ vertex_disjoint_paths <- function(graph, source=NULL, target=NULL) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_vertex_disjoint_paths", graph, as.igraph.vs(graph, source)-1,
- as.igraph.vs(graph, target)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_vertex_disjoint_paths, graph, as.igraph.vs(graph, source)-1,
+ as.igraph.vs(graph, target)-1)
}
#' @export
@@ -350,9 +341,8 @@ adhesion <- function(graph, checks=TRUE) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_adhesion", graph, as.logical(checks),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_adhesion, graph, as.logical(checks))
}
#' @rdname vertex_connectivity
@@ -365,9 +355,8 @@ cohesion.igraph <- function(x, checks=TRUE, ...) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_cohesion", x, as.logical(checks),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_cohesion, x, as.logical(checks))
}
#' List all (s,t)-cuts of a graph
@@ -572,6 +561,7 @@ min_st_separators <- min_st_separators
#' @param target The id of the target vertex (sometimes also called sink).
#' @param capacity Vector giving the capacity of the edges. If this is
#' \code{NULL} (the default) then the \code{capacity} edge attribute is used.
+#' Note that the \code{weight} edge attribute is not used by this function.
#' @return A named list with components:
#' \item{value}{A numeric scalar, the value of the maximum flow.}
#' \item{flow}{A numeric vector, the flow itself, one entry for each
diff --git a/R/foreign.R b/R/foreign.R
index 65871aa..b23da02 100644
--- a/R/foreign.R
+++ b/R/foreign.R
@@ -208,10 +208,9 @@ read.graph.edgelist <- function(file, n=0,
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (edgelist format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_edgelist", file,
- as.numeric(n), as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_edgelist, file,
+ as.numeric(n), as.logical(directed))
}
write.graph.edgelist <- function(graph, file, ...) {
@@ -219,9 +218,8 @@ write.graph.edgelist <- function(graph, file, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to write_graph (edgelist format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_edgelist", graph, file,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_edgelist, graph, file)
}
################################################################
@@ -236,10 +234,9 @@ read.graph.ncol <- function(file, predef=character(0), names=TRUE,
stop("Unknown arguments to read_graph (NCOL format)")
}
weights <- switch(igraph.match.arg(weights), "no"=0, "yes"=1, "auto"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_ncol", file, as.character(predef),
- as.logical(names), as.numeric(weights), as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_ncol, file, as.character(predef),
+ as.logical(names), as.numeric(weights), as.logical(directed))
}
write.graph.ncol <- function(graph, file,
@@ -252,10 +249,9 @@ write.graph.ncol <- function(graph, file,
if (length(names)==0 || ! names %in% vertex_attr_names(graph)) { names <- NULL }
if (length(weights)==0 || ! weights %in% edge_attr_names(graph)) { weights <- NULL }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_ncol", graph, file,
- names, weights,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_ncol, graph, file,
+ names, weights)
}
read.graph.lgl <- function(file, names=TRUE,
@@ -267,10 +263,9 @@ read.graph.lgl <- function(file, names=TRUE,
stop("Unknown arguments to read_graph (LGL format)")
}
weights <- switch(igraph.match.arg(weights), "no"=0, "yes"=1, "auto"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_lgl", file,
- as.logical(names), as.numeric(weights), as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_lgl, file,
+ as.logical(names), as.numeric(weights), as.logical(directed))
}
write.graph.lgl <- function(graph, file,
@@ -284,10 +279,9 @@ write.graph.lgl <- function(graph, file,
if (length(names)==0 || ! names %in% vertex_attr_names(graph)) { names <- NULL }
if (length(weights)==0 || ! weights %in% edge_attr_names(graph)) { weights <- NULL }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_lgl", graph, file,
- names, weights, as.logical(isolates),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_lgl, graph, file,
+ names, weights, as.logical(isolates))
}
read.graph.pajek <- function(file, ...) {
@@ -295,9 +289,8 @@ read.graph.pajek <- function(file, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (Pajek format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_read_graph_pajek", file,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_read_graph_pajek, file)
if ("type" %in% vertex_attr_names(res)) {
type <- as.logical(V(res)$type)
res <- delete_vertex_attr(res, "type")
@@ -311,9 +304,8 @@ write.graph.pajek <- function(graph, file, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to write_graph (Pajek format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_pajek", graph, file,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_pajek, graph, file)
}
read.graph.dimacs <- function(file, directed=TRUE, ...) {
@@ -321,8 +313,7 @@ read.graph.dimacs <- function(file, directed=TRUE, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (DIMACS format)")
}
- res <- .Call("R_igraph_read_graph_dimacs", file, as.logical(directed),
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_read_graph_dimacs, file, as.logical(directed))
if (res[[1]][1] == "max") {
graph <- res[[2]]
graph <- set_graph_attr(graph, "problem", res[[1]])
@@ -354,10 +345,9 @@ write.graph.dimacs <- function(graph, file,
capacity <- E(graph)$capacity
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_dimacs", graph, file, as.numeric(source),
- as.numeric(target), as.numeric(capacity),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_dimacs, graph, file, as.numeric(source),
+ as.numeric(target), as.numeric(capacity))
}
################################################################
@@ -369,9 +359,8 @@ read.graph.graphml <- function(file, index=0, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (GraphML format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_graphml", file, as.numeric(index),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_graphml, file, as.numeric(index))
}
write.graph.graphml <- function(graph, file, prefixAttr=TRUE, ...) {
@@ -379,9 +368,8 @@ write.graph.graphml <- function(graph, file, prefixAttr=TRUE, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to write_graph (GraphML format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_graphml", graph, file, as.logical(prefixAttr),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_graphml, graph, file, as.logical(prefixAttr))
}
################################################################
@@ -392,9 +380,8 @@ read.graph.gml <- function(file, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (GML format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_gml", file,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_gml, file)
}
write.graph.gml <- function(graph, file, id=NULL, creator=NULL, ...) {
@@ -407,9 +394,8 @@ write.graph.gml <- function(graph, file, id=NULL, creator=NULL, ...) {
if (!is.null(creator)) {
creator <- as.character(creator)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_gml", graph, file, id, creator,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_gml, graph, file, id, creator)
}
################################################################
@@ -420,9 +406,8 @@ read.graph.dl <- function(file, directed=TRUE, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (DL format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_dl", file, as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_dl, file, as.logical(directed))
}
################################################################
@@ -433,9 +418,8 @@ write.graph.dot <- function(graph, file, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to write_graph (DOT format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_dot", graph, file,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_dot, graph, file)
}
################################################################
@@ -557,18 +541,15 @@ graph_from_graphdb <- function(url=NULL,
f <- tempfile()
write.graph.fromraw(buffer, f)
- .Call("R_igraph_read_graph_graphdb", f, as.logical(directed),
- PACKAGE="igraph")
-
+ .Call(C_R_igraph_read_graph_graphdb, f, as.logical(directed))
}
read.graph.graphdb <- function(file, directed=TRUE, ...) {
if (length(list(...))>0) {
stop("Unknown arguments to read_graph (GraphDB format)")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_read_graph_graphdb", file, as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_read_graph_graphdb, file, as.logical(directed))
}
write.graph.leda <- function(graph, file, vertex.attr=NULL, edge.attr=NULL,
@@ -578,7 +559,6 @@ write.graph.leda <- function(graph, file, vertex.attr=NULL, edge.attr=NULL,
}
if (!is.null(vertex.attr)) { vertex.attr <- as.character(vertex.attr) }
if (!is.null(edge.attr)) { edge.attr <- as.character(edge.attr) }
- on.exit(.Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_write_graph_leda", graph, file, vertex.attr, edge.attr,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_write_graph_leda, graph, file, vertex.attr, edge.attr)
}
diff --git a/R/games.R b/R/games.R
index cbb4f7d..42d982c 100644
--- a/R/games.R
+++ b/R/games.R
@@ -162,10 +162,9 @@ sample_pa <- function(n, power=1, m=NULL, out.dist=NULL, out.seq=NULL,
"psumtree"=1, "psumtree-multiple"=2,
"bag"=0)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_barabasi_game", n, power, m, out.seq, out.pref,
- zero.appeal, directed, algorithm1, start.graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_barabasi_game, n, power, m, out.seq, out.pref,
+ zero.appeal, directed, algorithm1, start.graph)
if (igraph_opt("add.params")) {
res$name <- "Barabasi graph"
@@ -220,10 +219,9 @@ sample_gnp <- function(n, p, directed = FALSE, loops = FALSE) {
type <- "gnp"
type1 <- switch(type, "gnp"=0, "gnm"=1)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_erdos_renyi_game", as.numeric(n), as.numeric(type1),
- as.numeric(p), as.logical(directed), as.logical(loops),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_erdos_renyi_game, as.numeric(n), as.numeric(type1),
+ as.numeric(p), as.logical(directed), as.logical(loops))
if (igraph_opt("add.params")) {
res$name <- sprintf("Erdos renyi (%s) graph", type)
@@ -276,10 +274,9 @@ sample_gnm <- function(n, m, directed = FALSE, loops = FALSE) {
type <- "gnm"
type1 <- switch(type, "gnp"=0, "gnm"=1)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_erdos_renyi_game", as.numeric(n), as.numeric(type1),
- as.numeric(m), as.logical(directed), as.logical(loops),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_erdos_renyi_game, as.numeric(n), as.numeric(type1),
+ as.numeric(m), as.logical(directed), as.logical(loops))
if (igraph_opt("add.params")) {
res$name <- sprintf("Erdos renyi (%s) graph", type)
@@ -348,10 +345,9 @@ erdos.renyi.game <- function(n, p.or.m, type=c("gnp", "gnm"),
type <- igraph.match.arg(type)
type1 <- switch(type, "gnp"=0, "gnm"=1)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_erdos_renyi_game", as.numeric(n), as.numeric(type1),
- as.numeric(p.or.m), as.logical(directed), as.logical(loops),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_erdos_renyi_game, as.numeric(n), as.numeric(type1),
+ as.numeric(p.or.m), as.logical(directed), as.logical(loops))
if (igraph_opt("add.params")) {
res$name <- sprintf("Erdos renyi (%s) graph", type)
@@ -397,8 +393,7 @@ random.graph.game <- erdos.renyi.game
#' with the given degree sequence (if this is possible at all). Then some
#' rewiring is done to make the graph connected. Finally a Monte-Carlo
#' algorithm is used to randomize the graph. The \dQuote{vl} samples from the
-#' undirected, connected simple graphs unformly. See
-#' \url{http://www-rp.lip6.fr/~latapy/FV/generation.html} for details.
+#' undirected, connected simple graphs unformly.
#'
#' @aliases degree.sequence.game
#' @param out.deg Numeric vector, the sequence of degrees (for undirected
@@ -453,10 +448,9 @@ sample_degseq <- function(out.deg, in.deg=NULL,
method1 <- switch(method, "simple"=0, "vl"=1, "simple.no.multiple"=2)
if (!is.null(in.deg)) { in.deg <- as.numeric(in.deg) }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_degree_sequence_game", as.numeric(out.deg),
- in.deg, as.numeric(method1),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_degree_sequence_game, as.numeric(out.deg),
+ in.deg, as.numeric(method1))
if (igraph_opt("add.params")) {
res$name <- "Degree sequence random graph"
res$method <- method
@@ -500,10 +494,9 @@ degseq <- function(...) constructor_spec(sample_degseq, ...)
#' g2 <- sample_growing(500, citation=TRUE)
#'
sample_growing <- function(n, m=1, directed=TRUE, citation=FALSE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_growing_random_game", as.numeric(n), as.numeric(m),
- as.logical(directed), as.logical(citation),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_growing_random_game, as.numeric(n), as.numeric(m),
+ as.logical(directed), as.logical(citation))
if (igraph_opt("add.params")) {
res$name <- "Growing random graph"
res$m <- m
@@ -677,21 +670,18 @@ sample_pa_age <- function(n, pa.exp, aging.exp, m=NULL, aging.bin=300,
out.seq <- numeric()
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
res <- if (is.null(time.window)) {
- .Call("R_igraph_barabasi_aging_game", as.numeric(n),
+ .Call(C_R_igraph_barabasi_aging_game, as.numeric(n),
as.numeric(pa.exp), as.numeric(aging.exp),
as.numeric(aging.bin), m, out.seq,
out.pref, as.numeric(zero.deg.appeal), as.numeric(zero.age.appeal),
- as.numeric(deg.coef), as.numeric(age.coef), directed,
- PACKAGE="igraph")
+ as.numeric(deg.coef), as.numeric(age.coef), directed)
} else {
- .Call("R_igraph_recent_degree_aging_game", as.numeric(n),
+ .Call(C_R_igraph_recent_degree_aging_game, as.numeric(n),
as.numeric(pa.exp), as.numeric(aging.exp),
as.numeric(aging.bin), m, out.seq, out.pref, as.numeric(zero.deg.appeal),
- directed,
- time.window,
- PACKAGE="igraph")
+ directed, time.window)
}
if (igraph_opt("add.params")) {
res$name <- "Aging Barabasi graph"
@@ -762,13 +752,12 @@ sample_traits_callaway <- function(nodes, types, edge.per.step=1,
pref.matrix=matrix(1, types, types),
directed=FALSE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_callaway_traits_game", as.double(nodes),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_callaway_traits_game, as.double(nodes),
as.double(types), as.double(edge.per.step),
as.double(type.dist), matrix(as.double(pref.matrix), types,
types),
- as.logical(directed),
- PACKAGE="igraph")
+ as.logical(directed))
if (igraph_opt("add.params")) {
res$name <- "Trait-based Callaway graph"
res$types <- types
@@ -793,12 +782,11 @@ sample_traits <- function(nodes, types, k=1, type.dist=rep(1, types),
pref.matrix=matrix(1, types, types),
directed=FALSE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_establishment_game", as.double(nodes),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_establishment_game, as.double(nodes),
as.double(types), as.double(k), as.double(type.dist),
matrix(as.double(pref.matrix), types, types),
- as.logical(directed),
- PACKAGE="igraph")
+ as.logical(directed))
if (igraph_opt("add.params")) {
res$name <- "Trait-based growing graph"
res$types <- types
@@ -847,10 +835,9 @@ traits <- function(...) constructor_spec(sample_traits, ...)
#' g2 <- sample_grg(1000, 0.05, torus=TRUE)
#'
sample_grg <- function(nodes, radius, torus=FALSE, coords=FALSE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_grg_game", as.double(nodes), as.double(radius),
- as.logical(torus), as.logical(coords),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_grg_game, as.double(nodes), as.double(radius),
+ as.logical(torus), as.logical(coords))
if (coords) {
V(res[[1]])$x <- res[[2]]
V(res[[1]])$y <- res[[3]]
@@ -931,13 +918,12 @@ sample_pref <- function(nodes, types, type.dist=rep(1, types),
stop("Invalid size for preference matrix")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_preference_game", as.double(nodes),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_preference_game, as.double(nodes),
as.double(types),
as.double(type.dist), as.logical(fixed.sizes),
matrix(as.double(pref.matrix), types, types),
- as.logical(directed), as.logical(loops),
- PACKAGE="igraph")
+ as.logical(directed), as.logical(loops))
V(res[[1]])$type <- res[[2]]+1
if (igraph_opt("add.params")) {
res[[1]]$name <- "Preference random graph"
@@ -972,13 +958,12 @@ sample_asym_pref <- function(nodes, types,
stop("Invalid size for type distribution matrix")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_asymmetric_preference_game",
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_asymmetric_preference_game,
as.double(nodes), as.double(types),
matrix(as.double(type.dist.matrix), types, types),
matrix(as.double(pref.matrix), types, types),
- as.logical(loops),
- PACKAGE="igraph")
+ as.logical(loops))
if (igraph_opt("add.params")) {
res$name <- "Asymmetric preference random graph"
res$types <- types
@@ -986,6 +971,8 @@ sample_asym_pref <- function(nodes, types,
res$pref.matrix <- pref.matrix
res$loops <- loops
}
+
+ res
}
#' @rdname sample_pref
@@ -1003,10 +990,9 @@ connect <- function(graph, order, mode=c("all", "out", "in", "total")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_connect_neighborhood", graph, as.numeric(order),
- as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_connect_neighborhood, graph, as.numeric(order),
+ as.numeric(mode))
}
@@ -1047,11 +1033,10 @@ connect <- function(graph, order, mode=c("all", "out", "in", "total")) {
sample_smallworld <- function(dim, size, nei, p, loops=FALSE,
multiple=FALSE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_watts_strogatz_game", as.numeric(dim),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_watts_strogatz_game, as.numeric(dim),
as.numeric(size), as.numeric(nei), as.numeric(p),
- as.logical(loops), as.logical(multiple),
- PACKAGE="igraph")
+ as.logical(loops), as.logical(multiple))
if (igraph_opt("add.params")) {
res$name <- "Watts-Strogatz random graph"
res$dim <- dim
@@ -1105,11 +1090,10 @@ smallworld <- function(...) constructor_spec(sample_smallworld, ...)
sample_last_cit <- function(n, edges=1, agebins=n/7100, pref=(1:(agebins+1))^-3,
directed=TRUE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_lastcit_game", as.numeric(n), as.numeric(edges),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_lastcit_game, as.numeric(n), as.numeric(edges),
as.numeric(agebins),
- as.numeric(pref), as.logical(directed),
- PACKAGE="igraph")
+ as.numeric(pref), as.logical(directed))
if (igraph_opt("add.params")) {
res$name <- "Random citation graph based on last citation"
res$edges <- edges
@@ -1130,10 +1114,9 @@ last_cit <- function(...) constructor_spec(sample_last_cit, ...)
sample_cit_types <- function(n, edges=1, types=rep(0, n),
pref=rep(1, length(types)),
directed=TRUE, attr=TRUE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_cited_type_game", as.numeric(n), as.numeric(edges),
- as.numeric(types), as.numeric(pref), as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_cited_type_game, as.numeric(n), as.numeric(edges),
+ as.numeric(types), as.numeric(pref), as.logical(directed))
if (attr) {
V(res)$type <- types
}
@@ -1157,11 +1140,10 @@ sample_cit_cit_types <- function(n, edges=1, types=rep(0, n),
ncol=length(types)),
directed=TRUE, attr=TRUE) {
pref <- structure(as.numeric(pref), dim=dim(pref))
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_citing_cited_type_game", as.numeric(n),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_citing_cited_type_game, as.numeric(n),
as.numeric(types), pref, as.numeric(edges),
- as.logical(directed),
- PACKAGE="igraph")
+ as.logical(directed))
if (attr) {
V(res)$type <- types
}
@@ -1251,16 +1233,14 @@ sample_bipartite <- function(n1, n2, type=c("gnp", "gnm"), p, m,
warning("Connection probability `p' is ignored for Gnp graph")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (type=="gnp") {
- res <- .Call("R_igraph_bipartite_game_gnp", n1, n2, p, directed, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_bipartite_game_gnp, n1, n2, p, directed, mode)
res <- set_vertex_attr(res$graph, "type", value=res$types)
res$name <- "Bipartite Gnp random graph"
res$p <- p
} else if (type=="gnm") {
- res <- .Call("R_igraph_bipartite_game_gnm", n1, n2, m, directed, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_bipartite_game_gnm, n1, n2, m, directed, mode)
res <- set_vertex_attr(res$graph, "type", value=res$types)
res$name <- "Bipartite Gnm random graph"
res$m <- m
@@ -1453,7 +1433,7 @@ dot_product <- function(...) constructor_spec(sample_dot_product, ...)
#' island.
#' @param n.inter The number of edges to create between two islands.
#' @return An igraph graph.
-#' @author Samuel Thiriot (\url{https://www.linkedin.com/in/samthiriot})
+#' @author Samuel Thiriot
#' @seealso \code{\link{sample_gnp}}
#' @keywords graphs
#' @examples
diff --git a/R/glet.R b/R/glet.R
index d28ee05..04c4dc9 100644
--- a/R/glet.R
+++ b/R/glet.R
@@ -75,7 +75,7 @@
#' E(g)[ width == 2 ]$color <- "#E495A5"
#' plot(g, layout=co)
#' }
-#' #' @export
+#' @export
graphlet_basis <- function(graph, weights=NULL) {
## Argument checks
@@ -93,10 +93,9 @@ graphlet_basis <- function(graph, weights=NULL) {
graph2 <- graph
graph2[[9]] <- list(c(1,0,1), list(), list(), list())
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
## Function call
- res <- .Call("R_igraph_graphlets_candidate_basis", graph2, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_graphlets_candidate_basis, graph2, weights)
res
}
@@ -119,10 +118,9 @@ graphlet_proj <- function(graph, weights=NULL, cliques, niter=1000,
Mu <- as.numeric(Mu)
niter <- as.integer(niter)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_graphlets_project", graph, weights, cliques, Mu, niter,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_graphlets_project, graph, weights, cliques, Mu, niter)
res
}
diff --git a/R/hrg.R b/R/hrg.R
index 1efab72..a722788 100644
--- a/R/hrg.R
+++ b/R/hrg.R
@@ -123,10 +123,9 @@ fit_hrg <- function(graph, hrg=NULL, start=FALSE, steps=0) {
start <- as.logical(start)
steps <- as.integer(steps)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hrg_fit", graph, hrg, start, steps,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hrg_fit, graph, hrg, start, steps)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
res$names <- V(graph)$name
@@ -295,10 +294,10 @@ predict_edges <- function(graph, hrg=NULL, start=FALSE, num.samples=10000,
num.samples <- as.integer(num.samples)
num.bins <- as.integer(num.bins)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_hrg_predict", graph, hrg, start, num.samples,
- num.bins, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_hrg_predict, graph, hrg, start, num.samples,
+ num.bins)
res$edges <- matrix(res$edges, ncol=2, byrow=TRUE)
class(res$hrg) <- "igraphHRG"
res
@@ -478,8 +477,7 @@ as.hclust.igraphHRG <- function(x, ...) {
hcass <- .C("igraphhcass2", n=as.integer(n),
ia=as.integer(mergeInto[,1]),
ib=as.integer(mergeInto[,2]),
- order=integer(n), iia=integer(n), iib=integer(n),
- PACKAGE="igraph")
+ order=integer(n), iia=integer(n), iib=integer(n))
mynames <- if (is.null(x$names)) 1:n else x$names
res <- list(merge=merge, height=1:nrow(merge), order=hcass$order,
@@ -490,6 +488,7 @@ as.hclust.igraphHRG <- function(x, ...) {
}
#' @method as_phylo igraphHRG
+#' @importFrom stats reorder
as_phylo.igraphHRG <- function(x, ...) {
@@ -603,6 +602,10 @@ plot_dendrogram.igraphHRG <- function(x, mode=igraph_opt("dend.plot.type"), ...)
}
}
+#' @importFrom graphics plot
+#' @importFrom grDevices rainbow
+#' @importFrom stats rect.hclust
+
hrgPlotHclust <- function(x, rect=0, colbar=rainbow(rect), hang=.01,
ann=FALSE, main="", sub="", xlab="", ylab="",
...) {
@@ -615,10 +618,15 @@ hrgPlotHclust <- function(x, rect=0, colbar=rainbow(rect), hang=.01,
invisible(ret)
}
+#' @importFrom graphics plot
+
hrgPlotDendrogram <- function(x, ...) {
plot(as.dendrogram(x), ...)
}
+#' @importFrom graphics plot
+#' @importFrom grDevices rainbow
+
hrgPlotPhylo <- function(x, colbar=rainbow(11, start=.7, end=.1),
edge.color=NULL, use.edge.length=FALSE, ...) {
vc <- length(x$left)+1
diff --git a/R/igraph-package.R b/R/igraph-package.R
index 88d630f..2eaadff 100644
--- a/R/igraph-package.R
+++ b/R/igraph-package.R
@@ -1,5 +1,5 @@
-#' @useDynLib igraph
+#' @useDynLib igraph, .registration = TRUE, .fixes = "C_"
#' @import methods
#' @importFrom magrittr %>%
#' @export make_bipartite_graph
@@ -26,13 +26,13 @@ NULL
#' result of the left hand side.
#'
#' @export
+#' @name %>%
#' @rdname pipe
#' @examples
#' make_ring(10) %>%
#' add_edges(c(1,6)) %>%
#' plot()
-
-`%>%` <- magrittr::`%>%`
+NULL
#' The igraph package
#'
@@ -77,9 +77,8 @@ NULL
#' details.
#'
#' If you want to see the edges of the graph as well, then use the
-#' \code{\link{str.igraph}} function, it is of course enough to type
-#' \code{str} instead of \code{str.igraph}: \preformatted{ > str(g)
-#' IGRAPH U--- 10 10 -- Ring graph
+#' \code{\link{print_all}} function: \preformatted{ > print_all(g)
+#' IGRAPH badcafe U--- 10 10 -- Ring graph
#' + attr: name (g/c), mutual (g/x), circular (g/x)
#' + edges:
#' [1] 1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10 }
diff --git a/R/incidence.R b/R/incidence.R
index 96c85b4..4e0c84e 100644
--- a/R/incidence.R
+++ b/R/incidence.R
@@ -128,10 +128,9 @@ graph.incidence.dense <- function(incidence, directed, mode, multiple,
} else {
mode(incidence) <- "double"
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
## Function call
- res <- .Call("R_igraph_incidence", incidence, directed, mode, multiple,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_incidence, incidence, directed, mode, multiple)
res <- set_vertex_attr(res$graph, "type", value=res$types)
}
diff --git a/R/indexing.R b/R/indexing.R
index 4f934b4..c7bc82f 100644
--- a/R/indexing.R
+++ b/R/indexing.R
@@ -99,7 +99,7 @@
#' have to be \sQuote{weight}: \preformatted{ graph[1, 2, attr="weight"]<- 5
#' graph[from=1:3, to=c(2,3,5)] <- c(1,-1,4)}
#' If an edge is already present in the network, then only its
-#' weigths or other attribute are updated. If the graph is already
+#' weights or other attribute are updated. If the graph is already
#' weighted, then the \code{attr="weight"} setting is implicit, and
#' one does not need to give it explicitly.
#' \item Deleting edges. The replacement syntax allow the deletion of
diff --git a/R/interface.R b/R/interface.R
index 8eb478c..9ea1acb 100644
--- a/R/interface.R
+++ b/R/interface.R
@@ -70,9 +70,8 @@ add_edges <- function(graph, edges, ..., attr = list()) {
}
edges.orig <- ecount(graph)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- graph <- .Call("R_igraph_add_edges", graph, as.igraph.vs(graph, edges)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ graph <- .Call(C_R_igraph_add_edges, graph, as.igraph.vs(graph, edges)-1)
edges.new <- ecount(graph)
if (edges.new-edges.orig != 0) {
@@ -81,10 +80,10 @@ add_edges <- function(graph, edges, ..., attr = list()) {
idx <- numeric()
}
- eattrs <- .Call("R_igraph_mybracket2", graph, 9L, 4L, PACKAGE="igraph")
+ eattrs <- .Call(C_R_igraph_mybracket2, graph, 9L, 4L)
for (i in seq(attrs)) { eattrs[[nam[i]]][idx] <- attrs[[nam[i]]] }
- .Call("R_igraph_mybracket2_set", graph, 9L, 4L, eattrs, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 4L, eattrs)
}
#' Add vertices to a graph
@@ -129,9 +128,8 @@ add_vertices <- function(graph, nv, ..., attr=list()) {
}
vertices.orig <- vcount(graph)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- graph <- .Call("R_igraph_add_vertices", graph, as.numeric(nv),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ graph <- .Call(C_R_igraph_add_vertices, graph, as.numeric(nv))
vertices.new <- vcount(graph)
if (vertices.new-vertices.orig != 0) {
@@ -140,10 +138,10 @@ add_vertices <- function(graph, nv, ..., attr=list()) {
idx <- numeric()
}
- vattrs <- .Call("R_igraph_mybracket2", graph, 9L, 3L, PACKAGE="igraph")
+ vattrs <- .Call(C_R_igraph_mybracket2, graph, 9L, 3L)
for (i in seq(attrs)) { vattrs[[nam[i]]][idx] <- attrs[[nam[i]]] }
- .Call("R_igraph_mybracket2_set", graph, 9L, 3L, vattrs, PACKAGE="igraph")
+ .Call(C_R_igraph_mybracket2_set, graph, 9L, 3L, vattrs)
}
#' Delete edges from a graph
@@ -169,9 +167,8 @@ delete_edges <- function(graph, edges) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_delete_edges", graph, as.igraph.es(graph, edges)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_delete_edges, graph, as.igraph.es(graph, edges)-1)
}
#' Delete vertices from a graph
@@ -199,9 +196,8 @@ delete_vertices <- function(graph, v) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_delete_vertices", graph, as.igraph.vs(graph, v)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_delete_vertices, graph, as.igraph.vs(graph, v)-1)
}
###################################################################
@@ -232,9 +228,8 @@ gsize <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_ecount", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_ecount, graph)
}
#' Neighboring (adjacent) vertices in a graph
@@ -266,10 +261,9 @@ neighbors <- function(graph, v, mode = c("out", "in", "all", "total")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3, "total"=3)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_neighbors", graph, as.igraph.vs(graph, v)-1,
- as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_neighbors, graph, as.igraph.vs(graph, v)-1,
+ as.numeric(mode))
V(graph)[res + 1]
}
@@ -301,10 +295,9 @@ incident <- function(graph, v, mode=c("all", "out", "in", "total")) {
} else {
mode=1
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_incident", graph, as.igraph.vs(graph, v)-1,
- as.numeric(mode),
- PACKAGE="igraph") + 1L
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_incident, graph, as.igraph.vs(graph, v)-1,
+ as.numeric(mode)) + 1L
if (igraph_opt("return.vs.es")) res <- create_es(graph, res)
@@ -331,9 +324,8 @@ is_directed <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_is_directed", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_is_directed, graph)
}
#' Incident vertices of some graph edges
@@ -348,6 +340,7 @@ is_directed <- function(graph) {
#' @family structural queries
#'
#' @export
+#' @importFrom stats na.omit
#' @examples
#' g <- make_ring(5)
#' ends(g, E(g))
@@ -361,15 +354,13 @@ ends <- function(graph, es, names = TRUE) {
es2 <- as.igraph.es(graph, na.omit(es)) - 1
res <- matrix(NA_integer_, ncol = length(es), nrow = 2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (length(es) == 1) {
- res[, !is.na(es)] <- .Call("R_igraph_get_edge", graph, es2,
- PACKAGE="igraph") + 1
+ res[, !is.na(es)] <- .Call(C_R_igraph_get_edge, graph, es2) + 1
} else {
- res[, !is.na(es)] <- .Call("R_igraph_edges", graph, es2,
- PACKAGE="igraph") + 1
+ res[, !is.na(es)] <- .Call(C_R_igraph_edges, graph, es2) + 1
}
if (names && is_named(graph)) {
@@ -432,10 +423,9 @@ get.edge.ids <- function(graph, vp, directed=TRUE, error=FALSE, multi=FALSE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_get_eids", graph, as.igraph.vs(graph, vp)-1,
- as.logical(directed), as.logical(error), as.logical(multi),
- PACKAGE="igraph")+1
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_get_eids, graph, as.igraph.vs(graph, vp)-1,
+ as.logical(directed), as.logical(error), as.logical(multi)) + 1
}
@@ -480,10 +470,9 @@ adjacent_vertices <- function(graph, v,
vv <- as.igraph.vs(graph, v) - 1
mode <- switch(match.arg(mode), "out" = 1, "in" = 2, "all" = 3, "total" = 3)
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
- res <- .Call("R_igraph_adjacent_vertices", graph, vv, mode,
- PACKAGE = "igraph")
+ res <- .Call(C_R_igraph_adjacent_vertices, graph, vv, mode)
if (igraph_opt("return.vs.es")) {
res <- lapply(res, function(x) create_vs(graph, x + 1))
@@ -520,10 +509,9 @@ incident_edges <- function(graph, v,
vv <- as.igraph.vs(graph, v) - 1
mode <- switch(match.arg(mode), "out" = 1, "in" = 2, "all" = 3, "total" = 3)
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
- res <- .Call("R_igraph_incident_edges", graph, vv, mode,
- PACKAGE = "igraph")
+ res <- .Call(C_R_igraph_incident_edges, graph, vv, mode)
if (igraph_opt("return.vs.es")) {
res <- lapply(res, function(x) create_es(graph, x + 1))
diff --git a/R/iterators.R b/R/iterators.R
index 223193a..2cfe96b 100644
--- a/R/iterators.R
+++ b/R/iterators.R
@@ -31,7 +31,7 @@ update_es_ref <- update_vs_ref <- function(graph) {
get_es_ref <- get_vs_ref <- function(graph) {
if (is_igraph(graph) && !warn_version(graph)) {
- base::.Call("R_igraph_mybracket", graph, 10L, PACKAGE = "igraph")
+ .Call(C_R_igraph_mybracket, graph, 10L)
} else {
NULL
}
@@ -75,7 +75,7 @@ get_es_graph_id <- get_vs_graph_id <- function(seq) {
identical_graphs <- function(g1, g2) {
stopifnot(is_igraph(g1), is_igraph(g2))
- base::.Call("R_igraph_identical_graphs", g1, g2, PACKAGE = "igraph");
+ .Call(C_R_igraph_identical_graphs, g1, g2)
}
add_vses_graph_ref <- function(vses, graph) {
@@ -92,6 +92,52 @@ add_vses_graph_ref <- function(vses, graph) {
vses
}
+#' Get the id of a graph
+#'
+#' Graph ids are used to check that a vertex or edge sequence
+#' belongs to a graph. If you create a new graph by changing the
+#' structure of a graph, the new graph will have a new id.
+#' Changing the attributes will not change the id.
+#'
+#' @param x A graph or a vertex sequence or an edge sequence.
+#' @param ... Not used currently.
+#' @return The id of the graph, a character scalar. For
+#' vertex and edge sequences the id of the graph they were created from.
+#'
+#' @export
+#' @examples
+#' g <- make_ring(10)
+#' graph_id(g)
+#' graph_id(V(g))
+#' graph_id(E(g))
+#'
+#' g2 <- g + 1
+#' graph_id(g2)
+
+graph_id <- function(x, ...)
+ UseMethod("graph_id")
+
+#' @method graph_id igraph
+#' @export
+
+graph_id.igraph <- function(x, ...) {
+ get_graph_id(x)
+}
+
+#' @method graph_id igraph.vs
+#' @export
+
+graph_id.igraph.vs <- function(x, ...) {
+ get_vs_graph_id(x) %||% NA_character_
+}
+
+#' @method graph_id igraph.es
+#' @export
+
+graph_id.igraph.es <- function(x, ...) {
+ get_es_graph_id(x) %||% NA_character_
+}
+
#' Vertices of a graph
#'
#' Create a vertex sequence (vs) containing all vertices of a graph.
@@ -232,15 +278,13 @@ E <- function(graph, P=NULL, path=NULL, directed=TRUE) {
ec <- ecount(graph)
res <- seq_len(ec)
} else if (!is.null(P)) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_es_pairs", graph, as.igraph.vs(graph, P)-1,
- as.logical(directed),
- PACKAGE="igraph")+1
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_es_pairs, graph, as.igraph.vs(graph, P)-1,
+ as.logical(directed)) + 1
} else {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_es_path", graph, as.igraph.vs(graph, path)-1,
- as.logical(directed),
- PACKAGE="igraph")+1
+ on.exit(.Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_es_path, graph, as.igraph.vs(graph, path)-1,
+ as.logical(directed)) + 1
}
if ("name" %in% edge_attr_names(graph)) {
@@ -282,8 +326,8 @@ simple_vs_index <- function(x, i, na_ok = FALSE) {
#' When using multiple indices within the bracket, all of them
#' are evaluated independently, and then the results are concatenated
#' using the \code{c()} function (except for the \code{na_ok} argument,
-#' which is special an must be named. E.g. \code{V(g)[1, 2, nei(1)]}
-#' is equivalent to \code{c(V(g)[1], V(g)[2], V(g)[nei(1)])}.
+#' which is special an must be named. E.g. \code{V(g)[1, 2, .nei(1)]}
+#' is equivalent to \code{c(V(g)[1], V(g)[2], V(g)[.nei(1)])}.
#'
#' @section Index types:
#' Vertex sequences can be indexed with positive numeric vectors,
@@ -311,20 +355,20 @@ simple_vs_index <- function(x, i, na_ok = FALSE) {
#' @section Special functions:
#' There are some special igraph functions that can be used only
#' in expressions indexing vertex sequences: \describe{
-#' \item{\code{nei}}{takes a vertex sequence as its argument
+#' \item{\code{.nei}}{takes a vertex sequence as its argument
#' and selects neighbors of these vertices. An optional \code{mode}
#' argument can be used to select successors (\code{mode="out"}), or
#' precedessors (\code{mode="in"}) in directed graphs.}
-#' \item{\code{inc}}{Takes an edge sequence as an argument, and
+#' \item{\code{.inc}}{Takes an edge sequence as an argument, and
#' selects vertices that have at least one incident edge in this
#' edge sequence.}
-#' \item{\code{from}}{Similar to \code{inc}, but only considers the
+#' \item{\code{.from}}{Similar to \code{.inc}, but only considers the
#' tails of the edges.}
-#' \item{\code{to}}{Similar to \code{inc}, but only considers the
+#' \item{\code{.to}}{Similar to \code{.inc}, but only considers the
#' heads of the edges.}
-#' \item{\code{innei}, \code{outnei}}{\code{innei(v)} is a shorthand for
-#' \code{nei(v, mode = "in")}, and \code{outnei(v)} is a shorthand for
-#' \code{nei(v, mode = "out")}.
+#' \item{\code{.innei}, \code{.outnei}}{\code{.innei(v)} is a shorthand for
+#' \code{.nei(v, mode = "in")}, and \code{.outnei(v)} is a shorthand for
+#' \code{.nei(v, mode = "out")}.
#' }
#' }
#' Note that multiple special functions can be used together, or with
@@ -362,31 +406,48 @@ simple_vs_index <- function(x, i, na_ok = FALSE) {
#' # -----------------------------------------------------------------
#' # nei() special function
#' g <- graph( c(1,2, 2,3, 2,4, 4,2) )
-#' V(g)[ nei( c(2,4) ) ]
-#' V(g)[ nei( c(2,4), "in") ]
-#' V(g)[ nei( c(2,4), "out") ]
+#' V(g)[ .nei( c(2,4) ) ]
+#' V(g)[ .nei( c(2,4), "in") ]
+#' V(g)[ .nei( c(2,4), "out") ]
#'
#' # -----------------------------------------------------------------
#' # The same with vertex names
#' g <- graph(~ A -+ B, B -+ C:D, D -+ B)
-#' V(g)[ nei( c('B', 'D') ) ]
-#' V(g)[ nei( c('B', 'D'), "in" ) ]
-#' V(g)[ nei( c('B', 'D'), "out" ) ]
+#' V(g)[ .nei( c('B', 'D') ) ]
+#' V(g)[ .nei( c('B', 'D'), "in" ) ]
+#' V(g)[ .nei( c('B', 'D'), "out" ) ]
`[.igraph.vs` <- function(x, ..., na_ok = FALSE) {
args <- lazy_dots(..., .follow_symbols = FALSE)
## If indexing has no argument at all, then we still get one,
- ## but it is "empty", a name that is ""
+ ## but it is "empty", a name that is ""
+ ## Special case, no argument (but we might get an artificial
+ ## empty one
if (length(args) < 1 ||
(length(args) == 1 && class(args[[1]]$expr) == "name" &&
as.character(args[[1]]$expr) == "")) {
return(x)
}
- nei <- function(v, mode=c("all", "in", "out", "total")) {
+ ## Special case: single numeric argument
+ if (length(args) == 1 && class(args[[1]]$expr) == "numeric") {
+ res <- simple_vs_index(x, args[[1]]$expr)
+ return (add_vses_graph_ref(res, get_vs_graph(x)))
+ }
+
+ ## Special case: single symbol argument, no such attribute
+ if (length(args) == 1 && class(args[[1]]$expr) == "name") {
+ graph <- get_vs_graph(x)
+ if (! (as.character(args[[1]]$expr) %in% vertex_attr_names(graph))) {
+ res <- simple_vs_index(x, lazy_eval(args[[1]]))
+ return (add_vses_graph_ref(res, graph))
+ }
+ }
+
+ .nei <- function(v, mode=c("all", "in", "out", "total")) {
## TRUE iff the vertex is a neighbor (any type)
## of at least one vertex in v
mode <- igraph.match.arg(mode)
@@ -395,52 +456,55 @@ simple_vs_index <- function(x, i, na_ok = FALSE) {
if (is.logical(v)) {
v <- which(v)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_vs_nei", graph, x, as.igraph.vs(graph, v)-1,
- as.numeric(mode),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_vs_nei, graph, x, as.igraph.vs(graph, v)-1,
+ as.numeric(mode))
tmp[as.numeric(x)]
}
- innei <- function(v, mode=c("in", "all", "out", "total")) {
- nei(v, mode)
+ nei <- function(...) { .nei(...) }
+ .innei <- function(v, mode=c("in", "all", "out", "total")) {
+ .nei(v, mode = mode[1])
}
- outnei <- function(v, mode=c("out", "all", "in", "total")) {
- nei(v, mode)
+ innei <- function(...) { .innei(...) }
+ .outnei <- function(v, mode=c("out", "all", "in", "total")) {
+ .nei(v, mode = mode[1])
}
- inc <- adj <- function(e) {
+ outnei <- function(...) { .outnei(...) }
+ .inc <- function(e) {
## TRUE iff the vertex (in the vs) is incident
## to at least one edge in e
if (is.logical(e)) {
e <- which(e)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_vs_adj", graph, x, as.igraph.es(graph, e)-1,
- as.numeric(3),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_vs_adj, graph, x, as.igraph.es(graph, e)-1,
+ as.numeric(3))
tmp[as.numeric(x)]
}
- from <- function(e) {
+ inc <- function(...) { .inc(...) }
+ adj <- function(...) { .inc(...) }
+ .from <- function(e) {
## TRUE iff the vertex is the source of at least one edge in e
if (is.logical(e)) {
e <- which(e)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_vs_adj", graph, x, as.igraph.es(graph, e)-1,
- as.numeric(1),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_vs_adj, graph, x, as.igraph.es(graph, e)-1,
+ as.numeric(1))
tmp[as.numeric(x)]
}
- to <- function(e) {
+ from <- function(...) { .from(...) }
+ .to <- function(e) {
## TRUE iff the vertex is the target of at least one edge in e
if (is.logical(e)) {
e <- which(e)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_vs_adj", graph, x, as.igraph.es(graph, e)-1,
- as.numeric(2),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_vs_adj, graph, x, as.igraph.es(graph, e)-1,
+ as.numeric(2))
tmp[as.numeric(x)]
}
+ to <- function(...) { .to(...) }
graph <- get_vs_graph(x)
@@ -455,8 +519,10 @@ simple_vs_index <- function(x, i, na_ok = FALSE) {
res <- lazy_eval(
args,
- data = c(attrs, nei = nei, innei = innei,
- outnei = outnei, adj = adj, inc = inc, from = from, to = to)
+ data = c(attrs, .nei = .nei, nei = nei, .innei = .innei,
+ innei = innei, .outnei = .outnei, outnei = outnei, adj = adj,
+ .inc = .inc, inc = inc, .from = .from, from = from, .to = .to,
+ to = to)
)
res <- lapply(res, function(ii) {
if (is.null(ii)) return(NULL)
@@ -543,7 +609,7 @@ simple_vs_index <- function(x, i, na_ok = FALSE) {
#' with_edge_(weight = 1:10, color = "green"))
#' E(g)
#' E(g)[[]]
-#' E(g)[[inc('A')]]
+#' E(g)[[.inc('A')]]
`[[.igraph.es` <- function(x, ...) {
res <- x[...]
@@ -562,7 +628,7 @@ simple_es_index <- function(x, i) {
} else {
res <- unclass(x)[i]
}
- if (anyNA(res)) stop('Unknown edge selected')
+ if (any(is.na(res))) stop('Unknown edge selected')
attr(res, "env") <- attr(x, "env")
attr(res, "graph") <- attr(x, "graph")
@@ -578,8 +644,8 @@ simple_es_index <- function(x, i) {
#' @section Multiple indices:
#' When using multiple indices within the bracket, all of them
#' are evaluated independently, and then the results are concatenated
-#' using the \code{c()} function. E.g. \code{E(g)[1, 2, inc(1)]}
-#' is equivalent to \code{c(E(g)[1], E(g)[2], E(g)[inc(1)])}.
+#' using the \code{c()} function. E.g. \code{E(g)[1, 2, .inc(1)]}
+#' is equivalent to \code{c(E(g)[1], E(g)[2], E(g)[.inc(1)])}.
#'
#' @section Index types:
#' Edge sequences can be indexed with positive numeric vectors,
@@ -613,12 +679,12 @@ simple_es_index <- function(x, i) {
#' @section Special functions:
#' There are some special igraph functions that can be used
#' only in expressions indexing edge sequences: \describe{
-#' \item{\code{inc}}{takes a vertex sequence, and selects
+#' \item{\code{.inc}}{takes a vertex sequence, and selects
#' all edges that have at least one incident vertex in the vertex
#' sequence.}
-#' \item{\code{from}}{similar to \code{inc()}, but only
+#' \item{\code{.from}}{similar to \code{.inc()}, but only
#' the tails of the edges are considered.}
-#' \item{\code{to}}{is similar to \code{inc()}, but only
+#' \item{\code{.to}}{is similar to \code{.inc()}, but only
#' the heads of the edges are considered.}
#' \item{\code{\%--\%}}{a special operator that can be
#' used to select all edges between two sets of vertices. It ignores
@@ -677,30 +743,31 @@ simple_es_index <- function(x, i) {
return(x)
}
- inc <- adj <- function(v) {
+ .inc <- function(v) {
## TRUE iff the edge is incident to at least one vertex in v
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_es_adj", graph, x, as.igraph.vs(graph, v)-1,
- as.numeric(3),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_es_adj, graph, x, as.igraph.vs(graph, v)-1,
+ as.numeric(3))
tmp[ as.numeric(x) ]
}
- from <- function(v) {
+ adj <- function(...) { .inc(...) }
+ inc <- function(...) { .inc(...) }
+ .from <- function(v) {
## TRUE iff the edge originates from at least one vertex in v
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_es_adj", graph, x, as.igraph.vs(graph, v)-1,
- as.numeric(1),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_es_adj, graph, x, as.igraph.vs(graph, v)-1,
+ as.numeric(1))
tmp[ as.numeric(x) ]
}
- to <- function(v) {
+ from <- function(...) { .from(...) }
+ .to <- function(v) {
## TRUE iff the edge points to at least one vertex in v
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- tmp <- .Call("R_igraph_es_adj", graph, x, as.igraph.vs(graph, v)-1,
- as.numeric(2),
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ tmp <- .Call(C_R_igraph_es_adj, graph, x, as.igraph.vs(graph, v)-1,
+ as.numeric(2))
tmp[ as.numeric(x) ]
}
+ to <- function(...) { .to(...) }
graph <- get_es_graph(x)
@@ -715,13 +782,14 @@ simple_es_index <- function(x, i) {
res <- lazy_eval(
args,
- data = c(attrs, inc = inc, adj = adj, from = from, to = to,
- .igraph.from = list(.Call("R_igraph_mybracket",
- graph, 3L, PACKAGE = "igraph")[ as.numeric(x) ]),
- .igraph.to = list(.Call("R_igraph_mybracket",
- graph, 4L, PACKAGE = "igraph")[as.numeric(x)]),
- .igraph.graph = list(graph),
- `%--%`=`%--%`, `%->%`=`%->%`, `%<-%`=`%<-%`)
+ data = c(attrs, .inc = .inc, inc = inc, adj = adj, .from = .from,
+ from = from, .to = .to, to = to,
+ .igraph.from = list(.Call(C_R_igraph_mybracket,
+ graph, 3L)[ as.numeric(x) ]),
+ .igraph.to = list(.Call(C_R_igraph_mybracket,
+ graph, 4L)[as.numeric(x)]),
+ .igraph.graph = list(graph),
+ `%--%`=`%--%`, `%->%`=`%->%`, `%<-%`=`%<-%`)
)
res <- lapply(res, function(ii) {
if (is.null(ii)) return(NULL)
@@ -1002,10 +1070,6 @@ simple_es_index <- function(x, i) {
value=attr(value, "value"), check = FALSE)
}
-#' @include printr.R
-
-head_print <- printr$head_print
-
#' Show a vertex sequence on the screen
#'
#' For long vertex sequences, the printing is truncated to fit to the
@@ -1051,11 +1115,15 @@ print.igraph.vs <- function(x, full = igraph_opt("print.full"), ...) {
graph <- get_vs_graph(x)
len <- length(x)
+ id <- graph_id(x)
title <- "+ " %+% chr(len) %+% "/" %+%
(if (is.null(graph)) "?" else chr(vcount(graph))) %+%
(if (len == 1) " vertex" else " vertices") %+%
- (if (!is.null(names(x))) ", named" else "") %+% ":\n"
+ (if (!is.null(names(x))) ", named" else "") %+%
+ (if (!is.na(id)) paste(", from", substr(id, 1, 7)) else "") %+%
+ (if (is.null(graph)) " (deleted)" else "") %+%
+ ":\n"
cat(title)
if (!is.null(attr(x, "single")) && attr(x, "single") &&
diff --git a/R/layout.R b/R/layout.R
index 8ccdd3c..f5b78ba 100644
--- a/R/layout.R
+++ b/R/layout.R
@@ -309,11 +309,10 @@ layout_as_bipartite <- function(graph, types = NULL, hgap = 1, vgap = 1,
vgap <- as.numeric(vgap)
maxiter <- as.integer(maxiter)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
## Function call
- res <- .Call("R_igraph_layout_bipartite", graph, types, hgap, vgap, maxiter,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_bipartite, graph, types, hgap, vgap, maxiter)
res
}
@@ -366,10 +365,9 @@ layout_as_star <- function(graph, center=V(graph)[1], order=NULL) {
center <- as.igraph.vs(graph, center)
if (!is.null(order)) order <- as.numeric(order)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_layout_star", graph, center-1, order,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_star, graph, center-1, order)
res
}
@@ -441,8 +439,8 @@ as_star <- function(...) layout_spec(layout_as_star, ...)
#' rootlevel=c(2,1)))
layout_as_tree <- function(graph, root=numeric(), circular=FALSE,
- rootlevel=numeric(), mode="out",
- flip.y=TRUE) {
+ rootlevel=numeric(), mode=c("out", "in", "all"),
+ flip.y=TRUE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
@@ -454,9 +452,9 @@ layout_as_tree <- function(graph, root=numeric(), circular=FALSE,
"total"=3)
flip.y <- as.logical(flip.y)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_layout_reingold_tilford", graph, root, mode,
- rootlevel, circular, PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_layout_reingold_tilford, graph, root, mode,
+ rootlevel, circular)
if (flip.y) { res[,2] <- max(res[,2])-res[,2] }
res
}
@@ -515,9 +513,8 @@ layout_in_circle <- function(graph, order=V(graph)) {
stop("Not a graph object")
}
order <- as.igraph.vs(graph, order) - 1L
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_layout_circle", graph, order,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_layout_circle, graph, order)
}
#' @rdname layout_in_circle
@@ -655,14 +652,12 @@ layout_on_grid <- function(graph, width = 0, height = 0, dim = 2) {
stopifnot(dim == 2 || dim == 3)
if (dim == 3) { height <- as.integer(height) }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
if (dim == 2) {
- res <- .Call("R_igraph_layout_grid", graph, width,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_grid, graph, width)
} else {
- res <- .Call("R_igraph_layout_grid_3d", graph, width, height,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_grid_3d, graph, width, height)
}
res
@@ -687,10 +682,9 @@ layout.grid.3d <- function(graph, width=0, height=0) {
width <- as.integer(width)
height <- as.integer(height)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_layout_grid_3d", graph, width, height,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_grid_3d, graph, width, height)
res
}
@@ -721,9 +715,8 @@ layout_on_sphere <- function(graph) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_layout_sphere", graph,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_layout_sphere, graph)
}
@@ -766,13 +759,11 @@ layout_randomly <- function(graph, dim=2) {
stop("Not a graph object")
}
if (dim==2) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_layout_random", graph,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_layout_random, graph)
} else if (dim==3) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_layout_random_3d", graph,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_layout_random_3d, graph)
} else {
stop("Invalid `dim' value");
}
@@ -917,7 +908,7 @@ layout_with_dh <- function(graph, coords=NULL, maxiter=10,
coords <- as.matrix(structure(as.double(coords), dim=dim(coords)))
use.seed <- TRUE
} else {
- coords <- matrix(ncol=2, nrow=0)
+ coords <- matrix(NA_real_, ncol=2, nrow=0)
use.seed <- FALSE
}
maxiter <- as.integer(maxiter)
@@ -929,12 +920,12 @@ layout_with_dh <- function(graph, coords=NULL, maxiter=10,
weight.edge.crossings <- as.numeric(weight.edge.crossings)
weight.node.edge.dist <- as.numeric(weight.node.edge.dist)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_layout_davidson_harel", graph, coords, use.seed,
+ res <- .Call(C_R_igraph_layout_davidson_harel, graph, coords, use.seed,
maxiter, fineiter, cool.fact, weight.node.dist,
weight.border, weight.edge.lengths, weight.edge.crossings,
- weight.node.edge.dist, PACKAGE="igraph")
+ weight.node.edge.dist)
res
}
@@ -978,6 +969,8 @@ with_dh <- function(...) layout_spec(layout_with_dh, ...)
#' @param weights A vector giving edge weights. The \code{weight} edge
#' attribute is used by default, if present. If weights are given, then the
#' attraction along the edges will be multiplied by the given edge weights.
+#' This places vertices connected with a highly weighted edge closer to
+#' each other.
#' @param minx If not \code{NULL}, then it must be a numeric vector that gives
#' lower boundaries for the \sQuote{x} coordinates of the vertices. The length
#' of the vector must match the number of vertices in the graph.
@@ -1074,15 +1067,14 @@ layout_with_fr <- function(graph, coords=NULL, dim=2,
warning("Argument `repulserad' is deprecated and has no effect")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
if (dim==2) {
- res <- .Call("R_igraph_layout_fruchterman_reingold", graph, coords,
- niter, start.temp, weights, minx, maxx, miny, maxy, grid,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_fruchterman_reingold, graph, coords,
+ niter, start.temp, weights, minx, maxx, miny, maxy, grid)
} else {
- res <- .Call("R_igraph_layout_fruchterman_reingold_3d", graph, coords,
+ res <- .Call(C_R_igraph_layout_fruchterman_reingold_3d, graph, coords,
niter, start.temp, weights, minx, maxx, miny, maxy,
- minz, maxz, PACKAGE="igraph")
+ minz, maxz)
}
res
}
@@ -1153,7 +1145,7 @@ layout_with_gem <- function(graph, coords=NULL, maxiter=40*vcount(graph)^2,
coords <- as.matrix(structure(as.double(coords), dim=dim(coords)))
use.seed <- TRUE
} else {
- coords <- matrix(ncol=2, nrow=0)
+ coords <- matrix(NA_real_, ncol=2, nrow=0)
use.seed <- FALSE
}
@@ -1162,11 +1154,10 @@ layout_with_gem <- function(graph, coords=NULL, maxiter=40*vcount(graph)^2,
temp.min <- as.numeric(temp.min)
temp.init <- as.numeric(temp.init)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_layout_gem", graph, coords, use.seed, maxiter,
- temp.max, temp.min, temp.init,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_gem, graph, coords, use.seed, maxiter,
+ temp.max, temp.min, temp.init)
res
}
@@ -1243,10 +1234,9 @@ layout_with_graphopt <- function(graph, start=NULL, niter=500, charge=0.001,
spring.constant <- as.double(spring.constant)
max.sa.movement <- as.double(max.sa.movement)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_layout_graphopt", graph, niter, charge, mass,
- spring.length, spring.constant, max.sa.movement, start,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_layout_graphopt, graph, niter, charge, mass,
+ spring.length, spring.constant, max.sa.movement, start)
}
@@ -1286,6 +1276,7 @@ with_graphopt <- function(...) layout_spec(layout_with_graphopt, ...)
#' @param kkconst Numeric scalar, the Kamada-Kawai vertex attraction constant.
#' Typical (and default) value is the number of vertices.
#' @param weights Edge weights, larger values will result longer edges.
+#' Note that this is opposite to \code{\link{layout_with_fr}}.
#' @param minx If not \code{NULL}, then it must be a numeric vector that gives
#' lower boundaries for the \sQuote{x} coordinates of the vertices. The length
#' of the vector must match the number of vertices in the graph.
@@ -1370,16 +1361,15 @@ layout_with_kk <- function(graph, coords=NULL, dim=2,
warning("Argument `coolexp' is deprecated and has no effect")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
if (dim == 2) {
- res <- .Call("R_igraph_layout_kamada_kawai", graph, coords, maxiter,
- epsilon, kkconst, weights, minx, maxx, miny, maxy,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_kamada_kawai, graph, coords, maxiter,
+ epsilon, kkconst, weights, minx, maxx, miny, maxy)
} else {
- res <- .Call("R_igraph_layout_kamada_kawai_3d", graph, coords, maxiter,
+ res <- .Call(C_R_igraph_layout_kamada_kawai_3d, graph, coords, maxiter,
epsilon, kkconst, weights, minx, maxx, miny, maxy, minz,
- maxz, PACKAGE="igraph")
+ maxz)
}
res
@@ -1445,11 +1435,10 @@ layout_with_lgl <- function(graph, maxiter=150, maxdelta=vcount(graph),
root <- as.igraph.vs(graph, root)-1
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_layout_lgl", graph, as.double(maxiter),
+ on.exit(.Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_layout_lgl, graph, as.double(maxiter),
as.double(maxdelta), as.double(area), as.double(coolexp),
- as.double(repulserad), as.double(cellsize), root,
- PACKAGE="igraph")
+ as.double(repulserad), as.double(cellsize), root)
}
@@ -1519,10 +1508,9 @@ layout_with_mds <- function(graph, dist=NULL, dim=2,
if (!is.null(dist)) dist <- structure(as.double(dist), dim=dim(dist))
dim <- as.integer(dim)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_layout_mds", graph, dist, dim,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_mds, graph, dist, dim)
res
}
@@ -1576,7 +1564,9 @@ with_mds <- function(...) layout_spec(layout_with_mds, ...)
#' you have too many edge crossings, increase this.
#' @param weights Optional edge weight vector. If \code{NULL}, then the
#' 'weight' edge attribute is used, if there is one. Supply \code{NA} here and
-#' igraph ignores the edge weights.
+#' igraph ignores the edge weights. These are used only if the graph
+#' contains cycles; igraph will tend to reverse edges with smaller weights
+#' when breaking the cycles.
#' @param attributes Which graph/vertex/edge attributes to keep in the extended
#' graph. \sQuote{default} keeps the \sQuote{size}, \sQuote{size2},
#' \sQuote{shape}, \sQuote{label} and \sQuote{color} vertex attributes and the
@@ -1595,6 +1585,7 @@ with_mds <- function(...) layout_spec(layout_with_mds, ...)
#' Understanding of Hierarchical Systems". IEEE Transactions on Systems, Man
#' and Cybernetics 11(2):109-125, 1981.
#' @export
+#' @importFrom utils head
#' @family graph layouts
#' @keywords graphs
#' @examples
@@ -1736,10 +1727,10 @@ with_mds <- function(...) layout_spec(layout_with_mds, ...)
}
attributes <- igraph.match.arg(attributes)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit(.Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_layout_sugiyama", graph, layers, hgap,
- vgap, maxiter, weights, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_layout_sugiyama, graph, layers, hgap,
+ vgap, maxiter, weights)
# Flip the y coordinates, more natural this way
res$res[,2] <- max(res$res[,2]) - res$res[,2] + 1
@@ -1748,7 +1739,7 @@ with_mds <- function(...) layout_spec(layout_with_mds, ...)
vc <- vcount(graph)
res$layout <- res$res[seq_len(vc),]
if (nrow(res$res)==vc) {
- res$layout.dummy <- matrix(nrow=0, ncol=2)
+ res$layout.dummy <- matrix(NA_real_, nrow=0, ncol=2)
} else {
res$layout.dummy <- res$res[(vc+1):nrow(res$res),]
}
@@ -1888,10 +1879,9 @@ merge_coords <- function(graphs, layouts, method="dla") {
stop("Not a graph object")
}
if (method == "dla") {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_layout_merge_dla",
- graphs, layouts,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_layout_merge_dla,
+ graphs, layouts)
} else {
stop("Invalid `method'.")
}
diff --git a/R/layout_drl.R b/R/layout_drl.R
index 04680a9..4071b65 100644
--- a/R/layout_drl.R
+++ b/R/layout_drl.R
@@ -54,7 +54,8 @@
#' below.
#' @param weights Optional edge weights. Supply \code{NULL} here if you want to
#' weight edges equally. By default the \code{weight} edge attribute is used if
-#' the graph has one.
+#' the graph has one. Larger weights correspond to stronger connections,
+#' and the vertices will be placed closer to each other.
#' @param fixed Logical vector, it can be used to fix some vertices. All
#' vertices for which it is \code{TRUE} are kept at the coordinates supplied in
#' the \code{seed} matrix. It is ignored it \code{NULL} or if \code{use.seed}
@@ -72,6 +73,7 @@
#' Klavans, R., Boyack, K.W., DrL: Distributed Recursive (Graph) Layout. SAND
#' Reports, 2008. 2936: p. 1-10.
#' @export
+#' @importFrom stats runif
#' @keywords graphs
#' @examples
#'
@@ -105,13 +107,13 @@ layout_with_drl <- function(graph, use.seed = FALSE,
if (!is.null(fixed)) {
fixed <- as.logical(fixed)
}
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
+ on.exit(.Call(C_R_igraph_finalizer))
if (dim==2) {
- res <- .Call("R_igraph_layout_drl", graph, seed, use.seed, options,
- weights, fixed, PACKAGE = "igraph")
+ res <- .Call(C_R_igraph_layout_drl, graph, seed, use.seed, options,
+ weights, fixed)
} else {
- res <- .Call("R_igraph_layout_drl_3d", graph, seed, use.seed, options,
- weights, fixed, PACKAGE = "igraph")
+ res <- .Call(C_R_igraph_layout_drl_3d, graph, seed, use.seed, options,
+ weights, fixed)
}
res
}
diff --git a/R/lazyeval.R b/R/lazyeval.R
index 651b5c4..71f041e 100644
--- a/R/lazyeval.R
+++ b/R/lazyeval.R
@@ -119,8 +119,7 @@ lazy_dots <- function(..., .follow_symbols = FALSE) {
return(structure(list(), class = "lazy_dots"))
}
- base::.Call("make_lazy_dots", environment(), .follow_symbols,
- PACKAGE = "igraph")
+ .Call(C_make_lazy_dots, environment(), .follow_symbols)
}
is.lazy_dots <- function(x) inherits(x, "lazy_dots")
`[.lazy_dots` <- function(x, i) {
@@ -144,8 +143,7 @@ lazy_ <- function(expr, env) {
structure(list(expr = expr, env = env), class = "lazy")
}
lazy <- function(expr, env = parent.frame(), .follow_symbols = TRUE) {
- base::.Call("make_lazy", quote(expr), environment(), .follow_symbols,
- PACKAGE = "igraph")
+ .Call(C_make_lazy, quote(expr), environment(), .follow_symbols)
}
is.lazy <- function(x) inherits(x, "lazy")
print.lazy <- function(x, ...) {
@@ -232,11 +230,11 @@ deparse_trunc <- function(x, width = getOption("width")) {
paste0(substr(text[1], 1, width - 3), "...")
}
promise_expr <- function(prom) {
- base::.Call("promise_expr_", prom, PACKAGE = "igraph")
+ .Call(C_promise_expr_, prom)
}
promise_env <- function(prom) {
- base::.Call("promise_env_", prom, PACKAGE = "igraph")
+ .Call(C_promise_env_, prom)
}
as.lazy.promise <- function(x, ...) {
lazy_(promise_expr(x), promise_env(x))
diff --git a/R/make.R b/R/make.R
index faef6c2..152e3f8 100644
--- a/R/make.R
+++ b/R/make.R
@@ -556,10 +556,9 @@ make_graph <- function(edges, ..., n = max(edges), isolates = NULL,
}
old_graph <- function(edges, n = max(edges), directed = TRUE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_create", as.numeric(edges)-1, as.numeric(n),
- as.logical(directed),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_create, as.numeric(edges)-1, as.numeric(n),
+ as.logical(directed))
}
args <- list(edges, ...)
@@ -592,9 +591,8 @@ make_famous_graph <- function(name) {
name <- gsub("\\s", "_", name)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_famous", as.character(name),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_famous, as.character(name))
if (igraph_opt("add.params")) {
res$name <- capitalize(name)
}
@@ -654,10 +652,9 @@ make_empty_graph <- function(n=0, directed=TRUE) {
n <- as.integer(n)
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_empty", n, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_empty, n, directed)
res
}
@@ -920,10 +917,9 @@ make_star <- function(n, mode=c("in", "out", "mutual", "undirected"),
mode <- igraph.match.arg(mode)
mode1 <- switch(mode, "out"=0, "in"=1, "undirected"=2, "mutual"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_star", as.numeric(n), as.numeric(mode1),
- as.numeric(center)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_star, as.numeric(n), as.numeric(mode1),
+ as.numeric(center)-1)
if (igraph_opt("add.params")) {
res$name <- switch(mode, "in"="In-star", "out"="Out-star", "Star")
res$mode <- mode
@@ -953,13 +949,12 @@ star <- function(...) constructor_spec(make_star, ...)
#' @export
#' @examples
#' make_full_graph(5)
-#' str(make_full_graph(4, directed = TRUE))
+#' print_all(make_full_graph(4, directed = TRUE))
make_full_graph <- function(n, directed=FALSE, loops=FALSE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_full", as.numeric(n), as.logical(directed),
- as.logical(loops),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_full, as.numeric(n), as.logical(directed),
+ as.logical(loops))
if (igraph_opt("add.params")) {
res$name <- "Full graph"
res$loops <- loops
@@ -1013,11 +1008,10 @@ make_lattice <- function(dimvector = NULL, length = NULL, dim = NULL,
dimvector <- rep(length, dim)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_lattice", as.numeric(dimvector), as.numeric(nei),
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_lattice, as.numeric(dimvector), as.numeric(nei),
as.logical(directed), as.logical(mutual),
- as.logical(circular),
- PACKAGE="igraph")
+ as.logical(circular))
if (igraph_opt("add.params")) {
res$name <- "Lattice graph"
res$dimvector <- dimvector
@@ -1054,14 +1048,13 @@ lattice <- function(...) constructor_spec(make_lattice, ...)
#' @family determimistic constructors
#' @export
#' @examples
-#' str(make_ring(10))
-#' str(make_ring(10, directed = TRUE, mutual = TRUE))
+#' print_all(make_ring(10))
+#' print_all(make_ring(10, directed = TRUE, mutual = TRUE))
make_ring <- function(n, directed=FALSE, mutual=FALSE, circular=TRUE) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_ring", as.numeric(n), as.logical(directed),
- as.logical(mutual), as.logical(circular),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_ring, as.numeric(n), as.logical(directed),
+ as.logical(mutual), as.logical(circular))
if (igraph_opt("add.params")) {
res$name <- "Ring graph"
res$mutual <- mutual
@@ -1105,10 +1098,9 @@ make_tree <- function(n, children=2, mode=c("out", "in", "undirected")) {
mode <- igraph.match.arg(mode)
mode1 <- switch(mode, "out"=0, "in"=1, "undirected"=2);
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_tree", as.numeric(n), as.numeric(children),
- as.numeric(mode1),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_tree, as.numeric(n), as.numeric(children),
+ as.numeric(mode1))
if (igraph_opt("add.params")) {
res$name <- "Tree"
res$children <- children
@@ -1157,9 +1149,8 @@ tree <- function(...) constructor_spec(make_tree, ...)
graph_from_atlas <- function(n) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_atlas", as.numeric(n),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_atlas, as.numeric(n))
if (igraph_opt("add.params")) {
res$name <- sprintf("Graph from the Atlas #%i", n)
res$n <- n
@@ -1168,7 +1159,7 @@ graph_from_atlas <- function(n) {
}
#' @rdname graph_from_atlas
-#' @param ... Passed to \code{graph_from_atlas}.
+#' @param ... Passed to \code{graph_from_atlas}.
#' @export
atlas <- function(...) constructor_spec(graph_from_atlas, ...)
@@ -1203,10 +1194,9 @@ atlas <- function(...) constructor_spec(graph_from_atlas, ...)
make_chordal_ring <- function(n, w) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_extended_chordal_ring", as.numeric(n),
- as.matrix(w),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_extended_chordal_ring, as.numeric(n),
+ as.matrix(w))
if (igraph_opt("add.params")) {
res$name <- "Extended chordal ring"
res$w <- w
@@ -1257,9 +1247,8 @@ make_line_graph <- function(graph) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_line_graph", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_line_graph, graph)
if (igraph_opt("add.params")) {
res$name <- "Line graph"
}
@@ -1309,9 +1298,8 @@ line_graph <- function(...) constructor_spec(make_line_graph, ...)
make_de_bruijn_graph <- function(m, n) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_de_bruijn", as.numeric(m), as.numeric(n),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_de_bruijn, as.numeric(m), as.numeric(n))
if (igraph_opt("add.params")) {
res$name <- sprintf("De-Bruijn graph %i-%i", m, n)
res$m <- m
@@ -1358,9 +1346,8 @@ de_bruijn_graph <- function(...) constructor_spec(make_de_bruijn_graph, ...)
#'
make_kautz_graph <- function(m, n) {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_kautz", as.numeric(m), as.numeric(n),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_kautz, as.numeric(m), as.numeric(n))
if (igraph_opt("add.params")) {
res$name <- sprintf("Kautz graph %i-%i", m, n)
res$m <- m
@@ -1414,9 +1401,8 @@ make_full_bipartite_graph <- function(n1, n2, directed=FALSE,
directed <- as.logical(directed)
mode1 <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_full_bipartite", n1, n2, as.logical(directed), mode1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_full_bipartite, n1, n2, as.logical(directed), mode1)
if (igraph_opt("add.params")) {
res$graph$name <- "Full bipartite graph"
res$n1 <- n1
@@ -1480,9 +1466,8 @@ make_bipartite_graph <- function(types, edges, directed=FALSE) {
edges <- as.numeric(edges)-1
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_create_bipartite", types, edges, directed,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_create_bipartite, types, edges, directed)
set_vertex_attr(res, "type", value=types)
}
@@ -1508,17 +1493,16 @@ bipartite_graph <- function(...) constructor_spec(make_bipartite_graph, ...)
#' @family determimistic constructors
#' @export
#' @examples
-#' str(make_full_citation_graph(10))
+#' print_all(make_full_citation_graph(10))
make_full_citation_graph <- function(n, directed=TRUE) {
# Argument checks
n <- as.integer(n)
directed <- as.logical(directed)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_full_citation", n, directed,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_full_citation, n, directed)
res <- set_graph_attr(res, 'name', 'Full citation graph')
res
diff --git a/R/mgclust.R b/R/mgclust.R
index 03458e4..dbd1948 100644
--- a/R/mgclust.R
+++ b/R/mgclust.R
@@ -3,6 +3,11 @@
gclust.rsvt <- function(glist,r=1,maxsvt=10,nmfout=FALSE,maxit=10000,nmfmethod='lee')
{
+
+ if (! requireNamespace("NMF", quietly = TRUE)) {
+ stop("This function requires the 'NMF' package")
+ }
+
# rsvt -- repeated singular value thresholding
# input could be a list of graphs (igraph model)
# or a matrix, where each column corresponds to
@@ -82,9 +87,14 @@ gclust.rsvt <- function(glist,r=1,maxsvt=10,nmfout=FALSE,maxit=10000,nmfmethod='
}
#' @export
+#' @importFrom stats coef
gclust.app <- function(glist, r=1, nmfout=FALSE, maxit=10000, nmfmethod='lee')
{
+ if (! requireNamespace("NMF", quietly = TRUE)) {
+ stop("This function requires the 'NMF' package")
+ }
+
# app -- apparent (clustering), i.e. no rsvt
# input could be a list of graphs (igraph model)
# or a matrix, where each column corresponds to
diff --git a/R/minimum.spanning.tree.R b/R/minimum.spanning.tree.R
index 62d56f3..be6ecd4 100644
--- a/R/minimum.spanning.tree.R
+++ b/R/minimum.spanning.tree.R
@@ -34,7 +34,8 @@
#' @param graph The graph object to analyze.
#' @param weights Numeric algorithm giving the weights of the edges in the
#' graph. The order is determined by the edge ids. This is ignored if the
-#' \code{unweighted} algorithm is chosen
+#' \code{unweighted} algorithm is chosen. Edge weights are interpreted as
+#' distances.
#' @param algorithm The algorithm to use for calculation. \code{unweighted} can
#' be used for unwieghted graphs, and \code{prim} runs Prim's algorithm for
#' weighted graphs. If this is \code{NULL} then igraph tries to select the
@@ -73,18 +74,16 @@ mst <- function(graph, weights=NULL,
}
if (algorithm=="unweighted") {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_minimum_spanning_tree_unweighted", graph,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_minimum_spanning_tree_unweighted, graph)
} else if (algorithm=="prim") {
if (is.null(weights) && ! "weight" %in% edge_attr_names(graph)) {
stop("edges weights must be supplied for Prim's algorithm")
} else if (is.null(weights)) {
weights <- E(graph)$weight
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_minimum_spanning_tree_prim", graph, as.numeric(weights),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_minimum_spanning_tree_prim, graph, as.numeric(weights))
} else {
stop("Invalid algorithm")
}
diff --git a/R/motifs.R b/R/motifs.R
index 4cf3850..5272c37 100644
--- a/R/motifs.R
+++ b/R/motifs.R
@@ -62,10 +62,9 @@ motifs <- function(graph, size=3, cut.prob=rep(0, size)) {
rep(cut.prob[-length(cut.prob)], length(cut.prob)-1))
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_motifs_randesu", graph, as.integer(size),
- as.numeric(cut.prob),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_motifs_randesu, graph, as.integer(size),
+ as.numeric(cut.prob))
res[is.nan(res)] <- NA
res
}
@@ -107,10 +106,9 @@ count_motifs <- function(graph, size=3, cut.prob=rep(0, size)) {
rep(cut.prob[-length(cut.prob)], length(cut.prob)-1))
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_motifs_randesu_no", graph, as.integer(size),
- as.numeric(cut.prob),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_motifs_randesu_no, graph, as.integer(size),
+ as.numeric(cut.prob))
}
#' Graph motifs
@@ -156,10 +154,9 @@ sample_motifs <- function(graph, size=3, cut.prob=rep(0, size),
rep(cut.prob[-length(cut.prob)], length(cut.prob)-1))
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_motifs_randesu_estimate", graph, as.integer(size),
- as.numeric(cut.prob), as.integer(sample.size), as.numeric(sample),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_motifs_randesu_estimate, graph, as.integer(size),
+ as.numeric(cut.prob), as.integer(sample.size), as.numeric(sample))
}
diff --git a/R/nexus.R b/R/nexus.R
index 8c85e7a..11e2c8a 100644
--- a/R/nexus.R
+++ b/R/nexus.R
@@ -327,9 +327,7 @@ nexus.format.result <- function(l, name="") {
#' Instead of the data set ids, it is possible to supply a
#' \code{nexusDatasetInfo} or \code{nexusDatasetInfoList} object here directly
#' and then the query is done on the corresponding data set(s).
-#' @param q Nexus search string. See examples below. For the complete
-#' documentation please see the Nexus homepage at
-#' \url{http://nexus.igraph.org}.
+#' @param q Nexus search string. See examples below.
#' @param nexus.url The URL of the Nexus server. Don't change this from the
#' default, unless you set up your own Nexus server.
#' @param x,object The \code{nexusDatasetInfo} object to print.
@@ -345,7 +343,6 @@ nexus.format.result <- function(l, name="") {
#'
#' \code{nexus_get} returns an igraph graph object, or a list of graph objects,
#' if the data set consists of multiple networks.
-#' @seealso \url{http://nexus.igraph.org}
#' @examples
#' \dontrun{nexus_list(tag="weighted")
#' nexus_list(limit=3, order="name")
@@ -364,6 +361,7 @@ nexus.format.result <- function(l, name="") {
#' nexus_search("blog or US or karate")
#' }
#' @export
+#' @importFrom utils URLencode
nexus_list <- function(tags=NULL, offset=0, limit=10,
operator=c("or", "and"),
@@ -393,6 +391,7 @@ nexus_list <- function(tags=NULL, offset=0, limit=10,
#' @export
#' @rdname nexus
+#' @importFrom utils URLencode
nexus_info <- function(id, nexus.url=igraph_opt("nexus.url")) {
@@ -428,6 +427,7 @@ nexus_info <- function(id, nexus.url=igraph_opt("nexus.url")) {
#' @export
#' @rdname nexus
+#' @importFrom utils URLencode
nexus_get <- function(id, offset=0,
order=c("date", "name", "popularity"),
@@ -462,6 +462,7 @@ nexus_get <- function(id, offset=0,
#' @export
#' @rdname nexus
+#' @importFrom utils URLencode
nexus_search <- function(q, offset=0, limit=10,
order=c("date", "name", "popularity"),
diff --git a/R/operators.R b/R/operators.R
index 4d8edee..376df3e 100644
--- a/R/operators.R
+++ b/R/operators.R
@@ -101,7 +101,7 @@ rename.attr.if.needed <- function(type, graphs, newsize=NULL, maps=NULL,
#' V(g1)$name <- letters[1:10]
#' g2 <- make_ring(10)
#' V(g2)$name <- letters[11:20]
-#' str(g1 %du% g2)
+#' print_all(g1 %du% g2)
#' @export
disjoint_union <- function(...) {
@@ -113,9 +113,8 @@ disjoint_union <- function(...) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_disjoint_union", graphs,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_disjoint_union, graphs)
## Graph attributes
graph.attributes(res) <- rename.attr.if.needed("g", graphs)
@@ -216,8 +215,12 @@ disjoint_union <- function(...) {
})
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call(call, newgraphs, edgemaps, PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ if (call == "union") {
+ res <- .Call(C_R_igraph_union, newgraphs, edgemaps)
+ } else {
+ res <- .Call(C_R_igraph_intersection, newgraphs, edgemaps)
+ }
maps <- res$edgemaps
res <- res$graph
@@ -247,8 +250,12 @@ disjoint_union <- function(...) {
})
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call(call, graphs, edgemaps, PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ if (call == "union") {
+ res <- .Call(C_R_igraph_union, graphs, edgemaps)
+ } else {
+ res <- .Call(C_R_igraph_intersection, graphs, edgemaps)
+ }
maps <- res$edgemaps
res <- res$graph
@@ -336,10 +343,10 @@ union.default <- function(...) {
#' net1 <- graph_from_literal(D-A:B:F:G, A-C-F-A, B-E-G-B, A-B, F-G,
#' H-F:G, H-I-J)
#' net2 <- graph_from_literal(D-A:F:Y, B-A-X-F-H-Z, F-Y)
-#' str(net1 %u% net2)
+#' print_all(net1 %u% net2)
union.igraph <- function(..., byname="auto") {
- .igraph.graph.union.or.intersection("R_igraph_union", ..., byname=byname,
+ .igraph.graph.union.or.intersection("union", ..., byname=byname,
keep.all.vertices=TRUE)
}
@@ -412,11 +419,11 @@ intersection <- function(...)
#' net1 <- graph_from_literal(D-A:B:F:G, A-C-F-A, B-E-G-B, A-B, F-G,
#' H-F:G, H-I-J)
#' net2 <- graph_from_literal(D-A:F:Y, B-A-X-F-H-Z, F-Y)
-#' str(net1 %s% net2)
+#' print_all(net1 %s% net2)
intersection.igraph <- function(..., byname="auto",
keep.all.vertices=TRUE) {
- .igraph.graph.union.or.intersection("R_igraph_intersection", ...,
+ .igraph.graph.union.or.intersection("intersection", ...,
byname=byname,
keep.all.vertices=keep.all.vertices)
}
@@ -491,7 +498,7 @@ difference <- function(...)
#' sstar <- make_star(6, center=6, mode="undirected")
#' V(sstar)$name <- letters[c(1,3,5,7,9,11)]
#' G <- wheel %m% sstar
-#' str(G)
+#' print_all(G)
#' plot(G, layout=layout_nicely(wheel))
difference.igraph <- function(big, small, byname="auto", ...) {
@@ -525,15 +532,13 @@ difference.igraph <- function(big, small, byname="auto", ...) {
}
big <- permute(big, perm)
- on.exit(.Call("R_igraph_finalizer", PACKAGE="igraph"))
- res <- .Call("R_igraph_difference", big, small,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer))
+ res <- .Call(C_R_igraph_difference, big, small)
permute(res, match(V(res)$name, bnames))
} else {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_difference", big, small,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_difference, big, small)
}
}
@@ -582,9 +587,8 @@ complementer <- function(graph, loops=FALSE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_complementer", graph, as.logical(loops),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_complementer, graph, as.logical(loops))
}
@@ -646,8 +650,8 @@ complementer <- function(graph, loops=FALSE) {
#' g1 <- make_ring(10)
#' g2 <- make_star(10, mode="undirected")
#' gc <- compose(g1, g2)
-#' str(gc)
-#' str(simplify(gc))
+#' print_all(gc)
+#' print_all(simplify(gc))
#'
compose <- function(g1, g2, byname="auto") {
@@ -687,9 +691,8 @@ compose <- function(g1, g2, byname="auto") {
edgemaps <- (length(edge_attr_names(g1)) != 0 ||
length(edge_attr_names(g2)) != 0)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_compose", g1, g2, edgemaps,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_compose, g1, g2, edgemaps)
maps <- list(res$edge_map1, res$edge_map2)
res <- res$graph
diff --git a/R/other.R b/R/other.R
index fb2efab..0af0480 100644
--- a/R/other.R
+++ b/R/other.R
@@ -51,9 +51,8 @@ running_mean <- function(v, binwidth) {
stop("Vector too short for this binwidth.")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_running_mean", v, binwidth,
- PACKAGE="igraph");
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_running_mean, v, binwidth)
}
@@ -88,10 +87,9 @@ sample_seq <- function(low, high, length) {
stop("length too big for this interval")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_random_sample", as.numeric(low), as.numeric(high),
- as.numeric(length),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_random_sample, as.numeric(low), as.numeric(high),
+ as.numeric(length))
}
igraph.match.arg <- function(arg, choices, several.ok=FALSE) {
diff --git a/R/package.R b/R/package.R
index 0e207ac..0e090ce 100644
--- a/R/package.R
+++ b/R/package.R
@@ -22,14 +22,7 @@
.onAttach <- function(library, pkg) {
## we can't do this in .onLoad
- unlockBinding(".igraph.pars", asNamespace("igraph"))
unlockBinding(".igraph.pb", asNamespace("igraph"))
invisible()
}
-.Call <- function(.NAME, ...) {
- if (.NAME != "R_igraph_finalizer") {
- base::.Call("R_igraph_check_finally_stack", PACKAGE="igraph")
- }
- base::.Call(.NAME, ...)
-}
diff --git a/R/palette.R b/R/palette.R
index 921217b..024aaf7 100644
--- a/R/palette.R
+++ b/R/palette.R
@@ -201,6 +201,7 @@ diverging_pal <- function(n) {
#'
#' @family palettes
#' @export
+#' @importFrom grDevices palette
r_pal <- function(n) {
x <- palette()
diff --git a/R/par.R b/R/par.R
index 96705fc..4f62219 100644
--- a/R/par.R
+++ b/R/par.R
@@ -40,7 +40,7 @@
igraph.pars.set.verbose <- function(verbose) {
if (is.logical(verbose)) {
- .Call("R_igraph_set_verbose", verbose, PACKAGE="igraph")
+ .Call(C_R_igraph_set_verbose, verbose)
} else if (is.character(verbose)) {
if (!verbose %in% c("tk", "tkconsole")) {
stop("Unknown 'verbose' value")
@@ -51,7 +51,7 @@ igraph.pars.set.verbose <- function(verbose) {
stop("tcltk package not available")
}
}
- .Call("R_igraph_set_verbose", verbose, PACKAGE="igraph")
+ .Call(C_R_igraph_set_verbose, verbose)
} else {
stop("'verbose' should be a logical or character scalar")
}
@@ -108,6 +108,12 @@ igraph.pars.callbacks <- list("verbose"=igraph.pars.set.verbose)
#' graph attributes when printing graphs. Defaults to \code{FALSE}.}
#' \item{print.vertex.attributes}{Logical constant, whether to print
#' vertex attributes when printing graphs. Defaults to \code{FALSE}.}
+#' \item{return.vs.es}{Whether functions that return a set or sequence
+#' of vertices/edges should return formal vertex/edge sequence
+#' objects. This option was introduced in igraph version 1.0.0 and
+#' defaults to TRUE. If your package requires the old behavior,
+#' you can set it to FALSE in the \code{.onLoad} function of
+#' your package, without affecting other packages.}
#' \item{sparsematrices}{Whether to use the \code{Matrix} package for
#' (sparse) matrices. It is recommended, if the user works with
#' larger graphs.}
@@ -128,9 +134,9 @@ igraph.pars.callbacks <- list("verbose"=igraph.pars.set.verbose)
#' @param default If the specified option is not set in the options list, this
#' value is returned. This facilitates retrieving an option and checking
#' whether it is set and setting it separately if not.
-#' @return \code{igraph_options} returns a list with the updated values of the
-#' parameters. If the argument list is not empty, the returned list is
-#' invisible.
+#' @return \code{igraph_options} returns a list with the old values of the
+#' updated parameters, invisibly. Without any arguments, it returns the
+#' values of all options.
#'
#' For \code{igraph_opt}, the current value set for option \code{x}, or
#' \code{NULL} if the option is unset.
@@ -141,14 +147,23 @@ igraph.pars.callbacks <- list("verbose"=igraph.pars.set.verbose)
#' @examples
#'
#' oldval <- igraph_opt("verbose")
-#' igraph_options(verbose=TRUE)
+#' igraph_options(verbose = TRUE)
#' layout_with_kk(make_ring(10))
-#' igraph_options(verbose=oldval)
-#' #' @export
+#' igraph_options(verbose = oldval)
+#'
+#' oldval <- igraph_options(verbose = TRUE, sparsematrices = FALSE)
+#' make_ring(10)[]
+#' igraph_options(oldval)
+#' igraph_opt("verbose")
+#'
+#' @export
+#' @family igraph options
+#' @importFrom pkgconfig set_config_in get_config
igraph_options <- function(...) {
- if (nargs() == 0) return(.igraph.pars)
- current <- .igraph.pars
+ if (nargs() == 0) return(get_all_options())
+
+ ## Short notation
temp <- list(...)
if (length(temp) == 1 && is.null(names(temp))) {
arg <- temp[[1]]
@@ -157,27 +172,67 @@ igraph_options <- function(...) {
character = return(.igraph.pars[arg]),
stop("invalid argument: ", sQuote(arg)))
}
- if (length(temp) == 0) return(current)
+ if (length(temp) == 0) return(get_all_options())
+
+ ## Callbacks
n <- names(temp)
if (is.null(n)) stop("options must be given by name")
- env <- asNamespace("igraph")
cb <- intersect(names(igraph.pars.callbacks), n)
for (cn in cb) {
temp[[cn]] <- igraph.pars.callbacks[[cn]](temp[[cn]])
}
- current <- .igraph.pars # callback might have updated it
- current[n] <- temp
- assign(".igraph.pars", current, envir = env)
- invisible(current)
+
+ ## Old values
+ old <- lapply(names(temp), igraph_opt)
+ names(old) <- names(temp)
+
+ ## Set them
+ names(temp) <- paste0("igraph::", names(temp))
+ do.call(set_config_in, c(temp, list(.in = parent.frame())))
+ invisible(old)
+}
+
+#' @importFrom pkgconfig set_config get_config
+
+get_all_options <- function() {
+ res <- lapply(names(.igraph.pars), function(n) {
+ nn <- paste0("igraph::", n)
+ get_config(nn, fallback = .igraph.pars[[n]])
+ })
+
+ names(res) <- names(.igraph.pars)
+ res
}
#' @rdname igraph_options
#' @export
-igraph_opt <- function(x, default=NULL) {
- if (missing(default))
- return(igraph_options(x)[[1L]])
- if (x %in% names(igraph_options()))
- igraph_options(x)[[1L]]
- else default
+igraph_opt <- function(x, default = NULL) {
+ if (missing(default)) {
+ get_config(paste0("igraph::", x), .igraph.pars[[x]])
+ } else {
+ get_config(paste0("igraph::", x), default)
+ }
+}
+
+
+#' Run code with a temporary igraph options setting
+#'
+#' @param options A named list of the options to change.
+#' @param code The code to run.
+#' @return The result of the \code{code}.
+#'
+#' @export
+#' @family igraph options
+#' @examples
+#' with_igraph_opt(
+#' list(sparsematrices = FALSE),
+#' make_ring(10)[]
+#' )
+#' igraph_opt("sparsematrices")
+
+with_igraph_opt <- function(options, code) {
+ on.exit(igraph_options(old))
+ old <- igraph_options(options)
+ force(code)
}
diff --git a/R/paths.R b/R/paths.R
index e8461ca..e9d22e5 100644
--- a/R/paths.R
+++ b/R/paths.R
@@ -63,11 +63,11 @@ all_simple_paths <- function(graph, from, to = V(graph),
mode <- switch(igraph.match.arg(mode), "out" = 1, "in" = 2, "all" = 3,
"total" = 3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
## Function call
- res <- .Call("R_igraph_get_all_simple_paths", graph, from - 1, to - 1,
- mode, PACKAGE = "igraph")
+ res <- .Call(C_R_igraph_get_all_simple_paths, graph, from - 1, to - 1,
+ mode)
res <- get.all.simple.paths.pp(res)
if (igraph_opt("return.vs.es")) {
diff --git a/R/plot.R b/R/plot.R
index 161bb18..b0ea0ae 100644
--- a/R/plot.R
+++ b/R/plot.R
@@ -70,6 +70,8 @@
#' @method plot igraph
#' @export
#' @export plot.igraph
+#' @importFrom grDevices rainbow
+#' @importFrom graphics plot polygon text par
#' @keywords graphs
#' @examples
#'
@@ -385,9 +387,9 @@ plot.igraph <- function(x,
# add the labels
par(xpd=TRUE)
x <- layout[,1]+label.dist*cos(-label.degree)*
- (vertex.size+6*8*log10(nchar(labels)+1))/200
+ (vertex.size+6*8*log10(2))/200
y <- layout[,2]+label.dist*sin(-label.degree)*
- (vertex.size+6*8*log10(nchar(labels)+1))/200
+ (vertex.size+6*8*log10(2))/200
if (length(label.family)==1) {
text(x, y, labels=labels, col=label.color, family=label.family,
font=label.font, cex=label.cex)
@@ -670,9 +672,9 @@ rglplot.igraph <- function(x, ...) {
# add the labels, 'l1' is a stupid workaround of a mysterious rgl bug
labels[is.na(labels)] <- ""
x <- layout[,1]+label.dist*cos(-label.degree)*
- (vertex.size+6*10*log10(nchar(labels)+1))/200
+ (vertex.size+6*10*log10(2))/200
y <- layout[,2]+label.dist*sin(-label.degree)*
- (vertex.size+6*10*log10(nchar(labels)+1))/200
+ (vertex.size+6*10*log10(2))/200
z <- layout[,3]
l1 <- labels[1]
labels[1] <- ""
@@ -701,6 +703,8 @@ rglplot.igraph <- function(x, ...) {
# This is taken from the IDPmisc package,
# slightly modified: code argument added
+#' @importFrom graphics par xyinch segments xspline lines polygon
+
igraph.Arrows <-
function (x1, y1, x2, y2,
code=2,
@@ -751,7 +755,9 @@ function (x1, y1, x2, y2,
x1d <- r.seg*cos(th.seg1)/uin[1]
y1d <- r.seg*sin(th.seg1)/uin[2]
}
- if (is.logical(curved) && all(!curved)) {
+ if (is.logical(curved) && all(!curved) ||
+ is.numeric(curved) && all(!curved)) {
+
segments(x1+x1d, y1+y1d, x2+x2d, y2+y2d, lwd=sh.lwd, col=sh.col, lty=sh.lty)
phi <- atan2(y1-y2, x1-x2)
r <- sqrt( (x1-x2)^2 + (y1-y2)^2 )
@@ -764,6 +770,7 @@ function (x1, y1, x2, y2,
} else {
lambda <- as.logical(curved) * 0.5
}
+ lambda <- rep(lambda, length.out = length(x1))
c.x1 <- x1+x1d
c.y1 <- y1+y1d
c.x2 <- x2+x2d
@@ -777,20 +784,32 @@ function (x1, y1, x2, y2,
sh.lty <- rep(sh.lty, length=length(c.x1))
sh.lwd <- rep(sh.lwd, length=length(c.x1))
lc.x <- lc.y <- numeric(length(c.x1))
+
for (i in seq_len(length(c.x1))) {
- spl <- xspline(x=c(c.x1[i],spx[i],c.x2[i]),
- y=c(c.y1[i],spy[i],c.y2[i]), shape=1, draw=FALSE)
- lines(spl, lwd=sh.lwd[i], col=sh.col[i], lty=sh.lty[i])
- if (code %in% c(2,3)) {
- x1[i] <- spl$x[3*length(spl$x)/4]
- y1[i] <- spl$y[3*length(spl$y)/4]
+ ## Straight line?
+ if (lambda[i] == 0) {
+ segments(c.x1[i], c.y1[i], c.x2[i], c.y2[i],
+ lwd = sh.lwd[i], col = sh.col[i], lty = sh.lty[i])
+ phi <- atan2(y1[i] - y2[i], x1[i] - x2[i])
+ r <- sqrt( (x1[i] - x2[i])^2 + (y1[i] - y2[i])^2 )
+ lc.x[i] <- x2[i] + 2/3*r*cos(phi)
+ lc.y[i] <- y2[i] + 2/3*r*sin(phi)
+
+ } else {
+ spl <- xspline(x=c(c.x1[i],spx[i],c.x2[i]),
+ y=c(c.y1[i],spy[i],c.y2[i]), shape=1, draw=FALSE)
+ lines(spl, lwd=sh.lwd[i], col=sh.col[i], lty=sh.lty[i])
+ if (code %in% c(2,3)) {
+ x1[i] <- spl$x[3*length(spl$x)/4]
+ y1[i] <- spl$y[3*length(spl$y)/4]
+ }
+ if (code %in% c(1,3)) {
+ x2[i] <- spl$x[length(spl$x)/4]
+ y2[i] <- spl$y[length(spl$y)/4]
+ }
+ lc.x[i] <- spl$x[2/3 * length(spl$x)]
+ lc.y[i] <- spl$y[2/3 * length(spl$y)]
}
- if (code %in% c(1,3)) {
- x2[i] <- spl$x[length(spl$x)/4]
- y2[i] <- spl$y[length(spl$y)/4]
- }
- lc.x[i] <- spl$x[2/3 * length(spl$x)]
- lc.y[i] <- spl$y[2/3 * length(spl$y)]
}
}
@@ -835,6 +854,8 @@ function (x1, y1, x2, y2,
} # Arrows
+#' @importFrom graphics xspline
+
igraph.polygon <- function(points, vertex.size=15/200, expand.by=15/200,
shape=1/2, col="#ff000033", border=NA) {
diff --git a/R/plot.common.R b/R/plot.common.R
index f262556..dd33ae2 100644
--- a/R/plot.common.R
+++ b/R/plot.common.R
@@ -38,30 +38,6 @@ i.parse.plot.params <- function(graph, params) {
p[["plot"]][[n]] <- params[[n]]
}
}
-
- ## check that names are present
-
- mis <- ! names(p[["vertex"]]) %in% names(i.default.values$vertex) &
- ! paste("vertex.", sep="", names(p[["vertex"]])) %in%
- names(igraph_options())
- if (any(mis)) {
- stop("Unknown vertex parameters: ",
- paste(sep=", ", collapse=", ", names(p[["vertex"]])[mis]))
- }
- mis <- ! names(p[["edge"]]) %in% names(i.default.values$edge) &
- ! paste("edge.", sep="", names(p[["edge"]])) %in%
- names(igraph_options())
- if (any(mis)) {
- stop("Unknown edge parameters: ",
- paste(sep=", ", collapse=", ", names(p[["edge"]])[mis]))
- }
- mis <- ! names(p[["plot"]]) %in% names(i.default.values$plot) &
- ! paste("plot.", sep="", names(p[["plot"]])) %in%
- names(igraph_options())
- if (any(mis)) {
- stop("Unknown plot parameters: ",
- paste(sep=", ", collapse=", ", names(p[["plot"]]) [ mis ]))
- }
func <- function(type, name, range=NULL, dontcall=FALSE) {
if (! type %in% names(p)) {
@@ -211,6 +187,7 @@ igraph.check.shapes <- function(x) {
#' \code{\link{plot.igraph}}, \code{\link{tkplot}} and \code{\link{rglplot}}
#' for plotting functions.
#' @export
+#' @importFrom stats ave
#' @keywords graphs
#' @examples
#'
@@ -225,25 +202,14 @@ igraph.check.shapes <- function(x) {
#' }
#'
curve_multiple <- function(graph, start=0.5) {
- cm <- count_multiple(graph)
el <- apply(as_edgelist(graph, names=FALSE), 1, paste, collapse=":")
- ord <- order(el)
- res <- numeric(length(ord))
-
- p <- 1
- while (p <= length(res)) {
- m <- cm[ord[p]]
- idx <- p:(p+m-1)
- if (m==1) {
- r <- 0
+ ave(rep(NA, length(el)), el, FUN=function(x) {
+ if (length(x) == 1) {
+ return(0)
} else {
- r <- seq(-start, start, length=m)
+ return(seq(-start, start, length=length(x)))
}
- res[ord[idx]] <- r
- p <- p + m
- }
-
- res
+ })
}
.igraph.logo.raster <-
diff --git a/R/plot.shapes.R b/R/plot.shapes.R
index 1269c70..c77fc14 100644
--- a/R/plot.shapes.R
+++ b/R/plot.shapes.R
@@ -298,7 +298,7 @@
#'
#' musnet <- simplify(graph_from_data_frame(edges, dir=FALSE,
#' vertices=data.frame(name=c(ego$name, ego$similar))))
-#' str(musnet)
+#' print_all(musnet)
#'
#' V(musnet)$raster <- c(list(ego$image), lapply(similar, "[[", "image"))
#' plot(musnet, layout=layout_as_star, vertex.shape="raster",
@@ -410,6 +410,8 @@ add_shape <- function(shape, clip=shape_noclip,
res
}
+#' @importFrom graphics symbols
+
.igraph.shape.circle.plot <- function(coords, v=NULL, params) {
vertex.color <- params("vertex", "color")
@@ -491,6 +493,8 @@ add_shape <- function(shape, clip=shape_noclip,
res
}
+#' @importFrom graphics symbols
+
.igraph.shape.square.plot <- function(coords, v=NULL, params) {
vertex.color <- params("vertex", "color")
@@ -638,6 +642,8 @@ add_shape <- function(shape, clip=shape_noclip,
res
}
+#' @importFrom graphics symbols
+
.igraph.shape.rectangle.plot <- function(coords, v=NULL, params) {
vertex.color <- params("vertex", "color")
@@ -795,6 +801,8 @@ add_shape <- function(shape, clip=shape_noclip,
invisible(NULL)
}
+#' @importFrom graphics par polygon
+
mypie <- function(x, y, values, radius, edges=200, col=NULL, angle=45,
density=NULL, border=NULL, lty=NULL, init.angle=90, ...) {
values <- c(0, cumsum(values)/sum(values))
@@ -873,6 +881,8 @@ mypie <- function(x, y, values, radius, edges=200, col=NULL, angle=45,
res
}
+#' @importFrom stats na.omit
+
.igraph.shape.pie.plot <- function(coords, v=NULL, params) {
getparam <- function(pname) {
@@ -913,6 +923,9 @@ mypie <- function(x, y, values, radius, edges=200, col=NULL, angle=45,
.igraph.shape.sphere.clip <- .igraph.shape.circle.clip
+#' @importFrom graphics rasterImage
+#' @importFrom grDevices col2rgb as.raster
+
.igraph.shape.sphere.plot <- function(coords, v=NULL, params) {
getparam <- function(pname) {
@@ -928,11 +941,10 @@ mypie <- function(x, y, values, radius, edges=200, col=NULL, angle=45,
## Need to create a separate image for every different vertex color
allcols <- unique(vertex.color)
images <- lapply(allcols, function(col) {
- img <- .Call("R_igraph_getsphere", pos=c(0.0,0.0,10.0), radius=7.0,
+ img <- .Call(C_R_igraph_getsphere, pos=c(0.0,0.0,10.0), radius=7.0,
color=col2rgb(col)/255, bgcolor=c(0,0,0),
lightpos=list(c(-2,2,2)), lightcolor=list(c(1,1,1)),
- width=100L, height=100L,
- PACKAGE="igraph")
+ width=100L, height=100L)
as.raster(img)
})
whichImage <- match(vertex.color, allcols)
@@ -947,6 +959,8 @@ mypie <- function(x, y, values, radius, edges=200, col=NULL, angle=45,
.igraph.shape.raster.clip <- .igraph.shape.rectangle.clip
+#' @importFrom graphics rasterImage
+
.igraph.shape.raster.plot <- function(coords, v=NULL, params) {
getparam <- function(pname) {
diff --git a/R/pp.R b/R/pp.R
index 20f5dd6..5fd263c 100644
--- a/R/pp.R
+++ b/R/pp.R
@@ -21,5 +21,5 @@
###################################################################
get.all.simple.paths.pp <- function(vect) {
- .Call("R_igraph_get_all_simple_paths_pp", vect, PACKAGE="igraph")
+ .Call(C_R_igraph_get_all_simple_paths_pp, vect)
}
diff --git a/R/print.R b/R/print.R
index 9259769..453d2c0 100644
--- a/R/print.R
+++ b/R/print.R
@@ -31,19 +31,19 @@
gal <- graph_attr_names(object)
if (length(gal) != 0) {
ga <- paste(sep="", gal, " (g/",
- .Call("R_igraph_get_attr_mode", object, 2L, PACKAGE="igraph"),
+ .Call(C_R_igraph_get_attr_mode, object, 2L),
")")
}
val <- vertex_attr_names(object)
if (length(val) != 0) {
va <- paste(sep="", val, " (v/",
- .Call("R_igraph_get_attr_mode", object, 3L, PACKAGE="igraph"),
+ .Call(C_R_igraph_get_attr_mode, object, 3L),
")")
}
eal <- edge_attr_names(object)
if (length(eal) != 0) {
ea <- paste(sep="", edge_attr_names(object), " (e/",
- .Call("R_igraph_get_attr_mode", object, 4L, PACKAGE="igraph"),
+ .Call(C_R_igraph_get_attr_mode, object, 4L),
")")
}
c(ga, va, ea)
@@ -55,7 +55,7 @@
stop("Not a graph object")
}
- title <- paste(sep="", "IGRAPH ",
+ title <- paste(sep="", "IGRAPH ", substr(graph_id(object), 1, 7), " ",
c("U","D")[is_directed(object)+1],
c("-","N")[is_named(object)+1],
c("-","W")[is_weighted(object)+1],
@@ -78,7 +78,7 @@
1 + if (length(atxt) == 1 && atxt == "") 0 else length(atxt)
}
-indent_print <- printr$indent_print
+#' @importFrom utils capture.output
.print.graph.attributes <- function(x, full, max.lines) {
list <- graph_attr_names(x)
@@ -234,21 +234,18 @@ indent_print <- printr$indent_print
}
}
-#' @include printr.R
-
-head_print <- printr$head_print
-printer_callback <- printr$printer_callback
-
.print.edges.compressed <- function(x, edges = E(x), names, num = FALSE,
max.lines = igraph_opt("auto.print.lines")) {
len <- length(edges)
+ id <- graph_id(edges)
title <- "+" %+%
(if (num) " " %+% chr(len) %+% "/" %+%
(if (is.null(x)) "?" else chr(gsize(x))) else "") %+%
(if (len == 1) " edge" else " edges") %+%
- (if (is.null(x)) ", unknown graph" else "") %+%
+ (if (!is.na(id)) paste(" from", substr(id, 1, 7)) else " unknown") %+%
+ (if (is.null(x)) " (deleted)" else "") %+%
(if (is.null(attr(edges, "vnames"))) "" else " (vertex names)") %+%
":\n"
cat(title)
@@ -305,6 +302,8 @@ printer_callback <- printr$printer_callback
}
+#' @importFrom utils capture.output
+
.print.edges.compressed.limit <- function(x, edges, names, max.lines) {
if (!is.null(x)) {
@@ -402,10 +401,9 @@ printer_callback <- printr$printer_callback
cat(alstr, sep="\n")
}
-#' @method str igraph
#' @export
-str.igraph <- function(object, ...) {
+print_all <- function(object, ...) {
print.igraph(object, full=TRUE, ...)
}
@@ -419,22 +417,24 @@ str.igraph <- function(object, ...) {
#' \code{summary.igraph} prints the number of vertices, edges and whether the
#' graph is directed.
#'
-#' \code{str.igraph} prints the same information, and also lists the edges, and
+#' \code{print_all} prints the same information, and also lists the edges, and
#' optionally graph, vertex and/or edge attributes.
#'
#' \code{print.igraph} behaves either as \code{summary.igraph} or
-#' \code{str.igraph} depending on the \code{full} argument. See also the
+#' \code{print_all} depending on the \code{full} argument. See also the
#' \sQuote{print.full} igraph option and \code{\link{igraph_opt}}.
#'
#' The graph summary printed by \code{summary.igraph} (and \code{print.igraph}
-#' and \code{str.igraph}) consists one or more lines. The first line contains
+#' and \code{print_all}) consists one or more lines. The first line contains
#' the basic properties of the graph, and the rest contains its attributes.
#' Here is an example, a small star graph with weighed directed edges and named
-#' vertices: \preformatted{ IGRAPH DNW- 10 9 -- In-star
+#' vertices: \preformatted{ IGRAPH badcafe DNW- 10 9 -- In-star
#' + attr: name (g/c), mode (g/c), center (g/n), name (v/c),
#' weight (e/n) }
#' The first line always
#' starts with \code{IGRAPH}, showing you that the object is an igraph graph.
+#' Then a seven character code is printed, this the first seven characters
+#' of the unique id of the graph. See \code{\link{graph_id}} for more.
#' Then a four letter long code string is printed. The first letter
#' distinguishes between directed (\sQuote{\code{D}}) and undirected
#' (\sQuote{\code{U}}) graphs. The second letter is \sQuote{\code{N}} for named
@@ -453,10 +453,13 @@ str.igraph <- function(object, ...) {
#' (\sQuote{\code{c}}), numeric (\sQuote{\code{n}}), logical
#' (\sQuote{\code{l}}), or other (\sQuote{\code{x}}).
#'
-#' As of igraph 0.4 \code{str.igraph} and \code{print.igraph} use the
+#' As of igraph 0.4 \code{print_all} and \code{print.igraph} use the
#' \code{max.print} option, see \code{\link[base]{options}} for details.
-#'
-#' @aliases print.igraph str.igraph summary.igraph
+#'
+#' As of igraph 1.1.1, the \code{str.igraph} function is defunct, use
+#' \code{print_all()}.
+#'
+#' @aliases print.igraph print_all summary.igraph str.igraph
#' @param x The graph to print.
#' @param full Logical scalar, whether to print the graph structure itself as
#' well.
diff --git a/R/printr.R b/R/printr.R
index 86319f9..e93ee82 100644
--- a/R/printr.R
+++ b/R/printr.R
@@ -1,6 +1,4 @@
-printr <- (function() {
-
#' Create a printer callback function
#'
#' A printer callback fucntion is a function can performs the actual
@@ -100,6 +98,8 @@ head_print_object <- function(x, max_lines, header, footer, omitted_footer,
invisible(c(lines = length(cout), printed = cout_no))
}
+#' @importFrom utils tail
+
head_print_callback <- function(x, max_lines, header, footer,
omitted_footer, ...) {
@@ -184,6 +184,3 @@ add_class <- function(x, class) {
}
x
}
-environment()
-})()
-
diff --git a/R/random_walk.R b/R/random_walk.R
index 1125c65..4527b14 100644
--- a/R/random_walk.R
+++ b/R/random_walk.R
@@ -11,7 +11,7 @@
#' @param steps The number of steps to make.
#' @param mode How to follow directed edges. \code{"out"} steps along the
#' edge direction, \code{"in"} is opposite to that. \code{"all"} ignores
-#' edge directions. This argument is ignored for directed graphs.
+#' edge directions. This argument is ignored for undirected graphs.
#' @param stuck What to do if the random walk gets stuck. \code{"return"}
#' returns the partial walk, \code{"error"} raises an error.
#' @return A vertex sequence containing the vertices along the walk.
@@ -41,11 +41,10 @@ random_walk <- function(graph, start, steps, mode = c("out", "in", "all"),
steps <- as.integer(steps)
stuck <- switch(igraph.match.arg(stuck), "error" = 0L, "return" = 1L)
- on.exit( .Call("R_igraph_finalizer", PACKAGE = "igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
## Function call
- res <- .Call("R_igraph_random_walk", graph, start - 1, mode, steps, stuck,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_random_walk, graph, start - 1, mode, steps, stuck)
if (igraph_opt("return.vs.es")) {
res <- create_vs(graph, res)
}
diff --git a/R/rewire.R b/R/rewire.R
index fe43af4..7eae357 100644
--- a/R/rewire.R
+++ b/R/rewire.R
@@ -39,7 +39,7 @@
#' g %>%
#' rewire(each_edge(p = .1, loops = FALSE)) %>%
#' plot(layout=layout_in_circle)
-#' str(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
+#' print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
rewire <- function(graph, with) {
if (! is(with, "igraph_rewiring_method")) {
@@ -73,7 +73,7 @@ rewire <- function(graph, with) {
#' g %>%
#' rewire(keeping_degseq(niter = 20)) %>%
#' degree()
-#' str(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
+#' print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
keeping_degseq <- function(loops = FALSE, niter = 100) {
method <- list(
@@ -92,9 +92,8 @@ rewire_keeping_degseq <- function(graph, loops, niter) {
loops <- as.logical(loops)
mode <- if (loops) 1 else 0
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_rewire", graph, as.numeric(niter), as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_rewire, graph, as.numeric(niter), as.numeric(mode))
}
#' Rewires the endpoints of the edges of a graph to a random vertex
@@ -135,8 +134,7 @@ rewire_each_edge <- function(graph, prob, loops=FALSE, multiple=FALSE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_rewire_edges", graph, as.numeric(prob), as.logical(loops),
- as.logical(multiple),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_rewire_edges, graph, as.numeric(prob), as.logical(loops),
+ as.logical(multiple))
}
diff --git a/R/scan.R b/R/scan.R
index eb121b3..2fded0f 100644
--- a/R/scan.R
+++ b/R/scan.R
@@ -149,10 +149,10 @@ local_scan <- function(graph.us, graph.them=NULL, k=1, FUN=NULL,
neighborhoods <- lapply(neighborhoods, function(x) {
as.integer(x)-1L
})
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_neighborhood_ecount", graph.us,
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_neighborhood_ecount, graph.us,
if (weighted) as.numeric(E(graph.us)$weight) else NULL,
- neighborhoods, PACKAGE="igraph")
+ neighborhoods)
} else {
sapply(lapply(neighborhoods, induced.subgraph, graph=graph.us),
FUN, ...)
@@ -160,25 +160,22 @@ local_scan <- function(graph.us, graph.them=NULL, k=1, FUN=NULL,
} else {
## scan-0
if (k == 0) {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_0", graph.us,
- if (weighted) as.numeric(E(graph.us)$weight) else NULL, cmode,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_0, graph.us,
+ if (weighted) as.numeric(E(graph.us)$weight) else NULL, cmode)
## scan-1, ecount
} else if (k==1 && is.character(FUN) &&
FUN %in% c("ecount", "sumweights")) {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_1_ecount", graph.us,
- if (weighted) as.numeric(E(graph.us)$weight) else NULL, cmode,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_1_ecount, graph.us,
+ if (weighted) as.numeric(E(graph.us)$weight) else NULL, cmode)
## scan-k, ecount
} else if (is.character(FUN) && FUN %in% c("ecount", "sumweights")) {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_k_ecount", graph.us, as.integer(k),
- if (weighted) as.numeric(E(graph.us)$weight) else NULL, cmode,
- PACKAGE="igraph")
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_k_ecount, graph.us, as.integer(k),
+ if (weighted) as.numeric(E(graph.us)$weight) else NULL, cmode)
## General
} else {
@@ -195,10 +192,10 @@ local_scan <- function(graph.us, graph.them=NULL, k=1, FUN=NULL,
neighborhoods <- lapply(neighborhoods, function(x) {
as.integer(x)-1L
})
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_neighborhood_ecount", graph.them,
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_neighborhood_ecount, graph.them,
if (weighted) as.numeric(E(graph.them)$weight) else NULL,
- neighborhoods, PACKAGE="igraph")
+ neighborhoods)
} else {
sapply(lapply(neighborhoods, induced.subgraph, graph=graph.them),
FUN, ...)
@@ -207,26 +204,26 @@ local_scan <- function(graph.us, graph.them=NULL, k=1, FUN=NULL,
## scan-0
if (k == 0) {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_0_them", graph.us, graph.them,
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_0_them, graph.us, graph.them,
if (weighted) as.numeric(E(graph.them)$weight) else NULL,
- cmode, PACKAGE="igraph")
+ cmode)
## scan-1, ecount
} else if (k==1 && is.character(FUN) &&
FUN %in% c("ecount", "sumweights")) {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_1_ecount_them", graph.us, graph.them,
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_1_ecount_them, graph.us, graph.them,
if (weighted) as.numeric(E(graph.them)$weight) else NULL,
- cmode, PACKAGE="igraph")
+ cmode)
## scan-k, ecount
} else if (is.character(FUN) && FUN %in% c("ecount", "sumweights")) {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_local_scan_k_ecount_them", graph.us, graph.them,
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_local_scan_k_ecount_them, graph.us, graph.them,
as.integer(k),
if (weighted) as.numeric(E(graph.them)$weight) else NULL,
- cmode, PACKAGE="igraph")
+ cmode)
## general case
} else {
@@ -358,6 +355,8 @@ scan_stat <- function(graphs, tau = 1, ell = 0,
)
}
+#' @importFrom stats sd
+
scan_vertex_norm <-function (input_stat, tau) {
if (is.matrix(input_stat)) {
n <- nrow(input_stat)
@@ -396,6 +395,8 @@ scan_vertex_norm <-function (input_stat, tau) {
return(nstat)
}
+#' @importFrom stats sd
+
scan_temp_norm <- function (stat, tau, ell) {
maxTime <- ncol(stat)
Mtilde <- apply(stat, 2, max)
diff --git a/R/scg.R b/R/scg.R
index e8cac35..2f06beb 100644
--- a/R/scg.R
+++ b/R/scg.R
@@ -93,7 +93,7 @@ NULL
#'
#' library(Matrix)
#' ## g is a large sparse graph
-#' g <- barabasi.game(n = 10^5, power = 2, directed = FALSE)
+#' g <- sample_pa(n = 10^5, power = 2, directed = FALSE)
#' W <- stochastic_matrix(g, sparse=TRUE)
#'
#' ## a dense matrix here would probably not fit in the memory
@@ -118,14 +118,12 @@ stochastic_matrix <- function(graph, column.wise=FALSE,
stop("`sparse' must be a logical scalar")
}
- on.exit(.Call("R_igraph_finalizer", PACKAGE="igraph"))
+ on.exit(.Call(C_R_igraph_finalizer))
if (sparse) {
- res <- .Call("R_igraph_get_stochastic_sparsemat", graph, column.wise,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_get_stochastic_sparsemat, graph, column.wise)
res <- igraph.i.spMatrix(res)
} else {
- res <- .Call("R_igraph_get_stochastic", graph, column.wise,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_get_stochastic, graph, column.wise)
}
if (igraph_opt("add.vertex.names") && is_named(graph)) {
@@ -264,12 +262,11 @@ scg_group <- function(V, nt,
if (!is.null(p)) p <- as.numeric(p)
maxiter <- as.integer(maxiter)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_scg_grouping", V, as.integer(nt[1]),
+ res <- .Call(C_R_igraph_scg_grouping, V, as.integer(nt[1]),
if (length(nt)==1) NULL else nt,
- mtype, algo, p, maxiter,
- PACKAGE="igraph")
+ mtype, algo, p, maxiter)
res
}
@@ -335,7 +332,7 @@ scg_group <- function(V, nt,
#' library(Matrix)
#' # compute the semi-projectors and projector for the partition
#' # provided by a community detection method
-#' g <- barabasi.game(20, m=1.5)
+#' g <- sample_pa(20, m = 1.5, directed = FALSE)
#' eb <- cluster_edge_betweenness(g)
#' memb <- membership(eb)
#' lr <- scg_semi_proj(memb)
@@ -366,11 +363,10 @@ scg_semi_proj <- function(groups,
norm <- switch(igraph.match.arg(norm), "row"=1, "col"=2)
sparse <- as.logical(sparse)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_scg_semiprojectors", groups, mtype, p, norm,
- sparse,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_scg_semiprojectors, groups, mtype, p, norm,
+ sparse)
if (sparse) {
res$L <- igraph.i.spMatrix(res$L)
@@ -673,35 +669,32 @@ myscg <- function(graph, matrix, sparsemat, ev, nt, groups=NULL,
semproj <- as.logical(semproj)
epairs <- as.logical(epairs)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (mtype=="symmetric") {
if (!is.null(evec)) { storage.mode(evec) <- "double" }
- res <- .Call("R_igraph_scg_adjacency", graph, matrix, sparsemat, ev,
+ res <- .Call(C_R_igraph_scg_adjacency, graph, matrix, sparsemat, ev,
nt, algo, evec, groups,
- use.arpack, maxiter, sparse, output, semproj, epairs,
- PACKAGE="igraph")
+ use.arpack, maxiter, sparse, output, semproj, epairs)
} else if (mtype=="laplacian") {
norm <- switch(igraph.match.arg(norm), "row"=1, "col"=2)
if (!is.null(evec)) { storage.mode(evec) <- "complex" }
direction <- switch(igraph.match.arg(direction), "default"=1, "left"=2,
"right"=3)
- res <- .Call("R_igraph_scg_laplacian", graph, matrix, sparsemat, ev,
+ res <- .Call(C_R_igraph_scg_laplacian, graph, matrix, sparsemat, ev,
nt, algo, norm, direction,
evec, groups, use.arpack, maxiter, sparse, output,
- semproj, epairs,
- PACKAGE="igraph")
+ semproj, epairs)
} else if (mtype=="stochastic") {
norm <- switch(igraph.match.arg(norm), "row"=1, "col"=2)
if (!is.null(evec)) { storage.mode(evec) <- "complex" }
if (!is.null(p)) { storage.mode(p) <- "double" }
stat.prob <- as.logical(stat.prob)
- res <- .Call("R_igraph_scg_stochastic", graph, matrix, sparsemat, ev,
+ res <- .Call(C_R_igraph_scg_stochastic, graph, matrix, sparsemat, ev,
nt, algo, norm, evec, groups, p, use.arpack,
- maxiter, sparse, output, semproj, epairs, stat.prob,
- PACKAGE="igraph")
+ maxiter, sparse, output, semproj, epairs, stat.prob)
}
if (!is.null(res$Xt) &&
diff --git a/R/sgm.R b/R/sgm.R
index ee11909..6c4cbbe 100644
--- a/R/sgm.R
+++ b/R/sgm.R
@@ -9,8 +9,7 @@ solve_LSAP <- function (x, maximum = FALSE) {
if (nc > nr) x <- rbind(x, matrix(2 * sum(x), nc - nr, nc))
if (maximum) x <- max(x) - x
storage.mode(x) <- "double"
- out <- .Call("R_igraph_solve_lsap", x, as.integer(nc),
- PACKAGE = "igraph") + 1L
+ out <- .Call(C_R_igraph_solve_lsap, x, as.integer(nc)) + 1L
out[seq_len(nr)]
}
@@ -71,7 +70,7 @@ solve_LSAP <- function (x, maximum = FALSE) {
#' B <- as.matrix(get.adjacency(g2))
#' P <-match_vertices (A, B, m=3, start=diag(rep(1, nrow(A)-3)), 20)
#' P
-#' #' @export
+#' @export
match_vertices <- function(A, B, m, start, iteration) {
## Seeds are assumed to be vertices 1:m in both graphs
diff --git a/R/socnet.R b/R/socnet.R
index db7dc60..6a1d8a1 100644
--- a/R/socnet.R
+++ b/R/socnet.R
@@ -512,6 +512,8 @@ tkigraph <- function() {
save(graphs, file=paste(as.character(filename), collapse=" "))
}
+#' @importFrom utils read.table
+
.tkigraph.import.adjacency <- function() {
filename <- tcltk::tkgetOpenFile(defaultextension="adj",
title="Import adjacency matrix")
@@ -547,6 +549,8 @@ tkigraph <- function() {
g
}
+#' @importFrom utils read.table
+
.tkigraph.import.edgelist <- function() {
filename <- tcltk::tkgetOpenFile(defaultextension="el",
title="Import edge list")
@@ -578,6 +582,8 @@ tkigraph <- function() {
.tkigraph.add.graph(g)
}
+#' @importFrom utils write.table
+
.tkigraph.export.adjacency <- function() {
gnos <- .tkigraph.get.selected()
if (length(gnos)!=1) {
@@ -598,6 +604,8 @@ tkigraph <- function() {
write.table(tab, file=filename, row.names=FALSE, col.names=FALSE)
}
+#' @importFrom utils write.table
+
.tkigraph.export.edgelist <- function() {
gnos <- .tkigraph.get.selected()
if (length(gnos)!=1) {
@@ -798,6 +806,8 @@ tkigraph <- function() {
.tkigraph.showData(value, title="Graphs properties", sort.button=FALSE)
}
+#' @importFrom grDevices dev.new
+
.tkigraph.plot <- function(simple=TRUE, gnos=NULL, ...) {
if (is.null(gnos)) {
@@ -926,6 +936,8 @@ tkigraph <- function() {
}
}
+#' @importFrom utils edit
+
.tkigraph.by.hand <- function() {
gnos <- .tkigraph.get.selected()
if (length(gnos) > 1) {
@@ -1090,6 +1102,9 @@ tkigraph <- function() {
.tkigraph.add.graph(g)
}
+#' @importFrom graphics hist plot
+#' @importFrom grDevices dev.new
+
.tkigraph.degree.sequence.game <- function() {
gnos <- .tkigraph.get.selected()
if (length(gnos) == 0) {
@@ -1187,6 +1202,10 @@ tkigraph <- function() {
showmean=mv)
}
+#' @importFrom grDevices dev.new
+#' @importFrom graphics plot hist lines legend
+#' @importFrom stats coef vcov
+
.tkigraph.degree.dist <- function(power=FALSE) {
gnos <- .tkigraph.get.selected()
if (length(gnos)!=1) {
@@ -1449,6 +1468,9 @@ tkigraph <- function() {
.tkigraph.showData(value, title=paste("Components of graph #", gnos))
}
+#' @importFrom graphics hist plot
+#' @importFrom grDevices dev.new
+
.tkigraph.calculate.clusters <- function() {
gnos <- .tkigraph.get.selected()
if (length(gnos) != 1) {
@@ -1491,6 +1513,8 @@ tkigraph <- function() {
plot.command=plot.command, showmean=mv)
}
+#' @importFrom grDevices rainbow
+
.tkigraph.plot.comp <- function(simple=FALSE) {
gnos <- .tkigraph.get.selected()
if (length(gnos) != 1) {
@@ -1557,6 +1581,9 @@ tkigraph <- function() {
.tkigraph.add.graph(g)
}
+#' @importFrom grDevices dev.new
+#' @importFrom graphics layout layout.show par plot text
+
.tkigraph.motifs.draw <- function() {
read <- .tkigraph.dialogbox(TITLE="Draw all motifs",
size=list(name="Size", type="numeric",
@@ -1604,6 +1631,9 @@ tkigraph <- function() {
}
+#' @importFrom grDevices dev.new
+#' @importFrom graphics barplot layout layout.show par plot text
+
.tkigraph.motifs.find <- function() {
gnos <- .tkigraph.get.selected()
@@ -1715,6 +1745,8 @@ tkigraph <- function() {
.tkigraph.spinglass.community.dialog(comm, read, gnos)
}
+#' @importFrom grDevices rainbow
+
.tkigraph.spinglass.community.dialog <- function(comm, read, gnos) {
dialog <- tcltk::tktoplevel()
frame <- tcltk::tkframe(dialog)
@@ -1921,6 +1953,8 @@ tkigraph <- function() {
gnos), right=FALSE)
}
+#' @importFrom utils browseURL
+
.tkigraph.help <- function(page="index.html") {
dialog <- tcltk::tktoplevel()
tcltk::tktitle(dialog) <- "Help (main page)"
@@ -1971,11 +2005,15 @@ tkigraph <- function() {
tcltk::tkconfigure(txt, state="disabled")
}
+#' @importFrom utils browseURL
+
.tkigraph.help.external <- function(page="index.html") {
f <- system.file("tkigraph_help/index.html", package="igraph")
browseURL(f)
}
+#' @importFrom utils packageDescription
+
.tkigraph.about <- function() {
dialog <- tcltk::tktoplevel()
tcltk::tktitle(dialog) <- "About tkigraph"
@@ -2000,6 +2038,8 @@ tkigraph <- function() {
#####################################################
# This is from the 'relimp' package by David Firth, thanks
+#' @importFrom utils write.table
+
.tkigraph.showData <-
function (dataframe,
colname.bgcolor = "grey50",
diff --git a/R/structural.properties.R b/R/structural.properties.R
index c8986ba..4cde6c9 100644
--- a/R/structural.properties.R
+++ b/R/structural.properties.R
@@ -54,7 +54,7 @@
#' \code{get_diameter}. \code{farthest_vertices} returns a list with two
#' entries: \itemize{
#' \item \code{vertices} The two vertices that are the farthest.
-#' \item \code{distnace} Their distance.
+#' \item \code{distance} Their distance.
#' }
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
#' @seealso \code{\link{distances}}
@@ -91,10 +91,9 @@ diameter <- function(graph, directed=TRUE, unconnected=TRUE, weights=NULL) {
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_diameter", graph, as.logical(directed),
- as.logical(unconnected), weights,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_diameter, graph, as.logical(directed),
+ as.logical(unconnected), weights)
}
#' @export
@@ -115,10 +114,9 @@ get_diameter <- function(graph, directed=TRUE, unconnected=TRUE,
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_get_diameter", graph, as.logical(directed),
- as.logical(unconnected), weights,
- PACKAGE="igraph") + 1L
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_get_diameter, graph, as.logical(directed),
+ as.logical(unconnected), weights) + 1L
if (igraph_opt("return.vs.es")) {
res <- create_vs(graph, res)
@@ -145,10 +143,9 @@ farthest_vertices <- function(graph, directed=TRUE, unconnected=TRUE,
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_farthest_points", graph, as.logical(directed),
- as.logical(unconnected), weights,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_farthest_points, graph, as.logical(directed),
+ as.logical(unconnected), weights)
res <- list(vertices = res[1:2] + 1L, distance = res[3])
if (igraph_opt("return.vs.es")) {
@@ -166,10 +163,9 @@ mean_distance <- function(graph, directed=TRUE, unconnected=TRUE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_average_path_length", graph, as.logical(directed),
- as.logical(unconnected),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_average_path_length, graph, as.logical(directed),
+ as.logical(unconnected))
}
@@ -219,9 +215,9 @@ degree <- function(graph, v=V(graph),
mode <- igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3, "total"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_degree", graph, v-1,
- as.numeric(mode), as.logical(loops), PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_degree, graph, v-1,
+ as.numeric(mode), as.logical(loops))
if (normalized) { res <- res / (vcount(graph)-1) }
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- V(graph)$name[v]
@@ -233,6 +229,7 @@ degree <- function(graph, v=V(graph),
#' @param cumulative Logical; whether the cumulative degree distribution is to
#' be calculated.
#' @export
+#' @importFrom graphics hist
degree_distribution <- function(graph, cumulative=FALSE, ...) {
@@ -265,7 +262,7 @@ degree_distribution <- function(graph, cumulative=FALSE, ...) {
#'
#' \code{distances} calculates the lengths of pairwise shortest paths from
#' a set of vertices (\code{from}) to another set of vertices (\code{to}). It
-#' uses different algorithms, depending on the \code{argorithm} argument and
+#' uses different algorithms, depending on the \code{algorithm} argument and
#' the \code{weight} edge attribute of the graph. The implemented algorithms
#' are breadth-first search (\sQuote{\code{unweighted}}), this only works for
#' unweighted graphs; the Dijkstra algorithm (\sQuote{\code{dijkstra}}), this
@@ -419,10 +416,10 @@ distances <- function(graph, v=V(graph), to=V(graph),
warning("Unweighted algorithm chosen, weights ignored")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_shortest_paths", graph, v-1, to-1,
- as.numeric(mode), weights, as.numeric(algorithm),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_shortest_paths, graph, v-1, to-1,
+ as.numeric(mode), weights, as.numeric(algorithm))
+
if (igraph_opt("add.vertex.names") && is_named(graph)) {
rownames(res) <- V(graph)$name[v]
colnames(res) <- V(graph)$name[to]
@@ -481,12 +478,11 @@ shortest_paths <- function(graph, from, to=V(graph),
}
to <- as.igraph.vs(graph, to)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_get_shortest_paths", graph,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_get_shortest_paths, graph,
as.igraph.vs(graph, from)-1, to, as.numeric(mode),
as.numeric(length(to)), weights, as.numeric(output),
- as.logical(predecessors), as.logical(inbound.edges),
- PACKAGE="igraph")
+ as.logical(predecessors), as.logical(inbound.edges))
if (!is.null(res$vpath)) {
res$vpath <- lapply(res$vpath, function(x) x+1)
@@ -547,15 +543,15 @@ all_shortest_paths <- function(graph, from,
}
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (is.null(weights)) {
- res <- .Call("R_igraph_get_all_shortest_paths", graph,
+ res <- .Call(C_R_igraph_get_all_shortest_paths, graph,
as.igraph.vs(graph, from)-1, as.igraph.vs(graph, to)-1,
- as.numeric(mode), PACKAGE="igraph")
+ as.numeric(mode))
} else {
- res <- .Call("R_igraph_get_all_shortest_paths_dijkstra", graph,
+ res <- .Call(C_R_igraph_get_all_shortest_paths_dijkstra, graph,
as.igraph.vs(graph, from)-1, as.igraph.vs(graph, to)-1,
- weights, as.numeric(mode), PACKAGE="igraph")
+ weights, as.numeric(mode))
}
if (igraph_opt("return.vs.es")) {
@@ -601,10 +597,9 @@ subcomponent <- function(graph, v, mode=c("all", "out", "in")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_subcomponent", graph, as.igraph.vs(graph, v)-1,
- as.numeric(mode),
- PACKAGE="igraph") + 1L
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_subcomponent, graph, as.igraph.vs(graph, v)-1,
+ as.numeric(mode)) + 1L
if (igraph_opt("return.vs.es")) res <- create_vs(graph, res)
@@ -620,7 +615,7 @@ subcomponent <- function(graph, v, mode=c("all", "out", "in")) {
#'
#' \code{induced_subgraph} calculates the induced subgraph of a set of vertices
#' in a graph. This means that exactly the specified vertices and all the edges
-#' between then will be kept in the result graph.
+#' between them will be kept in the result graph.
#'
#' \code{subgraph.edges} calculates the subgraph of a graph. For this function
#' one can specify the vertices and edges to keep. This function will be
@@ -649,9 +644,8 @@ subgraph <- function(graph, v) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_subgraph", graph, as.igraph.vs(graph, v)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_subgraph, graph, as.igraph.vs(graph, v)-1)
}
#' @rdname subgraph
@@ -673,10 +667,9 @@ induced_subgraph <- function(graph, vids, impl=c("auto", "copy_and_delete", "cre
vids <- as.igraph.vs(graph, vids)
impl <- switch(igraph.match.arg(impl), "auto"=0, "copy_and_delete"=1, "create_from_scratch"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_induced_subgraph", graph, vids-1, impl,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_induced_subgraph, graph, vids-1, impl)
res
}
@@ -693,10 +686,9 @@ subgraph.edges <- function(graph, eids, delete.vertices=TRUE) {
eids <- as.igraph.es(graph, eids)
delete.vertices <- as.logical(delete.vertices)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_subgraph_edges", graph, eids-1, delete.vertices,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_subgraph_edges, graph, eids-1, delete.vertices)
res
}
@@ -724,10 +716,9 @@ estimate_betweenness <- function(graph, vids=V(graph), directed=TRUE, cutoff, we
}
nobigint <- as.logical(nobigint)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_betweenness_estimate", graph, vids-1, directed, cutoff, weights, nobigint,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_betweenness_estimate, graph, vids-1, directed, cutoff, weights, nobigint)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name", vids)
}
@@ -772,7 +763,8 @@ estimate_betweenness <- function(graph, vids=V(graph), directed=TRUE, cutoff, we
#' determining the shortest paths.
#' @param weights Optional positive weight vector for calculating weighted
#' betweenness. If the graph has a \code{weight} edge attribute, then this is
-#' used by default.
+#' used by default. Weights are used to calculate weighted shortest paths,
+#' so they are interpreted as distances.
#' @param nobigint Logical scalar, whether to use big integers during the
#' calculation. This is only required for lattice-like graphs that have very
#' many shortest paths between a pair of vertices. If \code{TRUE} (the
@@ -823,10 +815,9 @@ betweenness <- function(graph, v=V(graph), directed=TRUE, weights=NULL,
} else {
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_betweenness", graph, v-1,
- as.logical(directed), weights, as.logical(nobigint),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_betweenness, graph, v-1,
+ as.logical(directed), weights, as.logical(nobigint))
if (normalized) {
vc <- vcount(graph)
if (is_directed(graph) && directed) {
@@ -963,31 +954,28 @@ transitivity <- function(graph, type=c("undirected", "global", "globalundirected
isolates <- igraph.match.arg(isolates)
isolates <- as.double(switch(isolates, "nan"=0, "zero"=1))
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
if (type==0) {
- .Call("R_igraph_transitivity_undirected", graph, isolates,
- PACKAGE="igraph")
+ .Call(C_R_igraph_transitivity_undirected, graph, isolates)
} else if (type==1) {
if (is.null(vids)) {
- .Call("R_igraph_transitivity_local_undirected_all", graph, isolates,
- PACKAGE="igraph")
+ .Call(C_R_igraph_transitivity_local_undirected_all, graph, isolates)
} else {
vids <- as.igraph.vs(graph, vids)-1
- .Call("R_igraph_transitivity_local_undirected", graph, vids,
- isolates, PACKAGE="igraph")
+ .Call(C_R_igraph_transitivity_local_undirected, graph, vids,
+ isolates)
}
} else if (type==2) {
- .Call("R_igraph_transitivity_avglocal_undirected", graph, isolates,
- PACKAGE="igraph")
+ .Call(C_R_igraph_transitivity_avglocal_undirected, graph, isolates)
} else if (type==3) {
if (is.null(vids)) { vids <- V(graph) }
vids <- as.igraph.vs(graph, vids)-1
if (is.null(weights)) {
- .Call("R_igraph_transitivity_local_undirected", graph, vids,
- isolates, PACKAGE="igraph")
+ .Call(C_R_igraph_transitivity_local_undirected, graph, vids,
+ isolates)
} else {
- .Call("R_igraph_transitivity_barrat", graph, vids, weights,
- isolates, PACKAGE="igraph")
+ .Call(C_R_igraph_transitivity_barrat, graph, vids, weights,
+ isolates)
}
}
}
@@ -999,9 +987,8 @@ transitivity <- function(graph, type=c("undirected", "global", "globalundirected
## stop("Not a graph object")
## }
-## on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
-## .Call("R_igraph_laplacian", graph, as.logical(normalized),
-## PACKAGE="igraph")
+## on.exit( .Call(C_R_igraph_finalizer) )
+## .Call(C_R_igraph_laplacian, graph, as.logical(normalized))
## }
## OLD implementation
@@ -1161,9 +1148,8 @@ constraint <- function(graph, nodes=V(graph), weights=NULL) {
}
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_constraint", graph, nodes-1, as.numeric(weights),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_constraint, graph, nodes-1, as.numeric(weights))
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- V(graph)$name[nodes]
}
@@ -1213,9 +1199,9 @@ reciprocity <- function(graph, ignore.loops=TRUE,
}
mode <- switch(igraph.match.arg(mode), 'default'=0, 'ratio'=1)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_reciprocity", graph, as.logical(ignore.loops),
- as.numeric(mode), PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_reciprocity, graph, as.logical(ignore.loops),
+ as.numeric(mode))
}
@@ -1532,7 +1518,7 @@ alpha.centrality.sparse <- function(graph, nodes=V(graph), alpha=1,
#' algorithm, the routine may fail is certain cases.
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
#' @seealso \code{\link{eigen_centrality}} and \code{\link{power_centrality}}
-#' @references Bonacich, P. and Paulette, L. (2001). ``Eigenvector-like
+#' @references Bonacich, P. and Lloyd, P. (2001). ``Eigenvector-like
#' measures of centrality for asymmetric relations'' \emph{Social Networks},
#' 23, 191-201.
#' @export
@@ -1609,14 +1595,14 @@ edge_density <- function(graph, loops=FALSE) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_density", graph, as.logical(loops),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_density, graph, as.logical(loops))
}
+#' @rdname ego
#' @export
-ego_size <- function(graph, order, nodes=V(graph),
+ego_size <- function(graph, order = 1, nodes=V(graph),
mode=c("all", "out", "in"), mindist=0) {
if (!is_igraph(graph)) {
@@ -1626,10 +1612,10 @@ ego_size <- function(graph, order, nodes=V(graph),
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
mindist <- as.integer(mindist)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_neighborhood_size", graph,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_neighborhood_size, graph,
as.igraph.vs(graph, nodes)-1, as.numeric(order), as.numeric(mode),
- mindist, PACKAGE="igraph")
+ mindist)
}
@@ -1662,7 +1648,7 @@ ego_size <- function(graph, order, nodes=V(graph),
#' @param graph The input graph.
#' @param order Integer giving the order of the neighborhood.
#' @param nodes The vertices for which the calculation is performed.
-#' @param mode Character constatnt, it specifies how to use the direction of
+#' @param mode Character constant, it specifies how to use the direction of
#' the edges if a directed graph is analyzed. For \sQuote{out} only the
#' outgoing edges are followed, so all vertices reachable from the source
#' vertex in at most \code{order} steps are counted. For \sQuote{"in"} all
@@ -1684,22 +1670,22 @@ ego_size <- function(graph, order, nodes=V(graph),
#' @examples
#'
#' g <- make_ring(10)
-#' ego_size(g, 0, 1:3)
-#' ego_size(g, 1, 1:3)
-#' ego_size(g, 2, 1:3)
-#' ego(g, 0, 1:3)
-#' ego(g, 1, 1:3)
-#' ego(g, 2, 1:3)
+#' ego_size(g, order = 0, 1:3)
+#' ego_size(g, order = 1, 1:3)
+#' ego_size(g, order = 2, 1:3)
+#' ego(g, order = 0, 1:3)
+#' ego(g, order = 1, 1:3)
+#' ego(g, order = 2, 1:3)
#'
#' # attributes are preserved
#' V(g)$name <- c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")
-#' make_ego_graph(g, 2, 1:3)
+#' make_ego_graph(g, order = 2, 1:3)
#'
#' # connecting to the neighborhood
#' g <- make_ring(10)
#' g <- connect(g, 2)
#'
-ego <- function(graph, order, nodes=V(graph),
+ego <- function(graph, order = 1, nodes=V(graph),
mode=c("all", "out", "in"), mindist=0) {
if (!is_igraph(graph)) {
@@ -1709,11 +1695,10 @@ ego <- function(graph, order, nodes=V(graph),
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
mindist <- as.integer(mindist)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_neighborhood", graph,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_neighborhood, graph,
as.igraph.vs(graph, nodes)-1, as.numeric(order),
- as.numeric(mode), mindist,
- PACKAGE="igraph")
+ as.numeric(mode), mindist)
res <- lapply(res, function(x) x+1)
if (igraph_opt("return.vs.es")) {
@@ -1726,7 +1711,7 @@ ego <- function(graph, order, nodes=V(graph),
#' @rdname ego
#' @export
-make_ego_graph <- function(graph, order, nodes=V(graph),
+make_ego_graph <- function(graph, order = 1, nodes=V(graph),
mode=c("all", "out", "in"), mindist=0) {
if (!is_igraph(graph)) {
@@ -1736,11 +1721,10 @@ make_ego_graph <- function(graph, order, nodes=V(graph),
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
mindist <- as.integer(mindist)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_neighborhood_graphs", graph,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_neighborhood_graphs, graph,
as.igraph.vs(graph, nodes)-1, as.numeric(order),
- as.numeric(mode), mindist,
- PACKAGE="igraph")
+ as.numeric(mode), mindist)
res
}
@@ -1789,9 +1773,8 @@ coreness <- function(graph, mode=c("all", "out", "in")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_coreness", graph, as.numeric(mode),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_coreness, graph, as.numeric(mode))
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name")
}
@@ -1817,8 +1800,9 @@ coreness <- function(graph, mode=c("all", "out", "in")) {
#' all nodes to which it has edges, so nodes with no incoming edges go first.
#' For \dQuote{\code{in}}, it is quite the opposite: each node comes before all
#' nodes from which it receives edges. Nodes with no outgoing edges go first.
-#' @return A numeric vector containing vertex ids in topologically sorted
-#' order.
+#' @return A vertex sequence (by default, but see the \code{return.vs.es}
+#' option of \code{\link{igraph_options}}) containing vertices in
+#' topologically sorted order.
#' @author Tamas Nepusz \email{ntamas@@gmail.com} and Gabor Csardi
#' \email{csardi.gabor@@gmail.com} for the R interface
#' @keywords graphs
@@ -1836,9 +1820,8 @@ topo_sort <- function(graph, mode=c("out", "all", "in")) {
mode <- igraph.match.arg(mode)
mode <- switch(mode, "out"=1, "in"=2, "all"=3)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_topological_sorting", graph, as.numeric(mode),
- PACKAGE="igraph") + 1L
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_topological_sorting, graph, as.numeric(mode)) + 1L
if (igraph_opt("return.vs.es")) res <- create_vs(graph, res)
@@ -1891,9 +1874,8 @@ girth <- function(graph, circle=TRUE) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_girth", graph, as.logical(circle),
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_girth, graph, as.logical(circle))
if (igraph_opt("return.vs.es") && circle) {
res$circle <- create_vs(graph, res$circle)
}
@@ -1907,9 +1889,8 @@ which_loop <- function(graph, eids=E(graph)) {
if (!is_igraph(graph)) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_is_loop", graph, as.igraph.es(graph, eids)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_is_loop, graph, as.igraph.es(graph, eids)-1)
}
@@ -1980,9 +1961,8 @@ which_multiple <- function(graph, eids=E(graph)) {
if (!is_igraph(graph)) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_is_multiple", graph, as.igraph.es(graph, eids)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_is_multiple, graph, as.igraph.es(graph, eids)-1)
}
#' @export
@@ -1992,9 +1972,8 @@ count_multiple <- function(graph, eids=E(graph)) {
if (!is_igraph(graph)) {
stop("Not a graph object");
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_count_multiple", graph, as.igraph.es(graph, eids)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_count_multiple, graph, as.igraph.es(graph, eids)-1)
}
@@ -2106,16 +2085,15 @@ bfs <- function(graph, root, neimode=c("out", "in", "all", "total"),
neimode <- switch(igraph.match.arg(neimode),
"out"=1, "in"=2, "all"=3, "total"=3)
unreachable <- as.logical(unreachable)
- if (!is.null(restricted)) { restricted <- as.igraph.vs(graph, restricted) }
+ if (!is.null(restricted)) { restricted <- as.igraph.vs(graph, restricted) - 1 }
if (!is.null(callback)) { callback <- as.function(callback) }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_bfs", graph, root, roots, neimode, unreachable,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_bfs, graph, root, roots, neimode, unreachable,
restricted,
as.logical(order), as.logical(rank), as.logical(father),
as.logical(pred), as.logical(succ), as.logical(dist),
- callback, extra, rho,
- PACKAGE="igraph")
+ callback, extra, rho)
if (order) res$order <- res$order+1
if (rank) res$rank <- res$rank+1
@@ -2241,11 +2219,10 @@ dfs <- function(graph, root, neimode=c("out", "in", "all", "total"),
if (!is.null(in.callback)) { in.callback <- as.function(in.callback) }
if (!is.null(out.callback)) { out.callback <- as.function(out.callback) }
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- res <- .Call("R_igraph_dfs", graph, root, neimode, unreachable,
+ on.exit( .Call(C_R_igraph_finalizer) )
+ res <- .Call(C_R_igraph_dfs, graph, root, neimode, unreachable,
as.logical(order), as.logical(order.out), as.logical(father),
- as.logical(dist), in.callback, out.callback, extra, rho,
- PACKAGE="igraph")
+ as.logical(dist), in.callback, out.callback, extra, rho)
if (order) res$order <- res$order+1
if (order.out) res$order.out <- res$order.out+1
@@ -2284,10 +2261,9 @@ edge_betweenness <- function(graph, e=E(graph),
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_edge_betweenness", graph, directed, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_edge_betweenness, graph, directed, weights)
res[as.numeric(e)]
}
@@ -2309,10 +2285,9 @@ estimate_edge_betweenness <- function(graph, e=E(graph),
weights <- NULL
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_edge_betweenness_estimate", graph, directed, cutoff, weights,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_edge_betweenness_estimate, graph, directed, cutoff, weights)
res[as.numeric(e)]
}
@@ -2374,10 +2349,9 @@ components <- function(graph, mode=c("weak", "strong")) {
if (!is_igraph(graph)) { stop("Not a graph object") }
mode <- switch(igraph.match.arg(mode), "weak"=1, "strong"=2)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_clusters", graph, mode,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_clusters, graph, mode)
res$membership <- res$membership + 1
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res$membership) <- V(graph)$name
@@ -2427,10 +2401,9 @@ unfold_tree <- function(graph, mode=c("all", "out", "in", "total"), roots) {
mode <- switch(igraph.match.arg(mode), "out"=1, "in"=2, "all"=3, "total"=3)
roots <- as.igraph.vs(graph, roots)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_unfold_tree", graph, mode, roots,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_unfold_tree, graph, mode, roots)
res
}
@@ -2469,7 +2442,8 @@ unfold_tree <- function(graph, mode=c("all", "out", "in", "total"), roots) {
#' \eqn{n-1}, where \eqn{n} is the number of vertices in the graph.
#' @param weights Optional positive weight vector for calculating weighted
#' closeness. If the graph has a \code{weight} edge attribute, then this is
-#' used by default.
+#' used by default. Weights are used for calculating weighted shortest
+#' paths, so they are interpreted as distances.
#' @return Numeric vector with the closeness values of all the vertices in
#' \code{v}.
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
@@ -2504,10 +2478,10 @@ closeness <- function(graph, vids=V(graph),
}
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_closeness", graph, vids-1, mode, weights,
- normalized, PACKAGE="igraph")
+ res <- .Call(C_R_igraph_closeness, graph, vids-1, mode, weights,
+ normalized)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- V(graph)$name[vids]
}
@@ -2535,10 +2509,9 @@ estimate_closeness <- function(graph, vids=V(graph), mode=c("out", "in", "all",
}
normalized <- as.logical(normalized)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_closeness_estimate", graph, vids-1, mode, cutoff, weights, normalized,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_closeness_estimate, graph, vids-1, mode, cutoff, weights, normalized)
if (igraph_opt("add.vertex.names") && is_named(graph)) {
names(res) <- vertex_attr(graph, "name", vids)
}
@@ -2602,10 +2575,9 @@ laplacian_matrix <- function(graph, normalized=FALSE, weights=NULL,
}
sparse <- as.logical(sparse)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_laplacian", graph, normalized, weights, sparse,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_laplacian, graph, normalized, weights, sparse)
if (sparse) {
res <- igraph.i.spMatrix(res)
}
@@ -2660,6 +2632,8 @@ laplacian_matrix <- function(graph, normalized=FALSE, weights=NULL,
#' @param weights Potential edge weights. If the graph has an edge
#' attribute called \sQuote{\code{weight}}, and this argument is
#' \code{NULL}, then the edge attribute is used automatically.
+#' In weighed matching, the weights of the edges must match as
+#' much as possible.
#' @param eps A small real number used in equality tests in the weighted
#' bipartite matching algorithm. Two real numbers are considered equal in
#' the algorithm if their difference is smaller than \code{eps}. This is
@@ -2693,12 +2667,12 @@ laplacian_matrix <- function(graph, normalized=FALSE, weights=NULL,
#' is_max_matching(g, m3)
#'
#' V(g)$type <- c(FALSE,TRUE)
-#' str(g, v=TRUE)
+#' print_all(g, v=TRUE)
#' max_bipartite_match(g)
#'
#' g2 <- graph_from_literal( a-b-c-d-e-f-g )
#' V(g2)$type <- rep(c(FALSE,TRUE), length=vcount(g2))
-#' str(g2, v=TRUE)
+#' print_all(g2, v=TRUE)
#' max_bipartite_match(g2)
#' #' @keywords graphs
#' @export
@@ -2715,10 +2689,9 @@ is_matching <- function(graph, matching, types=NULL) {
matching <- as.igraph.vs(graph, matching, na.ok=TRUE)-1
matching[ is.na(matching) ] <- -1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_matching", graph, types, matching,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_matching, graph, types, matching)
res
}
@@ -2738,10 +2711,9 @@ is_max_matching <- function(graph, matching, types=NULL) {
matching <- as.igraph.vs(graph, matching, na.ok=TRUE)-1
matching[ is.na(matching) ] <- -1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_is_maximal_matching", graph, types, matching,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_is_maximal_matching, graph, types, matching)
res
}
@@ -2769,11 +2741,10 @@ max_bipartite_match <- function(graph, types=NULL, weights=NULL,
}
eps <- as.numeric(eps)
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_maximum_bipartite_matching", graph, types, weights,
- eps,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_maximum_bipartite_matching, graph, types,
+ weights, eps)
res$matching[ res$matching==0 ] <- NA
if (igraph_opt("add.vertex.names") && is_named(graph)) {
@@ -2839,6 +2810,8 @@ which_mutual <- which_mutual
#' vertex strength (see \code{\link{strength}}) is used instead of vertex
#' degree. But note that \code{knnk} is still given in the function of the
#' normal vertex degree.
+#' Weights are are used to calculate a weighted degree (also called
+#' \code{\link{strength}}) instead of the degree.
#' @return A list with two members: \item{knn}{A numeric vector giving the
#' average nearest neighbor degree for all vertices in \code{vids}.}
#' \item{knnk}{A numeric vector, its length is the maximum (total) vertex
diff --git a/R/structure.info.R b/R/structure.info.R
index c8660a2..3d63177 100644
--- a/R/structure.info.R
+++ b/R/structure.info.R
@@ -50,8 +50,7 @@ are_adjacent <- function(graph, v1, v2) {
if (!is_igraph(graph)) {
stop("Not a graph object")
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_are_connected", graph, as.igraph.vs(graph, v1)-1,
- as.igraph.vs(graph, v2)-1,
- PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_are_connected, graph, as.igraph.vs(graph, v1)-1,
+ as.igraph.vs(graph, v2)-1)
}
diff --git a/R/test.R b/R/test.R
index a3a344b..ac59f5e 100644
--- a/R/test.R
+++ b/R/test.R
@@ -71,8 +71,8 @@ igraph_test <- function() {
#' igraph_version()
igraph_version <- function() {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_version", PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_version)
}
checkpkg <- function(package_file, args=character()) {
diff --git a/R/tkplot.R b/R/tkplot.R
index c78f14c..9d3eefa 100644
--- a/R/tkplot.R
+++ b/R/tkplot.R
@@ -1533,6 +1533,8 @@ tk_canvas <- function(tkp.id) {
# Internal functions: other
###################################################################
+#' @importFrom grDevices palette
+
.tkplot.convert.color <- function(col) {
if (is.numeric(col)) {
## convert numeric color based on current palette
diff --git a/R/topology.R b/R/topology.R
index 3c83a3d..ea90575 100644
--- a/R/topology.R
+++ b/R/topology.R
@@ -69,11 +69,10 @@ graph.get.isomorphisms.vf2 <- function(graph1, graph2, vertex.color1,
edge.color2 <- as.integer(edge.color2)-1L
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_get_isomorphisms_vf2", graph1, graph2, vertex.color1,
- vertex.color2, edge.color1, edge.color2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_get_isomorphisms_vf2, graph1, graph2, vertex.color1,
+ vertex.color2, edge.color1, edge.color2)
lapply(res, function(x) V(graph2)[x + 1])
}
@@ -127,11 +126,10 @@ graph.get.subisomorphisms.vf2 <- function(graph1, graph2, vertex.color1,
edge.color2 <- as.integer(edge.color2)-1L
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_get_subisomorphisms_vf2", graph1, graph2,
- vertex.color1, vertex.color2, edge.color1, edge.color2,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_get_subisomorphisms_vf2, graph1, graph2,
+ vertex.color1, vertex.color2, edge.color1, edge.color2)
lapply(res, function(x) V(graph1)[x + 1])
}
@@ -143,10 +141,9 @@ graph.isoclass.subgraph <- function(graph, vids) {
if (!is_igraph(graph)) { stop("Not a graph object") }
vids <- as.igraph.vs(graph, vids)-1
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_isoclass_subgraph", graph, vids,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_isoclass_subgraph, graph, vids)
res
}
@@ -176,11 +173,10 @@ graph.subisomorphic.lad <- function(pattern, target, domains=NULL,
domains <- lapply(domains, function(x) as.igraph.vs(target, x)-1)
}
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
+ on.exit( .Call(C_R_igraph_finalizer) )
# Function call
- res <- .Call("R_igraph_subisomorphic_lad", pattern, target, domains,
- induced, time.limit, map, all.maps,
- PACKAGE="igraph")
+ res <- .Call(C_R_igraph_subisomorphic_lad, pattern, target, domains,
+ induced, time.limit, map, all.maps)
if (map) {
res$map <- res$map + 1
@@ -309,12 +305,12 @@ isomorphic <- function(graph1, graph2, method = c("auto", "direct",
method <- igraph.match.arg(method)
if (method == "auto") {
- on.exit( .Call("R_igraph_finalizer", PACKAGE="igraph") )
- .Call("R_igraph_isomorphic", graph1, graph2, PACKAGE="igraph")
+ on.exit( .Call(C_R_igraph_finalizer) )
+ .Call(C_R_igraph_isomorphic, graph1, graph2)
} else if (method == "direct") {
- on.exit(.Call("R_igraph_finalizer", PACKAGE = "igraph"))
- .Call("R_igraph_isomorphic_34", graph1, graph2, PACKAGE = "igraph")
+ on.exit(.Call(C_R_igraph_finalizer))
+ .Call(C_R_igraph_isomorphic_34, graph1, graph2)
} else if (method == "vf2") {
graph.isomorphic.vf2(graph1, graph2, ...)$iso
@@ -412,9 +408,7 @@ is_isomorphic_to <- isomorphic
#'
#' # Directed LAD example
#' pattern <- make_graph(~ 1:2:3, 1 -+ 2:3)
-#' uring <- make_ring(10)
#' dring <- make_ring(10, directed = TRUE)
-#' subgraph_isomorphic(pattern, uring)
#' subgraph_isomorphic(pattern, dring)
subgraph_isomorphic <- function(pattern, target,
diff --git a/R/triangles.R b/R/triangles.R
index b1da545..2f3fe4b 100644
--- a/R/triangles.R
+++ b/R/triangles.R
@@ -43,7 +43,7 @@
#' @return For \code{triangles} a numeric vector of vertex ids, the first three
#' vertices belong to the first triangle found, etc.
#'
-#' For \code{triangles} a numeric vector, the number of triangles for all
+#' For \code{count_triangles} a numeric vector, the number of triangles for all
#' vertices queried.
#' @author Gabor Csardi \email{csardi.gabor@@gmail.com}
#' @seealso \code{\link{transitivity}}
diff --git a/R/utils.R b/R/utils.R
index 2902c5b..cb52e7a 100644
--- a/R/utils.R
+++ b/R/utils.R
@@ -84,7 +84,7 @@ capitalize <- function(x) {
}
address <- function(x) {
- .Call("R_igraph_address", x, PACKAGE = "igraph")
+ .Call(C_R_igraph_address, x)
}
`%+%` <- function(x, y) {
diff --git a/R/uuid.R b/R/uuid.R
index ced0625..a6b61b7 100644
--- a/R/uuid.R
+++ b/R/uuid.R
@@ -1,12 +1,12 @@
generate_uuid <- function(use_time = NA) {
- .Call("UUID_gen", as.logical(use_time), PACKAGE="igraph")
+ .Call(C_UUID_gen, as.logical(use_time))
}
get_graph_id <- function(graph) {
if (!warn_version(graph)) {
- .Call("R_igraph_get_graph_id", graph, PACKAGE = "igraph")
+ .Call(C_R_igraph_get_graph_id, graph)
} else {
NA_character_
}
diff --git a/R/versions.R b/R/versions.R
index 1f1c0c5..86e7115 100644
--- a/R/versions.R
+++ b/R/versions.R
@@ -48,7 +48,7 @@ graph_version <- function(graph) {
} else {
stopifnot(is_igraph(graph))
- .Call("R_igraph_graph_version", graph, PACKAGE = "igraph")
+ .Call(C_R_igraph_graph_version, graph)
}
}
@@ -82,10 +82,10 @@ upgrade_graph <- function(graph) {
if (g_ver < p_ver) {
if ((g_ver == "0.4.0" && p_ver == "0.8.0")) {
- .Call("R_igraph_add_env", graph, PACKAGE = "igraph")
+ .Call(C_R_igraph_add_env, graph)
} else if (g_ver == "0.7.999" && p_ver == "0.8.0") {
- .Call("R_igraph_add_version_to_env", graph, PACKAGE = "igraph")
+ .Call(C_R_igraph_add_version_to_env, graph)
} else {
stop("Don't know how to upgrade graph from ", g_ver, " to ", p_ver)
diff --git a/R/weakref.R b/R/weakref.R
index e1afe43..01e2265 100644
--- a/R/weakref.R
+++ b/R/weakref.R
@@ -23,19 +23,17 @@
## -----------------------------------------------------------------------
make_weak_ref <- function(key, value, finalizer = NULL) {
- base::.Call("R_igraph_make_weak_ref", key, value,
- finalizer, PACKAGE = "igraph")
+ .Call(C_R_igraph_make_weak_ref, key, value, finalizer)
}
weak_ref_key <- function(ref) {
- base::.Call("R_igraph_weak_ref_key", ref, PACKAGE = "igraph")
+ .Call(C_R_igraph_weak_ref_key, ref)
}
weak_ref_value <- function(ref) {
- base::.Call("R_igraph_weak_ref_value", ref, PACKAGE = "igraph")
+ .Call(C_R_igraph_weak_ref_value, ref)
}
weak_ref_run_finalizer <- function(ref) {
- base::.Call("R_igraph_weak_ref_run_finalizer", ref,
- PACKAGE = "igraph")
+ .Call(C_R_igraph_weak_ref_run_finalizer, ref)
}
diff --git a/R/zzz-deprecate.R b/R/zzz-deprecate.R
index 82594cf..9ce2a15 100644
--- a/R/zzz-deprecate.R
+++ b/R/zzz-deprecate.R
@@ -33,6 +33,8 @@ NULL
## For the future, right now, we do not warn or even message
+#' @importFrom utils packageName
+
deprecated <- function(old, new) {
assign(old, new, envir = asNamespace(packageName()))
}
diff --git a/configure b/configure
index 568ff62..e8b5fbf 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for igraph @VERSION at .
+# Generated by GNU Autoconf 2.69 for igraph 1.1.1.
#
# Report bugs to <csardi.gabor at gmail.com>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='igraph'
PACKAGE_TARNAME='igraph'
-PACKAGE_VERSION='@VERSION@'
-PACKAGE_STRING='igraph @VERSION@'
+PACKAGE_VERSION='1.1.1'
+PACKAGE_STRING='igraph 1.1.1'
PACKAGE_BUGREPORT='csardi.gabor at gmail.com'
PACKAGE_URL=''
@@ -1248,7 +1248,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures igraph @VERSION@ to adapt to many kinds of systems.
+\`configure' configures igraph 1.1.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1309,7 +1309,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of igraph @VERSION@:";;
+ short | recursive ) echo "Configuration of igraph 1.1.1:";;
esac
cat <<\_ACEOF
@@ -1401,7 +1401,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-igraph configure @VERSION@
+igraph configure 1.1.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2123,7 +2123,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by igraph $as_me @VERSION@, which was
+It was created by igraph $as_me 1.1.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -5128,7 +5128,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by igraph $as_me @VERSION@, which was
+This file was extended by igraph $as_me 1.1.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -5190,7 +5190,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-igraph config.status @VERSION@
+igraph config.status 1.1.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index ab578ed..a31981a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(igraph, @VERSION@, csardi.gabor at gmail.com)
+AC_INIT(igraph, 1.1.1, csardi.gabor at gmail.com)
AC_CONFIG_SRCDIR(src/rinterface.c)
AC_CONFIG_HEADERS(src/config.h)
diff --git a/inst/NEWS.md b/inst/NEWS.md
index c741ad7..8d59dce 100644
--- a/inst/NEWS.md
+++ b/inst/NEWS.md
@@ -1,4 +1,74 @@
+# igraph 1.1.2
+
+Jul 20, 2017
+
+- Fix compilation on Solaris
+
+
+# igraph 1.1.1
+
+Jul 13, 2017
+
+- Graph id is printed in the header, and a `graph_id` function was added
+- Fix `edge_attr` for some index values
+- Fix a `bfs()` bug, `restricted` argument was zero-based
+- `match_vertices` is exported now
+- `%>%` is re-exported in a better way, to avoid interference with other
+ packages
+- `ego_` functions default to `order = 1` now
+- New function `igraph_with_opt` to run code with temporary igraph
+ options settings
+- Fix broken `sample_asym_pref` function
+- Fix `curve_multiple` to avoid warnings for graphs with self-loops.
+- The `NMF` package is only suggested now, it is not a hard
+ dependency
+- Fix gen_uid.c _SVID_SOURCE issues
+- Avoid drawing straight lines as Bezier curves
+- Use the `pkgconfig` package for options. This allows setting options
+ on a per-package basis. E.g. a package using igraph can set `return.vs.es`
+ to `FALSE` in its `.onLoad()` function, and then igraph will return
+ plain numeric vectors instead of vertex/edge sequences
+ *if called from this package*.
+- `igraph_options()` returns the *old* values of the updated options,
+ this is actually useful, returning the new values was not.
+- `with_igraph_opt()` function to temporarily change values of
+ igraph options.
+- `get.edge()` is deprecated, use `ends()` instead. (This was already the case
+ for igraph 1.0.0, but we forgot to add a NEWS point for it.)
+- Do not redefine `.Call()`, to make native calls faster.
+- Speed up special cases of indexing vertex sequences.
+- Removed an `anyNA()` call, to be compatible with older R versions.
+- Fixed a fast-greedy community finding bug,
+ https://github.com/igraph/igraph/issues/836
+- Fixed `head_of()` and `tail_of()`, they were mixed up.
+- Plot: make `label.dist` independent of label lengths, fixes #63.
+- Plot: no error for unknown graphical parameters.
+- Import functions from base packages, to eliminate
+ `R CMD check` `NOTE`s.
+- Readd support for edge weights in Fruchterman-Reingold layout
+- Check membershiph vector in `modularity()`.
+- Rename `str.igraph()` to `print_all()`.
+- Use the igraph version in exported graphs, instread of @VERSION@ #75.
+- Functions that can be used inside a `V()` or `E()` indexing
+ now begin with a dot. Old names are deprecated.
+ New names: `.nei()`, `.innei()`, `.outnei()`, `.inc()`, `.from()`,
+ `.to()`. #22
+- Fix packages that convert graphs to graph::graphNEL: they
+ don't need to attach 'graph' manually any more.
+- Fix a bugs in `layout_with_dh`, `layout_with_gem` and
+ `layout_with_sugiyama`. They crashed in some cases.
+
+# igraph 1.0.1
+
+June 26, 2015
+
+Some minor updates:
+
+- Documentation fixes.
+- Do not require a C++-11 compiler any more.
+- Fedora, Solaris and Windows compilation fixes.
+
# igraph 1.0.0
June 21, 2015
diff --git a/inst/README.md b/inst/README.md
index 53a0330..565126a 100644
--- a/inst/README.md
+++ b/inst/README.md
@@ -15,6 +15,7 @@ For the development version, you can use Github, with the `devtools`
package:
```r
+devtools::install_github("gaborcsardi/pkgconfig")
devtools::install_github("igraph/rigraph")
```
diff --git a/inst/benchmarks/time_call.R b/inst/benchmarks/time_call.R
index 3d12bd3..75f14f5 100644
--- a/inst/benchmarks/time_call.R
+++ b/inst/benchmarks/time_call.R
@@ -4,11 +4,11 @@ time_group(".Call from R")
time_that("Redefining .Call does not have much overhead #1", replications=10,
init = { library(igraph) ; g <- graph.ring(100) },
{ for (i in 1:20000) {
- base::.Call("R_igraph_vcount", g, PACKAGE = "igraph")
+ .Call(C_R_igraph_vcount, g)
} })
time_that("Redefining .Call does not have much overhead #1", replications=10,
init = { library(igraph) ; g <- graph.ring(100) },
{ for (i in 1:20000) {
- igraph:::.Call("R_igraph_vcount", g, PACKAGE = "igraph")
+ igraph:::.Call(C_R_igraph_vcount, g)
} })
diff --git a/inst/tests/test-vs-es-printing.R b/inst/tests/test-vs-es-printing.R
deleted file mode 100644
index aa9ed6e..0000000
--- a/inst/tests/test-vs-es-printing.R
+++ /dev/null
@@ -1,88 +0,0 @@
-
-context("Detailed printing of vs and es")
-
-test_that("vs printing", {
-
- set.seed(42)
- g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
- set_vertex_attr("color", value = "red") %>%
- set_vertex_attr("weight", value = sample(1:10, 3))
-
- o1 <- c("+ 1/3 vertex, named:", " name color weight",
- "1 A red 10")
- expect_output(V(g)[[1]], paste(o1, collapse = "\n"), fixed = TRUE)
-
- o2 <- c("+ 1/3 vertex, named:", " name color weight",
- "2 B red 9")
- expect_output(V(g)[[2]], paste(o2, collapse = "\n"), fixed = TRUE)
-
- o3 <- c("+ 2/3 vertices, named:", " name color weight",
- "1 A red 10", "2 B red 9")
- expect_output(V(g)[[1:2]], paste(o3, collapse = "\n"), fixed = TRUE)
-
- o4 <- c("+ 2/3 vertices, named:", " name color weight",
- "2 B red 9", "3 C red 3")
- expect_output(V(g)[[2:3]], paste(o4, collapse = "\n"), fixed = TRUE)
-
-})
-
-test_that("vs printing, complex attributes", {
-
- set.seed(42)
- g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
- set_vertex_attr("color", value = "red") %>%
- set_vertex_attr("weight", value = sample(1:10, 3)) %>%
- set_vertex_attr("cplx", value = replicate(3, 1:4, simplify = FALSE))
-
- o1 <- c("+ 1/3 vertex, named:", "$name", "[1] \"A\"", "", "$color",
- "[1] \"red\"", "", "$weight", "[1] 10", "", "$cplx", "$cplx[[1]]",
- "[1] 1 2 3 4", "", "")
- expect_output(V(g)[[1]], paste(o1, collapse = "\n"), fixed = TRUE)
-
- o2 <- c("+ 2/3 vertices, named:", "$name", "[1] \"B\" \"C\"", "", "$color",
- "[1] \"red\" \"red\"", "", "$weight", "[1] 9 3", "", "$cplx",
- "$cplx[[1]]", "[1] 1 2 3 4", "", "$cplx[[2]]", "[1] 1 2 3 4",
- "", "")
- expect_output(V(g)[[2:3]], paste(o2, collapse = "\n"), fixed = TRUE)
-
-})
-
-test_that("es printing", {
-
- set.seed(42)
- g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
- set_edge_attr("color", value = "red") %>%
- set_edge_attr("weight", value = sample(1:10, 3))
-
- o1 <- c("+ 1/3 edge (vertex names):",
- " tail head tid hid color weight",
- "1 B A 2 1 red 10")
- expect_output(E(g)[[1]], paste(o1, collapse = "\n"), fixed = TRUE)
-
- o2 <- c("+ 2/3 edges (vertex names):",
- " tail head tid hid color weight",
- "2 C A 3 1 red 9",
- "3 C B 3 2 red 3")
- expect_output(E(g)[[2:3]], paste(o2, collapse = "\n"), fixed = TRUE)
-
-})
-
-test_that("es printing, complex attributes", {
-
- set.seed(42)
- g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
- set_edge_attr("color", value = "red") %>%
- set_edge_attr("weight", value = sample(1:10, 3)) %>%
- set_edge_attr("cmpx", value = replicate(3, 1:4, simplify = FALSE))
-
- o1 <- c("+ 1/3 edge (vertex names):", "$color", "[1] \"red\"", "",
- "$weight", "[1] 10", "", "$cmpx", "$cmpx[[1]]", "[1] 1 2 3 4",
- "", "")
- expect_output(E(g)[[1]], paste(o1, collapse = "\n"), fixed = TRUE)
-
- o2 <- c("+ 2/3 edges (vertex names):", "$color", "[1] \"red\" \"red\"",
- "", "$weight", "[1] 9 3", "", "$cmpx", "$cmpx[[1]]",
- "[1] 1 2 3 4", "", "$cmpx[[2]]", "[1] 1 2 3 4", "", "")
- expect_output(E(g)[[2:3]], paste(o2, collapse = "\n"), fixed = TRUE)
-
-})
diff --git a/inst/tests/test-vs-indexing-lapply.R b/inst/tests/test-vs-indexing-lapply.R
deleted file mode 100644
index 0531a33..0000000
--- a/inst/tests/test-vs-indexing-lapply.R
+++ /dev/null
@@ -1,11 +0,0 @@
-
-context("VS/ES indexing")
-
-test_that("VS/ES indexing works in tricky situations", {
-
- g <- make_ring(10)
- x <- list(V(g)[1:5], V(g)[6:10])
- lapply(x, function(i) { V(g)[i] })
- lapply(x, function(i) { V(g)[[i]] })
-
-})
diff --git a/inst/tests/test_callbacks.R b/inst/tests/test_callbacks.R
deleted file mode 100644
index 13611ca..0000000
--- a/inst/tests/test_callbacks.R
+++ /dev/null
@@ -1,10 +0,0 @@
-
-context("igraph callbacks in R")
-
-test_that("igraph calls from callbacks are not allowed", {
-
- library(igraph)
- f <- function(graph, data, extra) { vcount(graph) }
- expect_that(bfs(make_ring(10), root=1, callback=f),
- throws_error("igraph callbacks cannot call igraph functions"))
-})
diff --git a/inst/tests/test_igraph.options.R b/inst/tests/test_igraph.options.R
deleted file mode 100644
index 210ad57..0000000
--- a/inst/tests/test_igraph.options.R
+++ /dev/null
@@ -1,14 +0,0 @@
-
-context("igraph_options")
-
-test_that("igraph_options works", {
-
- library(igraph)
-
- igraph_options(verbose=TRUE)
- expect_that(igraph_opt("verbose"), is_true())
-
- igraph_options(verbose=FALSE)
- expect_that(igraph_opt("verbose"), is_false())
-
-})
diff --git a/inst/tests/test_layout.gem.R b/inst/tests/test_layout.gem.R
deleted file mode 100644
index e9dab24..0000000
--- a/inst/tests/test_layout.gem.R
+++ /dev/null
@@ -1,12 +0,0 @@
-
-context("GEM layout")
-
-test_that("GEM layout works", {
-
- set.seed(42)
- l <- cbind(1:10, rep(2:3, each=5))
- g <- make_ring(10)
- l2 <- layout_with_gem(g, coords=l, maxiter=1)
- test_that(l[1:9,], equals(l2[1:9,]))
-
-})
diff --git a/inst/tests/test_scg.R b/inst/tests/test_scg.R
deleted file mode 100644
index 7906c3b..0000000
--- a/inst/tests/test_scg.R
+++ /dev/null
@@ -1,66 +0,0 @@
-
-context("scg")
-
-## TODO: we only test that they run, not the results
-
-test_that("SCG functions work", {
-
- library(igraph)
-
- tree <- make_tree(10, 3, "undirected")
- treeM <- as_adj(tree, sparse=TRUE)
- treeM2 <- as_adj(tree, sparse=FALSE)
-
- args <- list(ev=1, nt=3, mtype="symmetric", algo="exact_scg",
- semproj=TRUE, epairs=TRUE)
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
- args[["ev"]] <- 3
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
- args[["ev"]] <- c(1,3)
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
-###############################
-
- args <- list(ev=1, nt=2, mtype="stochastic", algo="exact_scg",
- semproj=TRUE, epairs=TRUE, stat.prob=TRUE)
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
- args[["ev"]] <- 3
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
- args[["ev"]] <- c(1,3)
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
-###############################
-
- args <- list(ev=1, nt=2, mtype="laplacian", algo="exact_scg",
- semproj=TRUE, epairs=TRUE)
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
- args[["ev"]] <- 3
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
- args[["ev"]] <- c(1,3)
- do.call(scg, c(list(tree), args))
- do.call(scg, c(list(treeM), args))
- do.call(scg, c(list(treeM2), args))
-
-})
diff --git a/man/E.Rd b/man/E.Rd
index f2763a8..9200930 100644
--- a/man/E.Rd
+++ b/man/E.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{E}
\alias{E}
@@ -31,7 +31,7 @@ edges based on attributes, or graph structure, creating the
intersection, union of edges, etc.
}
\details{
-Edge sequences are usually used as igraph function arguments that
+Edge sequences are usually used as igraph function arguments that
refer to edges of a graph.
An edge sequence is tied to the graph it refers to: it really denoted
@@ -57,6 +57,7 @@ attributes. See \code{\link{[.igraph.es}} for details.
Edge sequences can be used to query or set attributes for the
edges in the sequence. See \code{\link{$.igraph.es}} for details.
}
+
\examples{
# Edges of an unnamed graph
g <- make_ring(10)
@@ -68,33 +69,13 @@ g2 <- make_ring(10) \%>\%
E(g2)
}
\seealso{
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
+Other vertex and edge sequences: \code{\link{V}},
\code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{V}};
- \code{\link{[.igraph.es}}, \code{\link{\%--\%}},
- \code{\link{\%->\%}}, \code{\link{\%<-\%}},
- \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
}
-
diff --git a/man/V.Rd b/man/V.Rd
index 91b52e7..bc2a1f3 100644
--- a/man/V.Rd
+++ b/man/V.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{V}
\alias{V}
@@ -50,6 +50,7 @@ attributes. See \code{\link{[.igraph.vs}} for details.
Vertex sequences can be used to query or set attributes for the
vertices in the sequence. See \code{\link{$.igraph.vs}} for details.
}
+
\examples{
# Vertex ids of an unnamed graph
g <- make_ring(10)
@@ -61,33 +62,13 @@ g2 <- make_ring(10) \%>\%
V(g2)
}
\seealso{
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
+Other vertex and edge sequences: \code{\link{E}},
\code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{[.igraph.es}}, \code{\link{\%--\%}},
- \code{\link{\%->\%}}, \code{\link{\%<-\%}},
- \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
}
-
diff --git a/man/aaa-igraph-package.Rd b/man/aaa-igraph-package.Rd
index 1abf6ec..7e44ecc 100644
--- a/man/aaa-igraph-package.Rd
+++ b/man/aaa-igraph-package.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/igraph-package.R
\docType{package}
\name{igraph-package}
-\alias{igraph}
\alias{igraph-package}
+\alias{igraph}
\title{The igraph package}
\description{
igraph is a library and R package for network analysis.
@@ -45,9 +45,8 @@ allowing rapid prototyping via high level languages like R.
details.
If you want to see the edges of the graph as well, then use the
- \code{\link{str.igraph}} function, it is of course enough to type
- \code{str} instead of \code{str.igraph}: \preformatted{ > str(g)
- IGRAPH U--- 10 10 -- Ring graph
+ \code{\link{print_all}} function: \preformatted{ > print_all(g)
+ IGRAPH badcafe U--- 10 10 -- Ring graph
+ attr: name (g/c), mutual (g/x), circular (g/x)
+ edges:
[1] 1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10 }
@@ -123,7 +122,7 @@ allowing rapid prototyping via high level languages like R.
directed, edge going from \sQuote{\code{from}} to
\sQuote{\code{to}}. The two forms can also be mixed in the same edge
selector.
-
+
Other attributes define visualization parameters, see
\code{\link{igraph.plotting}} for details.
diff --git a/man/add_edges.Rd b/man/add_edges.Rd
index 684d407..84d2a4b 100644
--- a/man/add_edges.Rd
+++ b/man/add_edges.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{add_edges}
-\alias{add.edges}
\alias{add_edges}
+\alias{add.edges}
\title{Add edges to a graph}
\usage{
add_edges(graph, edges, ..., attr = list())
@@ -43,13 +43,9 @@ E(g)[[]]
plot(g)
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{path}};
- \code{\link{vertex}}, \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_vertices}}, \code{\link{delete_edges}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{path}},
+ \code{\link{vertex}}
}
-
diff --git a/man/add_layout_.Rd b/man/add_layout_.Rd
index 21f8ff5..562269a 100644
--- a/man/add_layout_.Rd
+++ b/man/add_layout_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{add_layout_}
\alias{add_layout_}
@@ -28,42 +28,23 @@ Add layout to graph
\seealso{
\code{\link{layout_}} for a description of the layout API.
-Other graph layouts: \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
}
-
diff --git a/man/add_vertices.Rd b/man/add_vertices.Rd
index cca6f44..5fd96c0 100644
--- a/man/add_vertices.Rd
+++ b/man/add_vertices.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{add_vertices}
-\alias{add.vertices}
\alias{add_vertices}
+\alias{add.vertices}
\title{Add vertices to a graph}
\usage{
add_vertices(graph, nv, ..., attr = list())
@@ -38,13 +38,9 @@ V(g)[[]]
plot(g)
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{path}};
- \code{\link{vertex}}, \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{delete_edges}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{path}},
+ \code{\link{vertex}}
}
-
diff --git a/man/adjacent_vertices.Rd b/man/adjacent_vertices.Rd
index 4c0aeb1..b38f483 100644
--- a/man/adjacent_vertices.Rd
+++ b/man/adjacent_vertices.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{adjacent_vertices}
\alias{adjacent_vertices}
@@ -27,15 +27,11 @@ g <- make_graph("Zachary")
adjacent_vertices(g, c(1, 34))
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{are.connected}},
- \code{\link{are_adjacent}}; \code{\link{ecount}},
- \code{\link{gsize}}; \code{\link{ends}},
- \code{\link{get.edge}}, \code{\link{get.edges}};
- \code{\link{get.edge.ids}}; \code{\link{gorder}},
- \code{\link{vcount}}; \code{\link{head_of}};
- \code{\link{incident_edges}}; \code{\link{incident}};
- \code{\link{is.directed}}, \code{\link{is_directed}};
- \code{\link{neighbors}}; \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{are_adjacent}},
+ \code{\link{ends}}, \code{\link{get.edge.ids}},
+ \code{\link{gorder}}, \code{\link{gsize}},
+ \code{\link{head_of}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/all_simple_paths.Rd b/man/all_simple_paths.Rd
index e1c308d..0cfccbc 100644
--- a/man/all_simple_paths.Rd
+++ b/man/all_simple_paths.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{all_simple_paths}
\alias{all_simple_paths}
@@ -39,9 +39,10 @@ function, if your graph is lattice-like.
This function currently ignored multiple and loop edges.
}
\examples{
+
g <- make_ring(10)
all_simple_paths(g, 1, 5)
all_simple_paths(g, 1, c(3,5))
+
}
\keyword{graphs}
-
diff --git a/man/alpha_centrality.Rd b/man/alpha_centrality.Rd
index d93c866..7b73093 100644
--- a/man/alpha_centrality.Rd
+++ b/man/alpha_centrality.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{alpha_centrality}
-\alias{alpha.centrality}
\alias{alpha_centrality}
+\alias{alpha.centrality}
\title{Find Bonacich alpha centrality scores of network positions}
\usage{
alpha_centrality(graph, nodes = V(graph), alpha = 1, loops = FALSE,
@@ -64,7 +64,9 @@ endogenous versus exogenous factors.
Singular adjacency matrices cause problems for this
algorithm, the routine may fail is certain cases.
}
+
\examples{
+
# The examples from Bonacich's paper
g.1 <- graph( c(1,3,2,3,3,4,4,5) )
g.2 <- graph( c(2,1,3,1,4,1,5,1) )
@@ -72,17 +74,17 @@ g.3 <- graph( c(1,2,2,3,3,4,4,1,5,1) )
alpha_centrality(g.1)
alpha_centrality(g.2)
alpha_centrality(g.3,alpha=0.5)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
-Bonacich, P. and Paulette, L. (2001). ``Eigenvector-like
+Bonacich, P. and Lloyd, P. (2001). ``Eigenvector-like
measures of centrality for asymmetric relations'' \emph{Social Networks},
23, 191-201.
}
\seealso{
\code{\link{eigen_centrality}} and \code{\link{power_centrality}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/are_adjacent.Rd b/man/are_adjacent.Rd
index aa46102..4c06863 100644
--- a/man/are_adjacent.Rd
+++ b/man/are_adjacent.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structure.info.R
\name{are_adjacent}
-\alias{are.connected}
\alias{are_adjacent}
+\alias{are.connected}
\title{Are two vertices adjacent?}
\usage{
are_adjacent(graph, v1, v2)
@@ -34,15 +34,11 @@ are_adjacent(ug, 1, 2)
are_adjacent(ug, 2, 1)
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{neighbors}};
- \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{ends}}, \code{\link{get.edge.ids}},
+ \code{\link{gorder}}, \code{\link{gsize}},
+ \code{\link{head_of}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/arpack.Rd b/man/arpack.Rd
index 97ff0ce..a8aea12 100644
--- a/man/arpack.Rd
+++ b/man/arpack.Rd
@@ -1,29 +1,15 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\docType{data}
\name{arpack_defaults}
+\alias{arpack_defaults}
\alias{arpack}
\alias{arpack-options}
+\alias{igraph.arpack.default}
\alias{arpack.unpack.complex}
\alias{arpack_defaults}
-\alias{igraph.arpack.default}
\title{ARPACK eigenvector calculation}
-\format{\preformatted{List of 14
- $ bmat : chr "I"
- $ n : num 0
- $ which : chr "XX"
- $ nev : num 1
- $ tol : num 0
- $ ncv : num 3
- $ ldv : num 0
- $ ishift : num 1
- $ maxiter: num 1000
- $ nb : num 1
- $ mode : num 1
- $ start : num 0
- $ sigma : num 0
- $ sigmai : num 0
-}}
+\format{An object of class \code{list} of length 14.}
\usage{
arpack_defaults
@@ -171,6 +157,7 @@ re-orthogonalization.} } } Please see the ARPACK documentation for
additional details.
}
\examples{
+
# Identity matrix
f <- function(x, extra=NULL) x
arpack(f, options=list(n=10, nev=2, ncv=4), sym=TRUE)
@@ -194,17 +181,14 @@ eigen(laplacian_matrix(make_star(10, mode="undirected")))
## First three eigenvalues of the adjacency matrix of a graph
## We need the 'Matrix' package for this
if (require(Matrix)) {
+ set.seed(42)
g <- sample_gnp(1000, 5/1000)
M <- as_adj(g, sparse=TRUE)
f2 <- function(x, extra=NULL) { cat("."); as.vector(M \%*\% x) }
baev <- arpack(f2, sym=TRUE, options=list(n=vcount(g), nev=3, ncv=8,
- which="LM", maxiter=200))
+ which="LM", maxiter=2000))
}
}
-\author{
-Rich Lehoucq, Kristi Maschhoff, Danny Sorensen, Chao Yang for
-ARPACK, Gabor Csardi \email{csardi.gabor at gmail.com} for the R interface.
-}
\references{
D.C. Sorensen, Implicit Application of Polynomial Filters in a
k-Step Arnoldi Method. \emph{SIAM J. Matr. Anal. Apps.}, 13 (1992), pp
@@ -224,6 +208,9 @@ Matrices. \emph{Linear Algebra and its Applications}, vol 88/89, pp 575-595,
functions in igraph which use ARPACK. The ARPACK homepage is at
\url{http://www.caam.rice.edu/software/ARPACK/}.
}
+\author{
+Rich Lehoucq, Kristi Maschhoff, Danny Sorensen, Chao Yang for
+ARPACK, Gabor Csardi \email{csardi.gabor at gmail.com} for the R interface.
+}
\keyword{datasets}
\keyword{graphs}
-
diff --git a/man/articulation_points.Rd b/man/articulation_points.Rd
index f7995a4..b21e2d0 100644
--- a/man/articulation_points.Rd
+++ b/man/articulation_points.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/components.R
\name{articulation_points}
-\alias{articulation.points}
\alias{articulation_points}
+\alias{articulation.points}
\title{Articulation points of a graph}
\usage{
articulation_points(graph)
@@ -27,17 +27,17 @@ undirected. If a graph contains no articulation points, then its vertex
connectivity is at least two.
}
\examples{
+
g <- disjoint_union( make_full_graph(5), make_full_graph(5) )
clu <- components(g)$membership
g <- add_edges(g, c(match(1, clu), match(2, clu)) )
articulation_points(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{biconnected_components}}, \code{\link{components}},
\code{\link{is_connected}}, \code{\link{vertex_connectivity}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/as.directed.Rd b/man/as.directed.Rd
index cdf4e7d..b49aa5a 100644
--- a/man/as.directed.Rd
+++ b/man/as.directed.Rd
@@ -1,8 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as.directed}
\alias{as.directed}
\alias{as.undirected}
+\alias{as.undirected}
\title{Convert between directed and undirected graphs}
\usage{
as.directed(graph, mode = c("mutual", "arbitrary"))
@@ -50,6 +51,7 @@ edges are ignored. This mode might create multiple edges if there are more
than one mutual edge pairs between the same pair of vertices. } }
}
\examples{
+
g <- make_ring(10)
as.directed(g, "mutual")
g2 <- make_star(10)
@@ -74,13 +76,13 @@ E(g4)$weight <- seq_len(ecount(g4))
ug4 <- as.undirected(g4, mode="mutual",
edge.attr.comb=list(weight=length))
print(ug4, e=TRUE)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{simplify}} for removing multiple and/or loop edges from
a graph.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/as.igraph.Rd b/man/as.igraph.Rd
index 8ed3976..10204ad 100644
--- a/man/as.igraph.Rd
+++ b/man/as.igraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{as.igraph}
\alias{as.igraph}
@@ -25,12 +25,13 @@ These objects are created by the \code{\link{fit_hrg}} and
\code{\link{consensus_tree}} functions. }
}
\examples{
+
g <- make_full_graph(5) + make_full_graph(5)
hrg <- fit_hrg(g)
as.igraph(hrg)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}.
}
\keyword{graphs}
-
diff --git a/man/as_adj_list.Rd b/man/as_adj_list.Rd
index 9bbf8b3..4a6064b 100644
--- a/man/as_adj_list.Rd
+++ b/man/as_adj_list.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_adj_list}
-\alias{as_adj_edge_list}
\alias{as_adj_list}
\alias{get.adjedgelist}
+\alias{as_adj_edge_list}
\alias{get.adjlist}
\title{Adjacency lists}
\usage{
@@ -36,15 +36,16 @@ ids of adjacent edgs (according to the \code{mode} argument) of all
vertices.
}
\examples{
+
g <- make_ring(10)
as_adj_list(g)
as_adj_edge_list(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{as_edgelist}}, \code{\link{as_adj}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/as_adjacency_matrix.Rd b/man/as_adjacency_matrix.Rd
index 7f42c7c..3e6328b 100644
--- a/man/as_adjacency_matrix.Rd
+++ b/man/as_adjacency_matrix.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_adjacency_matrix}
-\alias{as_adj}
\alias{as_adjacency_matrix}
\alias{get.adjacency}
+\alias{as_adj}
\title{Convert a graph to an adjacency matrix}
\usage{
as_adjacency_matrix(graph, type = c("both", "upper", "lower"), attr = NULL,
@@ -60,6 +60,7 @@ defined in the \sQuote{\code{Matrix}} package, if \code{sparse} if
\code{TRUE}.
}
\examples{
+
g <- sample_gnp(10, 2/10)
as_adjacency_matrix(g)
V(g)$name <- letters[1:vcount(g)]
@@ -70,4 +71,3 @@ as_adjacency_matrix(g, attr="weight")
\seealso{
\code{\link{graph_from_adjacency_matrix}}, \code{\link{read_graph}}
}
-
diff --git a/man/as_edgelist.Rd b/man/as_edgelist.Rd
index 61d340d..45444c3 100644
--- a/man/as_edgelist.Rd
+++ b/man/as_edgelist.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_edgelist}
\alias{as_edgelist}
@@ -25,14 +25,15 @@ graph, like an edge list.
\code{as_edgelist} returns the list of edges in a graph.
}
\examples{
+
g <- sample_gnp(10, 2/10)
as_edgelist(g)
V(g)$name <- LETTERS[seq_len(gorder(g))]
as_edgelist(g)
+
}
\seealso{
\code{\link{graph_from_adjacency_matrix}}, \code{\link{read_graph}}
}
\keyword{graphs}
-
diff --git a/man/as_graphnel.Rd b/man/as_graphnel.Rd
index 3d4a3f7..738c634 100644
--- a/man/as_graphnel.Rd
+++ b/man/as_graphnel.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_graphnel}
\alias{as_graphnel}
@@ -19,7 +19,7 @@ way to represent graphs. These functions are provided to convert between
the igraph and the graphNEL objects.
}
\details{
-\code{as_graphnel} converts and igraph graph to a graphNEL graph. It
+\code{as_graphnel} converts an igraph graph to a graphNEL graph. It
converts all graph/vertex/edge attributes. If the igraph graph has a
vertex attribute \sQuote{\code{name}}, then it will be used to assign
vertex names in the graphNEL graph. Otherwise numeric igraph vertex ids
@@ -41,7 +41,7 @@ GNEL2 <- as_graphnel(g3)
g4 <- graph_from_graphnel(GNEL2)
g4
}
-#'
+#' @export
}
\seealso{
\code{\link{graph_from_graphnel}} for the other direction,
@@ -49,4 +49,3 @@ g4
\code{\link{as_adj_list}} and \code{\link{graph.adjlist}} for
other graph representations.
}
-
diff --git a/man/as_ids.Rd b/man/as_ids.Rd
index e8638ff..8d38ef8 100644
--- a/man/as_ids.Rd
+++ b/man/as_ids.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{as_ids}
\alias{as_ids}
-\alias{as_ids.igraph.es}
\alias{as_ids.igraph.vs}
+\alias{as_ids.igraph.es}
\title{Convert a vertex or edge sequence to an ordinary vector}
\usage{
as_ids(seq)
@@ -41,4 +41,3 @@ V(g)$name <- letters[1:10]
as_ids(V(g))
as_ids(E(g))
}
-
diff --git a/man/as_incidence_matrix.Rd b/man/as_incidence_matrix.Rd
index 945a58f..ac65ce2 100644
--- a/man/as_incidence_matrix.Rd
+++ b/man/as_incidence_matrix.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_incidence_matrix}
\alias{as_incidence_matrix}
@@ -45,14 +45,15 @@ boolean and \code{FALSE} for the vertices of the first kind and \code{TRUE}
for vertices of the second kind.
}
\examples{
+
g <- make_bipartite_graph( c(0,1,0,1,0,0), c(1,2,2,3,3,4) )
as_incidence_matrix(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{graph_from_incidence_matrix}} for the opposite operation.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/as_long_data_frame.Rd b/man/as_long_data_frame.Rd
index 0dd40ed..6208832 100644
--- a/man/as_long_data_frame.Rd
+++ b/man/as_long_data_frame.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{as_long_data_frame}
\alias{as_long_data_frame}
@@ -29,4 +29,3 @@ g <- make_(ring(10),
)
as_long_data_frame(g)
}
-
diff --git a/man/as_membership.Rd b/man/as_membership.Rd
index b8a8f9a..09922ec 100644
--- a/man/as_membership.Rd
+++ b/man/as_membership.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{as_membership}
\alias{as_membership}
@@ -26,4 +26,3 @@ fc <- cluster_fast_greedy(g)
compare(correct, fc)
compare(correct, membership(fc))
}
-
diff --git a/man/assortativity.Rd b/man/assortativity.Rd
index d46d68c..3676374 100644
--- a/man/assortativity.Rd
+++ b/man/assortativity.Rd
@@ -1,11 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/assortativity.R
\name{assortativity}
\alias{assortativity}
\alias{assortativity.degree}
-\alias{assortativity.nominal}
\alias{assortativity_degree}
+\alias{assortativity.nominal}
+\alias{assortativity_nominal}
\alias{assortativity_nominal}
+\alias{assortativity_degree}
\title{Assortativity coefficient}
\usage{
assortativity(graph, types1, types2 = NULL, directed = TRUE)
@@ -84,15 +86,13 @@ outgoing and the incoming end of the edges.
and calls \code{assortativity}.
}
\examples{
+
# random network, close to zero
assortativity_degree(sample_gnp(10000, 3/10000))
# BA model, tends to be dissortative
assortativity_degree(sample_pa(10000, m=4))
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
M. E. J. Newman: Mixing patterns in networks, \emph{Phys. Rev.
E} 67, 026126 (2003) \url{http://arxiv.org/abs/cond-mat/0209450}
@@ -100,5 +100,7 @@ E} 67, 026126 (2003) \url{http://arxiv.org/abs/cond-mat/0209450}
M. E. J. Newman: Assortative mixing in networks, \emph{Phys. Rev. Lett.} 89,
208701 (2002) \url{http://arxiv.org/abs/cond-mat/0205405/}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/authority_score.Rd b/man/authority_score.Rd
index 459436f..f0efaf4 100644
--- a/man/authority_score.Rd
+++ b/man/authority_score.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{authority_score}
-\alias{authority.score}
\alias{authority_score}
+\alias{authority.score}
\title{Kleinberg's authority centrality scores.}
\usage{
authority_score(graph, scale = TRUE, weights = NULL,
@@ -17,7 +17,10 @@ in the Euclidean norm.}
\item{weights}{Optional positive weight vector for calculating weighted
scores. If the graph has a \code{weight} edge attribute, then this is used
-by default.}
+by default.
+This function interprets edge weights as connection strengths. In the
+random surfer model, an edge with a larger weight is more likely to be
+selected by the surfer.}
\item{options}{A named list, to override some ARPACK options. See
\code{\link{arpack}} for details.}
@@ -28,7 +31,7 @@ A named list with members:
\item{value}{The corresponding eigenvalue of the calculated
principal eigenvector.}
\item{options}{Some information about the ARPACK computation, it has
- the same members as the \code{options} member returned
+ the same members as the \code{options} member returned
by \code{\link{arpack}}, see that for documentation.}
}
\description{
@@ -64,4 +67,3 @@ eigenvector centrality, \code{\link{page_rank}} for the Page Rank
scores. \code{\link{arpack}} for the underlining machinery of the
computation.
}
-
diff --git a/man/automorphisms.Rd b/man/automorphisms.Rd
index fd56b70..957c862 100644
--- a/man/automorphisms.Rd
+++ b/man/automorphisms.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{automorphisms}
\alias{automorphisms}
@@ -40,16 +40,12 @@ BLISS algorithm. See also the BLISS homepage at
\url{http://www.tcs.hut.fi/Software/bliss/index.html}.
}
\examples{
+
## A ring has n*2 automorphisms, you can "turn" it by 0-9 vertices
## and each of these graphs can be "flipped"
g <- make_ring(10)
automorphisms(g)
}
-\author{
-Tommi Junttila (\url{http://users.ics.aalto.fi/tjunttil/}) for BLISS
-and Gabor Csardi \email{csardi.gabor at gmail.com} for the igraph glue code
-and this manual page.
-}
\references{
Tommi Junttila and Petteri Kaski: Engineering an Efficient
Canonical Labeling Tool for Large and Sparse Graphs, \emph{Proceedings of
@@ -59,5 +55,9 @@ Workshop on Analytic Algorithms and Combinatorics.} 2007.
\seealso{
\code{\link{canonical_permutation}}, \code{\link{permute}}
}
+\author{
+Tommi Junttila (\url{http://users.ics.aalto.fi/tjunttil/}) for BLISS
+and Gabor Csardi \email{csardi.gabor at gmail.com} for the igraph glue code
+and this manual page.
+}
\keyword{graphs}
-
diff --git a/man/betweenness.Rd b/man/betweenness.Rd
index 31d15b5..3c51be6 100644
--- a/man/betweenness.Rd
+++ b/man/betweenness.Rd
@@ -1,13 +1,15 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{estimate_betweenness}
+\alias{estimate_betweenness}
\alias{betweenness}
-\alias{betweenness.estimate}
\alias{edge.betweenness}
+\alias{betweenness.estimate}
\alias{edge.betweenness.estimate}
\alias{edge_betweenness}
\alias{estimate_betweenness}
\alias{estimate_edge_betweenness}
+\alias{edge_betweenness}
\title{Vertex and edge betweenness centrality}
\usage{
estimate_betweenness(graph, vids = V(graph), directed = TRUE, cutoff,
@@ -32,7 +34,8 @@ betweenness. If zero or negative then there is no such limit.}
\item{weights}{Optional positive weight vector for calculating weighted
betweenness. If the graph has a \code{weight} edge attribute, then this is
-used by default.}
+used by default. Weights are used to calculate weighted shortest paths,
+so they are interpreted as distances.}
\item{nobigint}{Logical scalar, whether to use big integers during the
calculation. This is only required for lattice-like graphs that have very
@@ -92,12 +95,11 @@ Brandes (see References) is used.
multiple edges.
}
\examples{
+
g <- sample_gnp(10, 3/10)
betweenness(g)
edge_betweenness(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Freeman, L.C. (1979). Centrality in Social Networks I:
@@ -109,5 +111,7 @@ of Mathematical Sociology} 25(2):163-177, 2001.
\seealso{
\code{\link{closeness}}, \code{\link{degree}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/bfs.Rd b/man/bfs.Rd
index 4527f5d..1209342 100644
--- a/man/bfs.Rd
+++ b/man/bfs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{bfs}
\alias{bfs}
@@ -86,6 +86,7 @@ tree.} \item{extra}{The extra argument.} } See examples below on how to use
the callback function.
}
\examples{
+
## Two rings
bfs(make_ring(10) \%du\% make_ring(10), root=1, "out",
order=TRUE, rank=TRUE, father=TRUE, pred=TRUE,
@@ -105,12 +106,13 @@ f <- function(graph, data, extra) {
data['succ'] == -1
}
bfs(make_ring(10) \%du\% make_ring(10), root=1, callback=f)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
+
}
\seealso{
\code{\link{dfs}} for depth-first search.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/biconnected_components.Rd b/man/biconnected_components.Rd
index f42d289..baa2d83 100644
--- a/man/biconnected_components.Rd
+++ b/man/biconnected_components.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/components.R
\name{biconnected_components}
-\alias{biconnected.components}
\alias{biconnected_components}
+\alias{biconnected.components}
\title{Biconnected components}
\usage{
biconnected_components(graph)
@@ -36,17 +36,17 @@ that this is not true for vertices: the same vertex can be part of many
biconnected components.
}
\examples{
+
g <- disjoint_union( make_full_graph(5), make_full_graph(5) )
clu <- components(g)$membership
g <- add_edges(g, c(which(clu==1), which(clu==2)))
bc <- biconnected_components(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{articulation_points}}, \code{\link{components}},
\code{\link{is_connected}}, \code{\link{vertex_connectivity}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/bipartite_mapping.Rd b/man/bipartite_mapping.Rd
index a8b4aac..a30e310 100644
--- a/man/bipartite_mapping.Rd
+++ b/man/bipartite_mapping.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bipartite.R
\name{bipartite_mapping}
-\alias{bipartite.mapping}
\alias{bipartite_mapping}
+\alias{bipartite.mapping}
\title{Decide whether a graph is bipartite}
\usage{
bipartite_mapping(graph)
@@ -37,6 +37,7 @@ least two components, then the vertices in the separate components can be
mapped independently.
}
\examples{
+
## A ring has just one loop, so it is fine
g <- make_ring(10)
bipartite_mapping(g)
@@ -54,4 +55,3 @@ bipartite_mapping(g3)
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/bipartite_projection.Rd b/man/bipartite_projection.Rd
index dae7daf..086e525 100644
--- a/man/bipartite_projection.Rd
+++ b/man/bipartite_projection.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bipartite.R
\name{bipartite_projection}
+\alias{bipartite_projection}
\alias{bipartite.projection}
\alias{bipartite.projection.size}
-\alias{bipartite_projection}
\alias{bipartite_projection_size}
\title{Project a bipartite graph}
\usage{
@@ -19,7 +19,8 @@ ignored during the computation.}
graph has no \sQuote{\code{type}} vertex attribute.}
\item{multiplicity}{If \code{TRUE}, then igraph keeps the multiplicity of
-the edges as an edge attribute. E.g. if there is an A-C-B and also an A-D-B
+the edges as an edge attribute called \sQuote{weight}.
+E.g. if there is an A-C-B and also an A-D-B
triple in the bipartite graph (but no more X, such that A-X-B is also in the
graph), then the multiplicity of the A-B edge in the projection will be 2.}
@@ -62,6 +63,7 @@ the second.
\code{bipartite_projection} keeps vertex attributes.
}
\examples{
+
## Projection of a full bipartite graph is a full graph
g <- make_full_bipartite_graph(10,5)
proj <- bipartite_projection(g)
@@ -79,9 +81,9 @@ g2$name <- "Event network"
proj2 <- bipartite_projection(g2)
print(proj2[[1]], g=TRUE, e=TRUE)
print(proj2[[2]], g=TRUE, e=TRUE)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/c.igraph.es.Rd b/man/c.igraph.es.Rd
index 80501af..e1239d6 100644
--- a/man/c.igraph.es.Rd
+++ b/man/c.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{c.igraph.es}
\alias{c.igraph.es}
@@ -24,24 +24,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
c(E(g)[1], E(g)['A|B'], E(g)[1:4])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/c.igraph.vs.Rd b/man/c.igraph.vs.Rd
index a51647b..aef965c 100644
--- a/man/c.igraph.vs.Rd
+++ b/man/c.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{c.igraph.vs}
\alias{c.igraph.vs}
@@ -24,24 +24,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
c(V(g)[1], V(g)['A'], V(g)[1:4])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/canonical_permutation.Rd b/man/canonical_permutation.Rd
index 78d8e0f..63a7505 100644
--- a/man/canonical_permutation.Rd
+++ b/man/canonical_permutation.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{canonical_permutation}
-\alias{canonical.permutation}
\alias{canonical_permutation}
+\alias{canonical.permutation}
\title{Canonical permutation of a graph}
\usage{
canonical_permutation(graph, sh = "fm")
@@ -50,6 +50,7 @@ connected non-singleton cell.} } See the paper in references for details
about these.
}
\examples{
+
## Calculate the canonical form of a random graph
g1 <- sample_gnm(10, 20)
cp1 <- canonical_permutation(g1)
@@ -67,10 +68,6 @@ el1 <- el1[ order(el1[,1], el1[,2]), ]
el2 <- el2[ order(el2[,1], el2[,2]), ]
all(el1 == el2)
}
-\author{
-Tommi Junttila for BLISS, Gabor Csardi
-\email{csardi.gabor at gmail.com} for the igraph and R interfaces.
-}
\references{
Tommi Junttila and Petteri Kaski: Engineering an Efficient
Canonical Labeling Tool for Large and Sparse Graphs, \emph{Proceedings of
@@ -82,5 +79,8 @@ Workshop on Analytic Algorithms and Combinatorics.} 2007.
\code{\link{graph.isomorphic}} for deciding graph isomorphism, possibly
based on canonical labels.
}
+\author{
+Tommi Junttila for BLISS, Gabor Csardi
+\email{csardi.gabor at gmail.com} for the igraph and R interfaces.
+}
\keyword{graphs}
-
diff --git a/man/categorical_pal.Rd b/man/categorical_pal.Rd
index 1803d49..edc1a6d 100644
--- a/man/categorical_pal.Rd
+++ b/man/categorical_pal.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/palette.R
\name{categorical_pal}
\alias{categorical_pal}
@@ -37,7 +37,6 @@ plot(karate)
}
}
\seealso{
-Other palettes: \code{\link{diverging_pal}};
- \code{\link{r_pal}}; \code{\link{sequential_pal}}
+Other palettes: \code{\link{diverging_pal}},
+ \code{\link{r_pal}}, \code{\link{sequential_pal}}
}
-
diff --git a/man/centr_betw.Rd b/man/centr_betw.Rd
index 324f467..1d7d788 100644
--- a/man/centr_betw.Rd
+++ b/man/centr_betw.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_betw}
\alias{centr_betw}
@@ -42,20 +42,9 @@ centr_eigen(g, directed = FALSE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
+ \code{\link{centr_clo_tmax}}, \code{\link{centr_clo}},
\code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
\code{\link{centr_degree}},
- \code{\link{centralization.degree}};
\code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_betw_tmax.Rd b/man/centr_betw_tmax.Rd
index dd1f044..32b6d38 100644
--- a/man/centr_betw_tmax.Rd
+++ b/man/centr_betw_tmax.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_betw_tmax}
\alias{centr_betw_tmax}
@@ -34,20 +34,9 @@ centr_betw(g, normalized = TRUE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
+ \code{\link{centr_clo_tmax}}, \code{\link{centr_clo}},
\code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
\code{\link{centr_degree}},
- \code{\link{centralization.degree}};
\code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_clo.Rd b/man/centr_clo.Rd
index d526cc3..316ed67 100644
--- a/man/centr_clo.Rd
+++ b/man/centr_clo.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_clo}
\alias{centr_clo}
@@ -10,7 +10,7 @@ centr_clo(graph, mode = c("out", "in", "all", "total"), normalized = TRUE)
\arguments{
\item{graph}{The input graph.}
-\item{mode}{This is the same as the \code{mode} argument of
+\item{mode}{This is the same as the \code{mode} argument of
\code{closeness}.}
\item{normalized}{Logical scalar. Whether to normalize the graph level
@@ -38,20 +38,9 @@ centr_eigen(g, directed = FALSE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
+ \code{\link{centr_betw}}, \code{\link{centr_clo_tmax}},
\code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
\code{\link{centr_degree}},
- \code{\link{centralization.degree}};
\code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_clo_tmax.Rd b/man/centr_clo_tmax.Rd
index eec1a53..663b125 100644
--- a/man/centr_clo_tmax.Rd
+++ b/man/centr_clo_tmax.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_clo_tmax}
\alias{centr_clo_tmax}
@@ -15,7 +15,7 @@ centr_clo_tmax(graph = NULL, nodes = 0, mode = c("out", "in", "all",
\item{nodes}{The number of vertices. This is ignored if the graph is
given.}
-\item{mode}{This is the same as the \code{mode} argument of
+\item{mode}{This is the same as the \code{mode} argument of
\code{closeness}.}
}
\value{
@@ -35,20 +35,9 @@ centr_clo(g, normalized = TRUE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
+ \code{\link{centr_betw}}, \code{\link{centr_clo}},
\code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
\code{\link{centr_degree}},
- \code{\link{centralization.degree}};
\code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_degree.Rd b/man/centr_degree.Rd
index 1b59b18..0d84a5e 100644
--- a/man/centr_degree.Rd
+++ b/man/centr_degree.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_degree}
\alias{centr_degree}
@@ -42,20 +42,8 @@ centr_eigen(g, directed = FALSE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
- \code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
+ \code{\link{centr_betw}}, \code{\link{centr_clo_tmax}},
+ \code{\link{centr_clo}}, \code{\link{centr_degree_tmax}},
\code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_degree_tmax.Rd b/man/centr_degree_tmax.Rd
index 6cefd05..0a6945b 100644
--- a/man/centr_degree_tmax.Rd
+++ b/man/centr_degree_tmax.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_degree_tmax}
\alias{centr_degree_tmax}
@@ -36,20 +36,8 @@ centr_degree(g, normalized = TRUE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
- \code{\link{centr_degree}},
- \code{\link{centralization.degree}};
+ \code{\link{centr_betw}}, \code{\link{centr_clo_tmax}},
+ \code{\link{centr_clo}}, \code{\link{centr_degree}},
\code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_eigen.Rd b/man/centr_eigen.Rd
index af47de4..79d8660 100644
--- a/man/centr_eigen.Rd
+++ b/man/centr_eigen.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_eigen}
\alias{centr_eigen}
@@ -28,7 +28,7 @@ A named list with the following components:
\item{vector}{The node-level centrality scores.}
\item{value}{The corresponding eigenvalue.}
\item{options}{ARPACK options, see the return value of
- \code{\link{eigen_centrality}} for details.}
+ \code{\link{eigen_centrality}} for details.}
\item{centralization}{The graph level centrality index.}
\item{theoretical_max}{The same as above, the theoretical maximum
centralization score for a graph with the same number of vertices.}
@@ -52,20 +52,8 @@ centr_eigen(g1)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
- \code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
+ \code{\link{centr_betw}}, \code{\link{centr_clo_tmax}},
+ \code{\link{centr_clo}}, \code{\link{centr_degree_tmax}},
\code{\link{centr_degree}},
- \code{\link{centralization.degree}};
- \code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_eigen_tmax}}, \code{\link{centralize}}
}
-
diff --git a/man/centr_eigen_tmax.Rd b/man/centr_eigen_tmax.Rd
index e654c7c..775a064 100644
--- a/man/centr_eigen_tmax.Rd
+++ b/man/centr_eigen_tmax.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centr_eigen_tmax}
\alias{centr_eigen_tmax}
@@ -38,20 +38,8 @@ centr_eigen(g, normalized = TRUE)$centralization
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
- \code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
- \code{\link{centr_degree}},
- \code{\link{centralization.degree}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}};
- \code{\link{centralization}}, \code{\link{centralize}},
- \code{\link{centralize.scores}}
+ \code{\link{centr_betw}}, \code{\link{centr_clo_tmax}},
+ \code{\link{centr_clo}}, \code{\link{centr_degree_tmax}},
+ \code{\link{centr_degree}}, \code{\link{centr_eigen}},
+ \code{\link{centralize}}
}
-
diff --git a/man/centralize.Rd b/man/centralize.Rd
index 6cb6138..d796b0c 100644
--- a/man/centralize.Rd
+++ b/man/centralize.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centralization.R
\name{centralize}
-\alias{centralization}
\alias{centralize}
+\alias{centralization}
\alias{centralize.scores}
\title{Centralization of a graph}
\usage{
@@ -70,20 +70,8 @@ Methods and Applications.} Cambridge University Press.
}
\seealso{
Other centralization related: \code{\link{centr_betw_tmax}},
- \code{\link{centralization.betweenness.tmax}};
- \code{\link{centr_betw}},
- \code{\link{centralization.betweenness}};
- \code{\link{centr_clo_tmax}},
- \code{\link{centralization.closeness.tmax}};
- \code{\link{centr_clo}},
- \code{\link{centralization.closeness}};
- \code{\link{centr_degree_tmax}},
- \code{\link{centralization.degree.tmax}};
+ \code{\link{centr_betw}}, \code{\link{centr_clo_tmax}},
+ \code{\link{centr_clo}}, \code{\link{centr_degree_tmax}},
\code{\link{centr_degree}},
- \code{\link{centralization.degree}};
- \code{\link{centr_eigen_tmax}},
- \code{\link{centralization.evcent.tmax}};
- \code{\link{centr_eigen}},
- \code{\link{centralization.evcent}}
+ \code{\link{centr_eigen_tmax}}, \code{\link{centr_eigen}}
}
-
diff --git a/man/cliques.Rd b/man/cliques.Rd
index 3025a17..f064e1a 100644
--- a/man/cliques.Rd
+++ b/man/cliques.Rd
@@ -1,15 +1,16 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cliques.R
\name{cliques}
-\alias{clique.number}
-\alias{clique_num}
\alias{cliques}
-\alias{count_max_cliques}
-\alias{largest.cliques}
\alias{largest_cliques}
-\alias{max_cliques}
\alias{maximal.cliques}
\alias{maximal.cliques.count}
+\alias{clique.number}
+\alias{clique_num}
+\alias{largest.cliques}
+\alias{count_max_cliques}
+\alias{max_cliques}
+\alias{max_cliques}
\title{The functions find cliques, ie. complete subgraphs in a graph}
\usage{
cliques(graph, min = NULL, max = NULL)
@@ -75,6 +76,7 @@ independent vertex sets (see \code{\link{ivs}}) in the
complementer graph.
}
\examples{
+
# this usually contains cliques of size six
g <- sample_gnp(100, 0.3)
clique_num(g)
@@ -84,10 +86,8 @@ largest_cliques(g)
# To have a bit less maximal cliques, about 100-200 usually
g <- sample_gnp(100, 0.03)
max_cliques(g)
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com}
+
+
}
\references{
For maximal cliques the following algorithm is implemented:
@@ -97,5 +97,8 @@ in Sparse Graphs in Near-optimal Time. \url{http://arxiv.org/abs/1006.5440}
\seealso{
\code{\link{ivs}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/closeness.Rd b/man/closeness.Rd
index 88847da..6cc72ab 100644
--- a/man/closeness.Rd
+++ b/man/closeness.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{closeness}
\alias{closeness}
\alias{closeness.estimate}
\alias{estimate_closeness}
+\alias{estimate_closeness}
\title{Closeness centrality of vertices}
\usage{
closeness(graph, vids = V(graph), mode = c("out", "in", "all", "total"),
@@ -25,7 +26,8 @@ graphs.}
\item{weights}{Optional positive weight vector for calculating weighted
closeness. If the graph has a \code{weight} edge attribute, then this is
-used by default.}
+used by default. Weights are used for calculating weighted shortest
+paths, so they are interpreted as distances.}
\item{normalized}{Logical scalar, whether to calculate the normalized
closeness. Normalization is performed by multiplying the raw closeness by
@@ -59,15 +61,14 @@ quadratic (if \code{cutoff} is small). If \code{cutoff} is zero or negative
then the function calculates the exact closeness scores.
}
\examples{
+
g <- make_ring(10)
g2 <- make_star(10)
closeness(g)
closeness(g2, mode="in")
closeness(g2, mode="out")
closeness(g2, mode="all")
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Freeman, L.C. (1979). Centrality in Social Networks I:
@@ -76,5 +77,7 @@ Conceptual Clarification. \emph{Social Networks}, 1, 215-239.
\seealso{
\code{\link{betweenness}}, \code{\link{degree}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/cluster_edge_betweenness.Rd b/man/cluster_edge_betweenness.Rd
index a5b99ef..eed3daf 100644
--- a/man/cluster_edge_betweenness.Rd
+++ b/man/cluster_edge_betweenness.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_edge_betweenness}
\alias{cluster_edge_betweenness}
@@ -13,7 +13,9 @@ cluster_edge_betweenness(graph, weights = E(graph)$weight, directed = TRUE,
\item{graph}{The graph to analyze.}
\item{weights}{The edge weights. Supply \code{NULL} to omit edge weights. By
-default the \sQuote{\code{weight}} edge attribute is used, if it is present.}
+default the \sQuote{\code{weight}} edge attribute is used, if it is present.
+Edge weights are used to calculate weighted edge betweenness. This means
+that edges are interpreted as distances, not as connection strengths.}
\item{directed}{Logical constant, whether to calculate directed edge
betweenness for directed graphs. It is ignored for undirected graphs.}
@@ -73,16 +75,15 @@ again removing the one with the highest score, etc.
throught the run of the algorithm. See the return value down here.
}
\examples{
-g <- barabasi.game(100,m=2)
+
+g <- sample_pa(100, m = 2, directed = FALSE)
eb <- cluster_edge_betweenness(g)
g <- make_full_graph(10) \%du\% make_full_graph(10)
g <- add_edges(g, c(1,11))
eb <- cluster_edge_betweenness(g)
eb
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
M Newman and M Girvan: Finding and evaluating community
@@ -98,5 +99,7 @@ methods.
See \code{\link{communities}} for extracting the results of the community
detection.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/cluster_fast_greedy.Rd b/man/cluster_fast_greedy.Rd
index ab9d220..c160179 100644
--- a/man/cluster_fast_greedy.Rd
+++ b/man/cluster_fast_greedy.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_fast_greedy}
\alias{cluster_fast_greedy}
@@ -23,7 +23,8 @@ community structures along the merges.}
\item{weights}{If not \code{NULL}, then a numeric vector of edge weights.
The length must match the number of edges in the graph. By default the
\sQuote{\code{weight}} edge attribute is used as weights. If it is not
-present, then all edges are considered to have the same weight.}
+present, then all edges are considered to have the same weight.
+Larger edge weights correspond to stronger connections.}
}
\value{
\code{cluster_fast_greedy} returns a \code{\link{communities}}
@@ -40,15 +41,13 @@ community structure in very large networks,
http://www.arxiv.org/abs/cond-mat/0408187 for the details.
}
\examples{
+
g <- make_full_graph(5) \%du\% make_full_graph(5) \%du\% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
fc <- cluster_fast_greedy(g)
membership(fc)
sizes(fc)
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com} for the R interface.
+
}
\references{
A Clauset, MEJ Newman, C Moore: Finding community structure in
@@ -62,5 +61,8 @@ See also \code{\link{cluster_walktrap}},
\code{\link{cluster_leading_eigen}} and
\code{\link{cluster_edge_betweenness}} for other methods.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com} for the R interface.
+}
\keyword{graphs}
-
diff --git a/man/cluster_infomap.Rd b/man/cluster_infomap.Rd
index 7af70d3..cac020f 100644
--- a/man/cluster_infomap.Rd
+++ b/man/cluster_infomap.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_infomap}
\alias{cluster_infomap}
@@ -14,12 +14,15 @@ cluster_infomap(graph, e.weights = NULL, v.weights = NULL, nb.trials = 10,
\item{e.weights}{If not \code{NULL}, then a numeric vector of edge weights.
The length must match the number of edges in the graph. By default the
\sQuote{\code{weight}} edge attribute is used as weights. If it is not
-present, then all edges are considered to have the same weight.}
+present, then all edges are considered to have the same weight.
+Larger edge weights correspond to stronger connections.}
\item{v.weights}{If not \code{NULL}, then a numeric vector of vertex
weights. The length must match the number of vertices in the graph. By
default the \sQuote{\code{weight}} vertex attribute is used as weights. If
-it is not present, then all vertices are considered to have the same weight.}
+it is not present, then all vertices are considered to have the same weight.
+A larger vertex weight means a larger probability that the random surfer
+jumps to that vertex.}
\item{nb.trials}{The number of attempts to partition the network (can be any
integer value equal or larger than 1).}
@@ -39,18 +42,14 @@ random walker trajectory
Please see the details of this method in the references given below.
}
\examples{
+
## Zachary's karate club
g <- make_graph("Zachary")
imc <- cluster_infomap(g)
membership(imc)
communities(imc)
-}
-\author{
-Martin Rosvall (\url{http://www.tp.umu.se/~rosvall/}) wrote the
-original C++ code. This was ported to be more igraph-like by Emmanuel
-Navarro (\url{http://enavarro.me/}). The R interface and
-some cosmetics was done by Gabor Csardi \email{csardi.gabor at gmail.com}.
+
}
\references{
The original paper: M. Rosvall and C. T. Bergstrom, Maps of
@@ -66,5 +65,10 @@ equation, \emph{Eur. Phys. J. Special Topics} 178, 13 (2009).
\seealso{
Other community finding methods and \code{\link{communities}}.
}
+\author{
+Martin Rosvall (\url{http://www.tp.umu.se/~rosvall/}) wrote the
+original C++ code. This was ported to be more igraph-like by Emmanuel
+Navarro (\url{http://enavarro.me/}). The R interface and
+some cosmetics was done by Gabor Csardi \email{csardi.gabor at gmail.com}.
+}
\keyword{graphs}
-
diff --git a/man/cluster_label_prop.Rd b/man/cluster_label_prop.Rd
index 4f3b113..ed04bd0 100644
--- a/man/cluster_label_prop.Rd
+++ b/man/cluster_label_prop.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_label_prop}
\alias{cluster_label_prop}
@@ -13,7 +13,8 @@ cluster_label_prop(graph, weights = NULL, initial = NULL, fixed = NULL)
\item{weights}{An optional weight vector. It should contain a positive
weight for all the edges. The \sQuote{weight} edge attribute is used if
present. Supply \sQuote{\code{NA}} here if you want to ignore the
-\sQuote{weight} edge attribute.}
+\sQuote{weight} edge attribute. Larger edge weights correspond to
+stronger connections.}
\item{initial}{The initial state. If \code{NULL}, every vertex will have a
different label at the beginning. Otherwise it must be a vector with an
@@ -49,13 +50,11 @@ connected groups of nodes form a consensus on a unique label to form
communities.}
}
\examples{
-g <- sample_gnp(10, 5/10) \%du\% sample_gnp(9, 5/9)
+
+ g <- sample_gnp(10, 5/10) \%du\% sample_gnp(9, 5/9)
g <- add_edges(g, c(1, 12))
cluster_label_prop(g)
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} for the C implementation,
-Gabor Csardi \email{csardi.gabor at gmail.com} for this manual page.
+
}
\references{
Raghavan, U.N. and Albert, R. and Kumara, S.: Near linear time
@@ -68,5 +67,8 @@ Rev E} 76, 036106. (2007)
\code{\link{cluster_fast_greedy}}, \code{\link{cluster_walktrap}} and
\code{\link{cluster_spinglass}} for other community detection methods.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} for the C implementation,
+Gabor Csardi \email{csardi.gabor at gmail.com} for this manual page.
+}
\keyword{graphs}
-
diff --git a/man/cluster_leading_eigen.Rd b/man/cluster_leading_eigen.Rd
index de33e47..2d9ddad 100644
--- a/man/cluster_leading_eigen.Rd
+++ b/man/cluster_leading_eigen.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_leading_eigen}
\alias{cluster_leading_eigen}
@@ -15,12 +15,12 @@ cluster_leading_eigen(graph, steps = -1, weights = NULL, start = NULL,
symmetric matrix.}
\item{steps}{The number of steps to take, this is actually the number of
-tries to make a step. It is not a particularly useful parameter.
-#'}
+tries to make a step. It is not a particularly useful parameter.}
\item{weights}{An optional weight vector. The \sQuote{weight} edge attribute
is used if present. Supply \sQuote{\code{NA}} here if you want to ignore the
-\sQuote{weight} edge attribute.}
+\sQuote{weight} edge attribute. Larger edge weights correspond to stronger
+connections between vertices.}
\item{start}{\code{NULL}, or a numeric membership vector, giving the start
configuration of the algorithm.}
@@ -92,16 +92,16 @@ following arguments are supplied to this function: \describe{
is non-zero, then the clustering is terminated.
}
}
+
\examples{
+
g <- make_full_graph(5) \%du\% make_full_graph(5) \%du\% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
lec <- cluster_leading_eigen(g)
lec
cluster_leading_eigen(g, start=membership(lec))
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
MEJ Newman: Finding community structure using the eigenvectors
@@ -112,5 +112,7 @@ of matrices, Physical Review E 74 036104, 2006.
\code{\link{cluster_edge_betweenness}},
\code{\link{cluster_fast_greedy}}, \code{\link[stats]{as.dendrogram}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/cluster_louvain.Rd b/man/cluster_louvain.Rd
index 86f2acf..1d084b6 100644
--- a/man/cluster_louvain.Rd
+++ b/man/cluster_louvain.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_louvain}
\alias{cluster_louvain}
@@ -13,7 +13,7 @@ cluster_louvain(graph, weights = NULL)
\item{weights}{Optional positive weight vector. If the graph has a
\code{weight} edge attribute, then this is used by default. Supply \code{NA}
here if the graph has a \code{weight} edge attribute, but you want to ignore
-it.}
+it. Larger edge weights correspond to stronger connections.}
}
\value{
\code{cluster_louvain} returns a \code{\link{communities}}
@@ -42,13 +42,12 @@ when the modularity cannot be increased any more in a step.
This function was contributed by Tom Gregorovic.
}
\examples{
+
# This is so simple that we will have only one level
g <- make_full_graph(5) \%du\% make_full_graph(5) \%du\% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
cluster_louvain(g)
-}
-\author{
-Tom Gregorovic, Tamas Nepusz \email{ntamas at gmail.com}
+
}
\references{
Vincent D. Blondel, Jean-Loup Guillaume, Renaud Lambiotte,
@@ -66,5 +65,7 @@ Other community detection algorithms: \code{\link{cluster_walktrap}},
\code{\link{cluster_fast_greedy}},
\code{\link{cluster_label_prop}}
}
+\author{
+Tom Gregorovic, Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/cluster_optimal.Rd b/man/cluster_optimal.Rd
index 5620ebd..e113193 100644
--- a/man/cluster_optimal.Rd
+++ b/man/cluster_optimal.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_optimal}
\alias{cluster_optimal}
@@ -13,7 +13,8 @@ graphs.}
\item{weights}{Optional positive weight vector for optimizing weighted
modularity. If the graph has a \code{weight} edge attribute, then this is
-used by default. Supply \code{NA} to ignore the weights of a weighted graph.}
+used by default. Supply \code{NA} to ignore the weights of a weighted graph.
+Larger edge weights correspond to stronger connections.}
}
\value{
\code{cluster_optimal} returns a \code{\link{communities}} object,
@@ -38,10 +39,11 @@ fifty vertices should be fine, graphs with a couple of hundred vertices
might be possible.
}
\examples{
+
## Zachary's karate club
g <- make_graph("Zachary")
-## We put everything into a big 'try' block, in case
+## We put everything into a big 'try' block, in case
## igraph was compiled without GLPK support
try({
@@ -56,9 +58,7 @@ try({
fc <- cluster_fast_greedy(g)
print(modularity(fc))
}, silent=TRUE)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Ulrik Brandes, Daniel Delling, Marco Gaertler, Robert Gorke,
@@ -71,5 +71,7 @@ Martin Hoefer, Zoran Nikoloski, Dorothea Wagner: On Modularity Clustering,
\code{\link{modularity}}. See also \code{\link{cluster_fast_greedy}} for a
fast greedy optimizer.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/cluster_spinglass.Rd b/man/cluster_spinglass.Rd
index f7a2065..cda7f77 100644
--- a/man/cluster_spinglass.Rd
+++ b/man/cluster_spinglass.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_spinglass}
\alias{cluster_spinglass}
@@ -19,7 +19,8 @@ is neglected.}
attribute then that will be used. If \code{NULL} and no such attribute is
present then the edges will have equal weights. Set this to \code{NA} if the
graph was a \sQuote{weight} edge attribute, but you don't want to use it for
-community detection.}
+community detection. A larger edge weight means a stronger connection
+for this function.}
\item{vertex}{This parameter can be used to calculate the community of a
given vertex without calculating all communities. Note that if this argument
@@ -113,20 +114,13 @@ must be a vertex id, and the same energy function is used to find the
community of the the given vertex. See also the examples below.
}
\examples{
-g <- sample_gnp(10, 5/10) \%du\% sample_gnp(9, 5/9)
+
+ g <- sample_gnp(10, 5/10) \%du\% sample_gnp(9, 5/9)
g <- add_edges(g, c(1, 12))
g <- induced_subgraph(g, subcomponent(g, 1))
cluster_spinglass(g, spins=2)
cluster_spinglass(g, vertex=1)
-}
-\author{
-Jorg Reichardt
-(\url{http://theorie.physik.uni-wuerzburg.de/~reichardt/}) for the original
-code and Gabor Csardi \email{csardi.gabor at gmail.com} for the igraph glue
-code.
-Changes to the original function for including the possibility of negative
-ties were implemented by Vincent Traag (\url{http://www.traag.net/}).
}
\references{
J. Reichardt and S. Bornholdt: Statistical Mechanics of
@@ -142,5 +136,13 @@ positive and negative links, \url{http://arxiv.org/abs/0811.2329} (2008).
\seealso{
\code{\link{communities}}, \code{\link{components}}
}
-\keyword{graphs}
+\author{
+Jorg Reichardt
+(\url{http://theorie.physik.uni-wuerzburg.de/~reichardt/}) for the original
+code and Gabor Csardi \email{csardi.gabor at gmail.com} for the igraph glue
+code.
+Changes to the original function for including the possibility of negative
+ties were implemented by Vincent Traag (\url{http://www.traag.net/}).
+}
+\keyword{graphs}
diff --git a/man/cluster_walktrap.Rd b/man/cluster_walktrap.Rd
index c4baea8..de0365e 100644
--- a/man/cluster_walktrap.Rd
+++ b/man/cluster_walktrap.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{cluster_walktrap}
\alias{cluster_walktrap}
@@ -12,7 +12,9 @@ cluster_walktrap(graph, weights = E(graph)$weight, steps = 4,
\item{graph}{The input graph, edge directions are ignored in directed
graphs.}
-\item{weights}{The edge weights.}
+\item{weights}{The edge weights. Larger edge weights increase the
+probability that an edge is selected by the random walker. In other
+words, larger edge weights correspond to stronger connections.}
\item{steps}{The length of the random walks to perform.}
@@ -41,13 +43,11 @@ algorithm, see Pascal Pons, Matthieu Latapy: Computing communities in large
networks using random walks, http://arxiv.org/abs/physics/0512106
}
\examples{
+
g <- make_full_graph(5) \%du\% make_full_graph(5) \%du\% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
cluster_walktrap(g)
-}
-\author{
-Pascal Pons (\url{http://psl.pons.free.fr/}) and Gabor Csardi
-\email{csardi.gabor at gmail.com} for the R and igraph interface
+
}
\references{
Pascal Pons, Matthieu Latapy: Computing communities in large
@@ -63,5 +63,8 @@ vector, merge matrix, modularity score, etc.
\code{\link{cluster_edge_betweenness}} for other community detection
methods.
}
+\author{
+Pascal Pons (\url{http://psl.pons.free.fr/}) and Gabor Csardi
+\email{csardi.gabor at gmail.com} for the R and igraph interface
+}
\keyword{graphs}
-
diff --git a/man/cocitation.Rd b/man/cocitation.Rd
index 2e5cddc..31ebd2e 100644
--- a/man/cocitation.Rd
+++ b/man/cocitation.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cocitation.R
\name{cocitation}
-\alias{bibcoupling}
\alias{cocitation}
+\alias{bibcoupling}
\title{Cocitation coupling}
\usage{
cocitation(graph, v = V(graph))
@@ -37,12 +37,13 @@ costs the same amount of computation as for all vertices. This might change
in the future.
}
\examples{
+
g <- make_ring(10)
cocitation(g)
bibcoupling(g)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/cohesive_blocks.Rd b/man/cohesive_blocks.Rd
index 1145388..11e6812 100644
--- a/man/cohesive_blocks.Rd
+++ b/man/cohesive_blocks.Rd
@@ -1,25 +1,36 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cohesive.blocks.R
\name{cohesive_blocks}
-\alias{blockGraphs}
-\alias{blocks}
-\alias{cohesion.cohesiveBlocks}
+\alias{cohesive_blocks}
\alias{cohesive.blocks}
\alias{cohesiveBlocks}
-\alias{cohesive_blocks}
-\alias{exportPajek}
-\alias{export_pajek}
+\alias{blocks}
\alias{graphs_from_cohesive_blocks}
+\alias{blockGraphs}
\alias{hierarchy}
-\alias{length.cohesiveBlocks}
-\alias{max_cohesion}
-\alias{maxcohesion}
\alias{parent}
-\alias{plot.cohesiveBlocks}
\alias{plotHierarchy}
+\alias{export_pajek}
+\alias{maxcohesion}
+\alias{plot.cohesiveBlocks}
+\alias{summary.cohesiveBlocks}
+\alias{length.cohesiveBlocks}
+\alias{print.cohesiveBlocks}
\alias{plot_hierarchy}
+\alias{max_cohesion}
+\alias{exportPajek}
+\alias{length.cohesiveBlocks}
+\alias{blocks}
+\alias{graphs_from_cohesive_blocks}
+\alias{cohesion.cohesiveBlocks}
+\alias{hierarchy}
+\alias{parent}
\alias{print.cohesiveBlocks}
\alias{summary.cohesiveBlocks}
+\alias{plot.cohesiveBlocks}
+\alias{plot_hierarchy}
+\alias{export_pajek}
+\alias{max_cohesion}
\title{Calculate Cohesive Blocks}
\usage{
cohesive_blocks(graph, labels = TRUE)
@@ -63,9 +74,12 @@ argument.}
object. These labels can be then used when reporting and plotting the
cohesive blocks.}
-\item{blocks,x,object}{A \code{cohesiveBlocks} object, created with the
+\item{blocks, x, object}{A \code{cohesiveBlocks} object, created with the
\code{cohesive_blocks} function.}
+\item{\dots}{Additional arguments. \code{plot_hierarchy} and \code{plot} pass
+them to \code{plot.igraph}. \code{print} and \code{summary} ignore them.}
+
\item{y}{The graph whose cohesive blocks are supplied in the \code{x}
argument.}
@@ -103,9 +117,6 @@ See also details below.}
\item{project.file}{Logical scalar, whether to create a single Pajek project
file containing all the data, or to create separated files for each item.
See details below.}
-
-\item{\dots}{Additional arguments. \code{plot_hierarchy} and \code{plot} pass
-them to \code{plot.igraph}. \code{print} and \code{summary} ignore them.}
}
\value{
\code{cohesive_blocks} returns a \code{cohesiveBlocks} object.
@@ -223,6 +234,7 @@ The generic function \code{plot} plots the graph, showing one or more
cohesive blocks in it.
}
\examples{
+
## The graph from the Moody-White paper
mw <- graph_from_literal(1-2:3:4:5:6, 2-3:4:5:7, 3-4:6:7, 4-5:6:7,
5-6:7:21, 6-7, 7-8:11:14:19, 8-9:11:14, 9-10,
@@ -264,11 +276,7 @@ campBlocks
plot(campBlocks, camp, vertex.label=V(camp)$name, margin=-0.2,
vertex.shape="rectangle", vertex.size=24, vertex.size2=8,
mark.border=1, colbar=c(NA, NA,"cyan","orange") )
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com} for the current
-implementation, Peter McMahan (\url{http://home.uchicago.edu/~mcmahan/})
-wrote the first version in R.
+
}
\references{
J. Moody and D. R. White. Structural cohesion and embeddedness:
@@ -278,5 +286,9 @@ Review}, 68(1):103--127, Feb 2003.
\seealso{
\code{\link{cohesion}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com} for the current
+implementation, Peter McMahan (\url{http://home.uchicago.edu/~mcmahan/})
+wrote the first version in R.
+}
\keyword{graphs}
-
diff --git a/man/communities.Rd b/man/communities.Rd
index 7d865d5..9c9f4b6 100644
--- a/man/communities.Rd
+++ b/man/communities.Rd
@@ -1,30 +1,45 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{membership}
+\alias{membership}
+\alias{communities}
\alias{algorithm}
+\alias{crossing}
+\alias{cutat}
+\alias{merges}
+\alias{sizes}
+\alias{cut_at}
+\alias{is.hierarchical}
+\alias{print.communities}
+\alias{plot.communities}
+\alias{length.communities}
\alias{as.dendrogram.communities}
\alias{as.hclust.communities}
+\alias{code_len}
\alias{asPhylo}
\alias{asPhylo.communities}
+\alias{showtrace}
+\alias{code.length}
\alias{as_phylo}
\alias{as_phylo.communities}
-\alias{code.length}
-\alias{code_len}
-\alias{communities}
-\alias{crossing}
-\alias{cut_at}
-\alias{cutat}
-\alias{is.hierarchical}
+\alias{show_trace}
\alias{is_hierarchical}
+\alias{print.communities}
+\alias{modularity.communities}
\alias{length.communities}
-\alias{membership}
+\alias{sizes}
+\alias{algorithm}
\alias{merges}
-\alias{modularity.communities}
-\alias{plot.communities}
-\alias{print.communities}
+\alias{crossing}
+\alias{code_len}
+\alias{is_hierarchical}
+\alias{as.dendrogram.communities}
+\alias{as.hclust.communities}
+\alias{as_phylo}
+\alias{as_phylo.communities}
+\alias{cut_at}
\alias{show_trace}
-\alias{showtrace}
-\alias{sizes}
+\alias{plot.communities}
\title{Functions to deal with the result of network community detection}
\usage{
membership(communities)
@@ -65,9 +80,13 @@ show_trace(communities)
y) + 1], ...)
}
\arguments{
-\item{communities,x,object}{A \code{communities} object, the result of an
+\item{communities, x, object}{A \code{communities} object, the result of an
igraph community detection function.}
+\item{\dots}{Additional arguments. \code{plot.communities} passes these to
+\code{\link{plot.igraph}}. The other functions silently ignore
+them.}
+
\item{graph}{An igraph graph object, corresponding to \code{communities}.}
\item{hang}{Numeric scalar indicating how the height of leaves should be
@@ -98,10 +117,6 @@ groups.}
\item{edge.color}{The colors of the edges. By default the edges within
communities are colored green and other edges are red.}
-\item{\dots}{Additional arguments. \code{plot.communities} passes these to
-\code{\link{plot.igraph}}. The other functions silently ignore
-them.}
-
\item{membership}{Numeric vector, one value for each vertex, the membership
vector of the community structure. Might also be \code{NULL} if the
community structure is given in another way, e.g. by a merge matrix.}
@@ -151,7 +166,7 @@ InfoMAP method and \code{NULL} for other methods.
\code{plot} for \code{communities} objects returns \code{NULL}, invisibly.
-#'
+#' @author Gabor Csardi \email{csardi.gabor at gmail.com}
}
\description{
igraph community detection functions return their results as an object from
@@ -247,14 +262,13 @@ corresponding to the communities. It passes additional arguments to
\code{\link{igraph.plotting}} on how to change the plot.
}
\examples{
+
karate <- make_graph("Zachary")
wc <- cluster_walktrap(karate)
modularity(wc)
membership(wc)
plot(wc, karate)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
See \code{\link{plot_dendrogram}} for plotting community structure
@@ -272,4 +286,3 @@ The different methods for finding communities, they all return a
\code{\link{cluster_spinglass}}, \code{\link{cluster_walktrap}}.
}
\keyword{graphs}
-
diff --git a/man/compare.Rd b/man/compare.Rd
index ebd2b34..d097f2a 100644
--- a/man/compare.Rd
+++ b/man/compare.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{compare}
\alias{compare}
@@ -34,14 +34,13 @@ A real number.
This function assesses the distance between two community structures.
}
\examples{
+
g <- make_graph("Zachary")
sg <- cluster_spinglass(g)
le <- cluster_leading_eigen(g)
compare(sg, le, method="rand")
compare(membership(sg), membership(le))
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
+
}
\references{
Meila M: Comparing clusterings by the variation of information.
@@ -69,5 +68,7 @@ Classification} 2:193-218, 1985.
\code{\link{cluster_fast_greedy}}, \code{\link{cluster_spinglass}} for
various community detection methods.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/complementer.Rd b/man/complementer.Rd
index 9b26bcd..7725a54 100644
--- a/man/complementer.Rd
+++ b/man/complementer.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{complementer}
\alias{complementer}
@@ -28,6 +28,7 @@ new graph.
attributes are lost.
}
\examples{
+
## Complementer of a ring
g <- make_ring(10)
complementer(g)
@@ -38,9 +39,9 @@ gc <- complementer(g)
gu <- union(g, gc)
gu
graph.isomorphic(gu, make_full_graph(vcount(g)))
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/component_wise.Rd b/man/component_wise.Rd
index 0e3ea70..43c0096 100644
--- a/man/component_wise.Rd
+++ b/man/component_wise.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{component_wise}
\alias{component_wise}
@@ -8,7 +8,7 @@ component_wise(merge_method = "dla")
}
\arguments{
\item{merge_method}{Merging algorithm, the \code{method}
- argument of \code{\link{merge_coords}}.}
+argument of \code{\link{merge_coords}}.}
}
\description{
This is a layout modifier function, and it can be used
@@ -24,44 +24,25 @@ g \%>\%
\seealso{
\code{\link{merge_coords}}, \code{\link{layout_}}.
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{in_circle}}, \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other layout modifiers: \code{\link{normalize}}
+
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
-
-Other layout modifiers: \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
}
-
diff --git a/man/components.Rd b/man/components.Rd
index 6e45e5e..1db6814 100644
--- a/man/components.Rd
+++ b/man/components.Rd
@@ -1,14 +1,14 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/components.R, R/structural.properties.R
\name{component_distribution}
-\alias{cluster.distribution}
-\alias{clusters}
\alias{component_distribution}
\alias{components}
-\alias{count_components}
+\alias{no.clusters}
+\alias{clusters}
\alias{is.connected}
+\alias{cluster.distribution}
+\alias{count_components}
\alias{is_connected}
-\alias{no.clusters}
\title{Connected components of a graph}
\usage{
component_distribution(graph, cumulative = FALSE, mul.size = FALSE, ...)
@@ -24,12 +24,12 @@ frequency) is calculated.}
\item{mul.size}{Logical. If TRUE the relative frequencies will be multiplied
by the cluster sizes.}
+\item{\dots}{Additional attributes to pass to \code{cluster}, right now only
+\code{mode} makes sense.}
+
\item{mode}{Character string, either \dQuote{weak} or \dQuote{strong}. For
directed graphs \dQuote{weak} implies weakly, \dQuote{strong} strongly
connected components to search. It is ignored for undirected graphs.}
-
-\item{\dots}{Additional attributes to pass to \code{cluster}, right now only
-\code{mode} makes sense.}
}
\value{
For \code{is_connected} a logical constant.
@@ -67,15 +67,16 @@ The strongly connected components are implemented by two consecutive
depth-first searches.
}
\examples{
+
g <- sample_gnp(20, 1/20)
clu <- components(g)
groups(clu)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{subcomponent}}, \code{\link{groups}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/compose.Rd b/man/compose.Rd
index 8e1863e..eefb0f0 100644
--- a/man/compose.Rd
+++ b/man/compose.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{compose}
-\alias{\%c\%}
\alias{compose}
\alias{graph.compose}
+\alias{\%c\%}
\title{Compose two graphs as binary relations}
\usage{
compose(g1, g2, byname = "auto")
@@ -63,14 +63,15 @@ g1 and g2, respectively, then (a,a) is included in the result. See
\code{\link{simplify}} if you want to get rid of the self-loops.
}
\examples{
+
g1 <- make_ring(10)
g2 <- make_star(10, mode="undirected")
gc <- compose(g1, g2)
-str(gc)
-str(simplify(gc))
+print_all(gc)
+print_all(simplify(gc))
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/consensus_tree.Rd b/man/consensus_tree.Rd
index 18fd2b6..1898c49 100644
--- a/man/consensus_tree.Rd
+++ b/man/consensus_tree.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{consensus_tree}
\alias{consensus_tree}
@@ -43,12 +43,8 @@ first, and then samples starting from the optimum.
}
\seealso{
Other hierarchical random graph functions: \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg_tree}}; \code{\link{hrg}},
- \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}};
- \code{\link{print.igraphHRG}}
+ \code{\link{hrg-methods}}, \code{\link{hrg_tree}},
+ \code{\link{hrg}}, \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/console.Rd b/man/console.Rd
index 60e788c..c02654c 100644
--- a/man/console.Rd
+++ b/man/console.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/console.R
\name{console}
\alias{console}
@@ -25,11 +25,10 @@ each time an igraph function supporting it starts; to close it, set the
The console is written in Tcl/Tk and required the \code{tcltk} package.
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{igraph_options}} and the \code{verbose} option.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/constraint.Rd b/man/constraint.Rd
index b125612..aecc15d 100644
--- a/man/constraint.Rd
+++ b/man/constraint.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{constraint}
\alias{constraint}
@@ -34,7 +34,7 @@ constraint, \eqn{C_i}{C[i]}, of vertex \eqn{i}'s ego network
V[i], j != i).
}
for a graph of order (ie. number of vertices) \eqn{N}, where
-proportional tie strengths are defined as
+proportional tie strengths are defined as
\deqn{p_{ij} = \frac{a_{ij}+a_{ji}}{\sum_{k \in V_i \setminus \{i\}}(a_{ik}+a_{ki})},}{
p[i,j]=(a[i,j]+a[j,i]) / sum(a[i,k]+a[k,i], k in V[i], k != i),
}
@@ -42,17 +42,18 @@ proportional tie strengths are defined as
graph adjacency matrix. For isolated vertices, constraint is undefined.
}
\examples{
+
g <- sample_gnp(20, 5/20)
constraint(g)
+
+}
+\references{
+Burt, R.S. (2004). Structural holes and good ideas.
+\emph{American Journal of Sociology} 110, 349-399.
}
\author{
Jeroen Bruggeman
(\url{https://sites.google.com/site/jebrug/jeroen-bruggeman-social-science})
and Gabor Csardi \email{csardi.gabor at gmail.com}
}
-\references{
-Burt, R.S. (2004). Structural holes and good ideas.
-\emph{American Journal of Sociology} 110, 349-399.
-}
\keyword{graphs}
-
diff --git a/man/contract.Rd b/man/contract.Rd
index f3f44e4..63a51bf 100644
--- a/man/contract.Rd
+++ b/man/contract.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{contract}
\alias{contract}
@@ -30,6 +30,7 @@ unchanged, vertex attributes are combined, according to the
\code{vertex.attr.comb} parameter.
}
\examples{
+
g <- make_ring(10)
g$name <- "Ring"
V(g)$name <- letters[1:vcount(g)]
@@ -41,9 +42,9 @@ g2 <- contract(g, rep(1:5, each=2),
## graph and edge attributes are kept, vertex attributes are
## combined using the 'toString' function.
print(g2, g=TRUE, v=TRUE, e=TRUE)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/convex_hull.Rd b/man/convex_hull.Rd
index 9af4781..c0f637a 100644
--- a/man/convex_hull.Rd
+++ b/man/convex_hull.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/other.R
\name{convex_hull}
-\alias{convex.hull}
\alias{convex_hull}
+\alias{convex.hull}
\title{Convex hull of a set of vertices}
\usage{
convex_hull(data)
@@ -20,17 +20,17 @@ Calculate the convex hull of a set of points, i.e. the covering polygon that
has the smallest area.
}
\examples{
+
M <- cbind( runif(100), runif(100) )
convex_hull(M)
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\references{
Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, and
Clifford Stein. Introduction to Algorithms, Second Edition. MIT Press and
McGraw-Hill, 2001. ISBN 0262032937. Pages 949-955 of section 33.3: Finding
the convex hull.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/coreness.Rd b/man/coreness.Rd
index e80a4a6..f4620a4 100644
--- a/man/coreness.Rd
+++ b/man/coreness.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{coreness}
\alias{coreness}
@@ -32,12 +32,11 @@ subgraph of the k-core.
This function calculates the coreness for each vertex.
}
\examples{
+
g <- make_ring(10)
g <- add_edges(g, c(1,2, 2,3, 1,3))
coreness(g) # small core triangle in a ring
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Vladimir Batagelj, Matjaz Zaversnik: An O(m) Algorithm for Cores
@@ -49,5 +48,7 @@ Networks}, 5, 269--287.
\seealso{
\code{\link{degree}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/count_isomorphisms.Rd b/man/count_isomorphisms.Rd
index 85053df..b8bbc65 100644
--- a/man/count_isomorphisms.Rd
+++ b/man/count_isomorphisms.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{count_isomorphisms}
\alias{count_isomorphisms}
@@ -44,24 +44,10 @@ LP Cordella, P Foggia, C Sansone, and M Vento: An improved algorithm
}
\seealso{
Other graph isomorphism: \code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
- \code{\link{subgraph_isomorphic}}
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphic}},
+ \code{\link{isomorphism_class}},
+ \code{\link{isomorphisms}},
+ \code{\link{subgraph_isomorphic}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/count_motifs.Rd b/man/count_motifs.Rd
index 90f8bf4..fe33721 100644
--- a/man/count_motifs.Rd
+++ b/man/count_motifs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/motifs.R
\name{count_motifs}
\alias{count_motifs}
@@ -36,8 +36,6 @@ sample_motifs(g, 3)
\seealso{
\code{\link{isomorphism_class}}
-Other graph motifs: \code{\link{graph.motifs.est}},
- \code{\link{sample_motifs}}; \code{\link{graph.motifs}},
- \code{\link{motifs}}
+Other graph motifs: \code{\link{motifs}},
+ \code{\link{sample_motifs}}
}
-
diff --git a/man/count_subgraph_isomorphisms.Rd b/man/count_subgraph_isomorphisms.Rd
index f81f1f3..178dd5f 100644
--- a/man/count_subgraph_isomorphisms.Rd
+++ b/man/count_subgraph_isomorphisms.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{count_subgraph_isomorphisms}
\alias{count_subgraph_isomorphisms}
@@ -67,6 +67,7 @@ following extra arguments:
supply \code{NULL} for both of these arguments.}
}
}
+
\references{
LP Cordella, P Foggia, C Sansone, and M Vento: An improved algorithm
for matching large graphs, \emph{Proc. of the 3rd IAPR TC-15 Workshop
@@ -77,24 +78,10 @@ LP Cordella, P Foggia, C Sansone, and M Vento: An improved algorithm
}
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
- \code{\link{subgraph_isomorphic}}
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphic}},
+ \code{\link{isomorphism_class}},
+ \code{\link{isomorphisms}},
+ \code{\link{subgraph_isomorphic}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/count_triangles.Rd b/man/count_triangles.Rd
index 7cc1fd1..4d64fe0 100644
--- a/man/count_triangles.Rd
+++ b/man/count_triangles.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/triangles.R
\name{count_triangles}
-\alias{adjacent.triangles}
\alias{count_triangles}
+\alias{adjacent.triangles}
\alias{triangles}
\title{Find triangles in graphs}
\usage{
@@ -20,7 +20,7 @@ named graphs.}
For \code{triangles} a numeric vector of vertex ids, the first three
vertices belong to the first triangle found, etc.
-For \code{triangles} a numeric vector, the number of triangles for all
+For \code{count_triangles} a numeric vector, the number of triangles for all
vertices queried.
}
\description{
@@ -35,6 +35,7 @@ to the first triangle, etc.
\code{count_triangles} counts how many triangles a vertex is part of.
}
\examples{
+
## A small graph
kite <- make_graph("Krackhardt_Kite")
plot(kite)
@@ -53,11 +54,10 @@ sum(count_triangles(kite)) == length(triangles(kite))
transitivity(kite, type="local")
count_triangles(kite) / (degree(kite) * (degree(kite)-1)/2)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{transitivity}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/curve_multiple.Rd b/man/curve_multiple.Rd
index 0340a01..aaffa83 100644
--- a/man/curve_multiple.Rd
+++ b/man/curve_multiple.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.common.R
\name{curve_multiple}
-\alias{autocurve.edges}
\alias{curve_multiple}
+\alias{autocurve.edges}
\title{Optimal edge curvature when plotting graphs}
\usage{
curve_multiple(graph, start = 0.5)
@@ -27,6 +27,7 @@ are visible.
plotting a graph with multiple edges, so that all edges are visible.
}
\examples{
+
g <- graph( c(0,1,1,0,1,2,1,3,1,3,1,3,
2,3,2,3,2,3,2,3,0,1)+1 )
@@ -36,14 +37,14 @@ curve_multiple(g)
set.seed(42)
plot(g)
}
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{igraph.plotting}} for all plotting parameters,
\code{\link{plot.igraph}}, \code{\link{tkplot}} and \code{\link{rglplot}}
for plotting functions.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/decompose.Rd b/man/decompose.Rd
index 615f816..06f1949 100644
--- a/man/decompose.Rd
+++ b/man/decompose.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/components.R
\name{decompose}
\alias{decompose}
@@ -32,17 +32,18 @@ A list of graph objects.
Creates a separate graph for each component of a graph.
}
\examples{
+
# the diameter of each component in a random graph
g <- sample_gnp(1000, 1/1000)
components <- decompose(g, min.vertices=2)
sapply(components, diameter)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{is_connected}} to decide whether a graph is connected,
\code{\link{components}} to calculate the connected components of a graph.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/degree.Rd b/man/degree.Rd
index 9a118a0..a371706 100644
--- a/man/degree.Rd
+++ b/man/degree.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{degree}
\alias{degree}
\alias{degree.distribution}
\alias{degree_distribution}
+\alias{degree_distribution}
\title{Degree and degree distribution of the vertices}
\usage{
degree(graph, v = V(graph), mode = c("all", "out", "in", "total"),
@@ -45,13 +46,14 @@ The degree of a vertex is its most basic structural property, the number of
its adjacent edges.
}
\examples{
+
g <- make_ring(10)
degree(g)
g2 <- sample_gnp(1000, 10/1000)
degree_distribution(g2)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/delete_edge_attr.Rd b/man/delete_edge_attr.Rd
index 8f90f26..ec8dfae 100644
--- a/man/delete_edge_attr.Rd
+++ b/man/delete_edge_attr.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{delete_edge_attr}
\alias{delete_edge_attr}
@@ -26,45 +26,17 @@ g2 <- delete_edge_attr(g, "name")
edge_attr_names(g2)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
+Other graph attributes: \code{\link{delete_graph_attr}},
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/delete_edges.Rd b/man/delete_edges.Rd
index 740fcca..68646bd 100644
--- a/man/delete_edges.Rd
+++ b/man/delete_edges.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{delete_edges}
-\alias{delete.edges}
\alias{delete_edges}
+\alias{delete.edges}
\title{Delete edges from a graph}
\usage{
delete_edges(graph, edges)
@@ -28,13 +28,9 @@ g <- make_ring(10) \%>\%
g
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{path}};
- \code{\link{vertex}}, \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{add_vertices}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{path}},
+ \code{\link{vertex}}
}
-
diff --git a/man/delete_graph_attr.Rd b/man/delete_graph_attr.Rd
index 7300323..28b83da 100644
--- a/man/delete_graph_attr.Rd
+++ b/man/delete_graph_attr.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{delete_graph_attr}
\alias{delete_graph_attr}
@@ -25,45 +25,17 @@ g2 <- delete_graph_attr(g, "name")
graph_attr_names(g2)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/delete_vertex_attr.Rd b/man/delete_vertex_attr.Rd
index 7de8766..78674bc 100644
--- a/man/delete_vertex_attr.Rd
+++ b/man/delete_vertex_attr.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{delete_vertex_attr}
\alias{delete_vertex_attr}
@@ -26,45 +26,17 @@ g2 <- delete_vertex_attr(g, "name")
vertex_attr_names(g2)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/delete_vertices.Rd b/man/delete_vertices.Rd
index 53fb0e3..1e98763 100644
--- a/man/delete_vertices.Rd
+++ b/man/delete_vertices.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{delete_vertices}
-\alias{delete.vertices}
\alias{delete_vertices}
+\alias{delete.vertices}
\title{Delete vertices from a graph}
\usage{
delete_vertices(graph, v)
@@ -30,13 +30,9 @@ g2
V(g2)
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{edge}}, \code{\link{edges}};
- \code{\link{path}}; \code{\link{vertex}},
- \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{add_vertices}},
+ \code{\link{delete_edges}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{path}},
+ \code{\link{vertex}}
}
-
diff --git a/man/dfs.Rd b/man/dfs.Rd
index 69e8c54..12c5fc1 100644
--- a/man/dfs.Rd
+++ b/man/dfs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{dfs}
\alias{dfs}
@@ -76,6 +76,7 @@ distance from the root of the search tree.} \item{extra}{The extra
argument.} } See examples below on how to use the callback functions.
}
\examples{
+
## A graph with two separate trees
dfs(make_tree(10) \%du\% make_tree(10), root=1, "out",
TRUE, TRUE, TRUE, TRUE)
@@ -98,12 +99,13 @@ f.out <- function(graph, data, extra) {
}
tmp <- dfs(make_tree(10) \%du\% make_tree(10), root=1,
out.callback=f.out)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
+
}
\seealso{
\code{\link{bfs}} for breadth-first search.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/diameter.Rd b/man/diameter.Rd
index 7fe56cf..c50c201 100644
--- a/man/diameter.Rd
+++ b/man/diameter.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{diameter}
\alias{diameter}
+\alias{get.diameter}
\alias{farthest.nodes}
\alias{farthest_vertices}
-\alias{get.diameter}
\alias{get_diameter}
\title{Diameter of a graph}
\usage{
@@ -31,7 +31,7 @@ A numeric constant for \code{diameter}, a numeric vector for
\code{get_diameter}. \code{farthest_vertices} returns a list with two
entries: \itemize{
\item \code{vertices} The two vertices that are the farthest.
- \item \code{distnace} Their distance.
+ \item \code{distance} Their distance.
}
}
\description{
@@ -48,6 +48,7 @@ one found.
connected by the diameter path.
}
\examples{
+
g <- make_ring(10)
g2 <- delete_edges(g, c(1,2,1,10))
diameter(g2, unconnected=TRUE)
@@ -61,12 +62,12 @@ diameter(g)
get_diameter(g)
diameter(g, weights=NA)
get_diameter(g, weights=NA)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{distances}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/difference.Rd b/man/difference.Rd
index e410df6..e4312e0 100644
--- a/man/difference.Rd
+++ b/man/difference.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{difference}
\alias{difference}
@@ -21,4 +21,3 @@ and igraph vertex and edge sequences. See
\code{\link{difference.igraph}}, and
\code{\link{difference.igraph.vs}}.
}
-
diff --git a/man/difference.igraph.Rd b/man/difference.igraph.Rd
index 1c63530..3d02a11 100644
--- a/man/difference.igraph.Rd
+++ b/man/difference.igraph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{difference.igraph}
-\alias{\%m\%}
\alias{difference.igraph}
\alias{graph.difference}
+\alias{\%m\%}
\title{Difference of graphs}
\usage{
\method{difference}{igraph}(big, small, byname = "auto", ...)
@@ -45,6 +45,7 @@ Note that \code{big} and \code{small} must both be directed or both be
undirected, otherwise an error message is given.
}
\examples{
+
## Create a wheel graph
wheel <- union(make_ring(10),
make_star(11, center=11, mode="undirected"))
@@ -54,11 +55,10 @@ V(wheel)$name <- letters[seq_len(vcount(wheel))]
sstar <- make_star(6, center=6, mode="undirected")
V(sstar)$name <- letters[c(1,3,5,7,9,11)]
G <- wheel \%m\% sstar
-str(G)
+print_all(G)
plot(G, layout=layout_nicely(wheel))
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/difference.igraph.es.Rd b/man/difference.igraph.es.Rd
index f985506..893de82 100644
--- a/man/difference.igraph.es.Rd
+++ b/man/difference.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{difference.igraph.es}
\alias{difference.igraph.es}
@@ -30,23 +30,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
difference(V(g), V(g)[6:10])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/difference.igraph.vs.Rd b/man/difference.igraph.vs.Rd
index a2eb22d..507abae 100644
--- a/man/difference.igraph.vs.Rd
+++ b/man/difference.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{difference.igraph.vs}
\alias{difference.igraph.vs}
@@ -30,23 +30,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
difference(V(g), V(g)[6:10])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/dim_select.Rd b/man/dim_select.Rd
index 3cd5c8f..a0e16df 100644
--- a/man/dim_select.Rd
+++ b/man/dim_select.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{dim_select}
\alias{dim_select}
@@ -34,7 +34,8 @@ distributions, with different means, and we want to know their border. See
examples below.
}
\examples{
-# Generate the two groups of singular values with
+
+# Generate the two groups of singular values with
# Gaussian mixture of two components that have different means
sing.vals <- c( rnorm (10, mean=1, sd=1), rnorm(10, mean=3, sd=1) )
dim.chosen <- dim_select(sing.vals)
@@ -56,9 +57,7 @@ dim_select( embed_adjacency_matrix(RDP.graph.2, 10)$D )
lpvs.sph <- sample_sphere_surface(dim=10, n=20, radius=1)
RDP.graph.3 <- sample_dot_product(lpvs.sph)
dim_select( embed_adjacency_matrix(RDP.graph.3, 10)$D )
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
M. Zhu, and A. Ghodsi (2006). Automatic dimensionality selection
@@ -68,5 +67,7 @@ Statistics and Data Analysis}, Vol. 51, 918--930.
\seealso{
\code{\link{embed_adjacency_matrix}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/disjoint_union.Rd b/man/disjoint_union.Rd
index 2ec5ee1..6155dcc 100644
--- a/man/disjoint_union.Rd
+++ b/man/disjoint_union.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{disjoint_union}
-\alias{\%du\%}
\alias{disjoint_union}
\alias{graph.disjoint.union}
+\alias{\%du\%}
+\alias{\%du\%}
\title{Disjoint union of graphs}
\usage{
disjoint_union(...)
@@ -11,9 +12,9 @@ disjoint_union(...)
x \%du\% y
}
\arguments{
-\item{x,y}{Graph objects.}
-
\item{\dots}{Graph objects or lists of graph objects.}
+
+\item{x, y}{Graph objects.}
}
\value{
A new graph object.
@@ -43,15 +44,15 @@ An error is generated if some input graphs are directed and others are
undirected.
}
\examples{
+
## A star and a ring
g1 <- make_star(10, mode="undirected")
V(g1)$name <- letters[1:10]
g2 <- make_ring(10)
V(g2)$name <- letters[11:20]
-str(g1 \%du\% g2)
+print_all(g1 \%du\% g2)
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/distances.Rd b/man/distances.Rd
index 07259fc..11eabb9 100644
--- a/man/distances.Rd
+++ b/man/distances.Rd
@@ -1,16 +1,20 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R, R/structural.properties.R
\name{distance_table}
-\alias{all_shortest_paths}
-\alias{average.path.length}
\alias{distance_table}
+\alias{mean_distance}
\alias{distances}
-\alias{get.all.shortest.paths}
+\alias{shortest.paths}
\alias{get.shortest.paths}
+\alias{get.all.shortest.paths}
\alias{mean_distance}
+\alias{distance_table}
+\alias{average.path.length}
\alias{path.length.hist}
-\alias{shortest.paths}
+\alias{all_shortest_paths}
+\alias{shortest_paths}
\alias{shortest_paths}
+\alias{all_shortest_paths}
\title{Shortest (directed or undirected) paths between vertices}
\usage{
distance_table(graph, directed = TRUE)
@@ -145,7 +149,7 @@ all calculate shortest paths between vertex pairs.
\code{distances} calculates the lengths of pairwise shortest paths from
a set of vertices (\code{from}) to another set of vertices (\code{to}). It
-uses different algorithms, depending on the \code{argorithm} argument and
+uses different algorithms, depending on the \code{algorithm} argument and
the \code{weight} edge attribute of the graph. The implemented algorithms
are breadth-first search (\sQuote{\code{unweighted}}), this only works for
unweighted graphs; the Dijkstra algorithm (\sQuote{\code{dijkstra}}), this
@@ -183,6 +187,7 @@ directions are considered, so every pair of vertices appears twice in the
histogram.
}
\examples{
+
g <- make_ring(10)
distances(g)
shortest_paths(g, 5)
@@ -195,13 +200,13 @@ el <- matrix(nc=3, byrow=TRUE,
6,10,3, 8,6,1, 8,9,1, 9,10,4) )
g2 <- add_edges(make_empty_graph(10), t(el[,1:2]), weight=el[,3])
distances(g2, mode="out")
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
West, D.B. (1996). \emph{Introduction to Graph Theory.} Upper
Saddle River, N.J.: Prentice Hall.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/diverging_pal.Rd b/man/diverging_pal.Rd
index 4417d41..d078c8b 100644
--- a/man/diverging_pal.Rd
+++ b/man/diverging_pal.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/palette.R
\name{diverging_pal}
\alias{diverging_pal}
@@ -47,7 +47,6 @@ plot(karate)
}
}
\seealso{
-Other palettes: \code{\link{categorical_pal}};
- \code{\link{r_pal}}; \code{\link{sequential_pal}}
+Other palettes: \code{\link{categorical_pal}},
+ \code{\link{r_pal}}, \code{\link{sequential_pal}}
}
-
diff --git a/man/diversity.Rd b/man/diversity.Rd
index 24d8ee9..0d0c1f4 100644
--- a/man/diversity.Rd
+++ b/man/diversity.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{diversity}
\alias{diversity}
@@ -37,6 +37,7 @@ sum(w[i,l], l=1..k[i]),} and \eqn{k_i}{k[i]} is the (total) degree of vertex
For vertices with degree less than two the function returns \code{NaN}.
}
\examples{
+
g1 <- sample_gnp(20, 2/20)
g2 <- sample_gnp(20, 2/20)
g3 <- sample_gnp(20, 5/20)
@@ -47,12 +48,11 @@ diversity(g1)
diversity(g2)
diversity(g3)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Nathan Eagle, Michael Macy and Rob Claxton: Network Diversity
and Economic Development, \emph{Science} \bold{328}, 1029--1031, 2010.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/dominator_tree.Rd b/man/dominator_tree.Rd
index 5acd2ab..b2929c0 100644
--- a/man/dominator_tree.Rd
+++ b/man/dominator_tree.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{dominator_tree}
-\alias{dominator.tree}
\alias{dominator_tree}
+\alias{dominator.tree}
\title{Dominator tree}
\usage{
dominator_tree(graph, root, mode = c("out", "in"))
@@ -48,6 +48,7 @@ This function implements the Lengauer-Tarjan algorithm to construct the
dominator tree of a directed graph. For details see the reference below.
}
\examples{
+
## The example from the paper
g <- graph_from_literal(R-+A:B:C, A-+D, B-+A:D:E, C-+F:G, D-+L,
E-+H, F-+I, G-+I:J, H-+E:K, I-+K, J-+I,
@@ -57,13 +58,12 @@ layout <- layout_as_tree(dtree$domtree, root="R")
layout[,2] <- -layout[,2]
plot(dtree$domtree, layout=layout, vertex.label=V(dtree$domtree)$name)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Thomas Lengauer, Robert Endre Tarjan: A fast algorithm for
finding dominators in a flowgraph, \emph{ACM Transactions on Programming
Languages and Systems (TOPLAS)} I/1, 121--141, 1979.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/dyad_census.Rd b/man/dyad_census.Rd
index c470bf6..d1cca93 100644
--- a/man/dyad_census.Rd
+++ b/man/dyad_census.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/motifs.R
\name{dyad_census}
-\alias{dyad.census}
\alias{dyad_census}
+\alias{dyad.census}
\title{Dyad census of a graph}
\usage{
dyad_census(graph)
@@ -22,12 +22,10 @@ vertices is measured. It can be in three states: mutual, asymmetric or
non-existent.
}
\examples{
+
g <- sample_pa(100)
dyad_census(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Holland, P.W. and Leinhardt, S. A Method for Detecting Structure
in Sociometric Data. \emph{American Journal of Sociology}, 76, 492--513.
@@ -40,5 +38,7 @@ Applications.} Cambridge: Cambridge University Press. 1994.
\code{\link{triad_census}} for the same classification, but with
triples.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/each_edge.Rd b/man/each_edge.Rd
index 4f867c5..3f65ea7 100644
--- a/man/each_edge.Rd
+++ b/man/each_edge.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rewire.R
\name{each_edge}
\alias{each_edge}
@@ -13,7 +13,7 @@ each_edge(prob, loops = FALSE, multiple = FALSE)
graph.}
\item{multiple}{Logical scalar, whether multiple edges are allowed int the
- generated graph.}
+generated graph.}
}
\description{
This function can be used together with \code{\link{rewire}}.
@@ -24,18 +24,18 @@ uniformly randomly to a new vertex in a graph.
Note that this method might create graphs with multiple and/or loop edges.
}
\examples{
+
# Some random shortcuts shorten the distances on a lattice
g <- make_lattice(length = 100, dim = 1, nei = 5)
mean_distance(g)
g <- rewire(g, each_edge(prob = 0.05))
mean_distance(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
-Other rewiring functions: \code{\link{keeping_degseq}};
+Other rewiring functions: \code{\link{keeping_degseq}},
\code{\link{rewire}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/eccentricity.Rd b/man/eccentricity.Rd
index f907529..50cf3ee 100644
--- a/man/eccentricity.Rd
+++ b/man/eccentricity.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{eccentricity}
\alias{eccentricity}
@@ -46,4 +46,3 @@ Harary, F. Graph Theory. Reading, MA: Addison-Wesley, p. 35,
\code{\link{radius}} for a related concept,
\code{\link{distances}} for general shortest path calculations.
}
-
diff --git a/man/edge.Rd b/man/edge.Rd
index 59bd717..133e109 100644
--- a/man/edge.Rd
+++ b/man/edge.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{edge}
\alias{edge}
@@ -23,6 +23,7 @@ edges to/from graphs.
\details{
\code{edges} is an alias for \code{edge}.
+
When adding edges via \code{+}, all unnamed arguments of
\code{edge} (or \code{edges}) are concatenated, and then passed to
\code{\link{add_edges}}. They are interpreted as pairs of vertex ids,
@@ -51,13 +52,10 @@ g <- make_ring(10) + edges(1:10)
plot(g)
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{path}};
- \code{\link{vertex}}, \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{add_vertices}},
+ \code{\link{delete_edges}},
+ \code{\link{delete_vertices}},
+ \code{\link{igraph-minus}}, \code{\link{path}},
+ \code{\link{vertex}}
}
-
diff --git a/man/edge_attr-set.Rd b/man/edge_attr-set.Rd
index 1e4e28a..3cbd59c 100644
--- a/man/edge_attr-set.Rd
+++ b/man/edge_attr-set.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{edge_attr<-}
-\alias{edge.attributes<-}
\alias{edge_attr<-}
+\alias{edge.attributes<-}
\title{Set one or more edge attributes}
\usage{
edge_attr(graph, name, index = E(graph)) <- value
@@ -35,45 +35,18 @@ g
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes}}, \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr_names}}, \code{\link{edge_attr}},
+ \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/edge_attr.Rd b/man/edge_attr.Rd
index 3c2f7aa..96adbf6 100644
--- a/man/edge_attr.Rd
+++ b/man/edge_attr.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{edge_attr}
-\alias{edge.attributes}
\alias{edge_attr}
\alias{get.edge.attribute}
+\alias{edge.attributes}
\title{Query edge attributes of a graph}
\usage{
edge_attr(graph, name, index = E(graph))
@@ -32,44 +32,18 @@ g
plot(g, edge.width = E(g)$weight)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/edge_attr_names.Rd b/man/edge_attr_names.Rd
index e688cf7..802d461 100644
--- a/man/edge_attr_names.Rd
+++ b/man/edge_attr_names.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{edge_attr_names}
\alias{edge_attr_names}
@@ -23,45 +23,18 @@ edge_attr_names(g)
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr}},
+ \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/edge_connectivity.Rd b/man/edge_connectivity.Rd
index 5b86c5e..618aeca 100644
--- a/man/edge_connectivity.Rd
+++ b/man/edge_connectivity.Rd
@@ -1,12 +1,12 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{edge_connectivity}
-\alias{adhesion}
-\alias{edge.connectivity}
-\alias{edge.disjoint.paths}
\alias{edge_connectivity}
+\alias{edge.connectivity}
\alias{edge_disjoint_paths}
\alias{graph.adhesion}
+\alias{adhesion}
+\alias{edge.disjoint.paths}
\title{Edge connectivity.}
\usage{
edge_connectivity(graph, source = NULL, target = NULL, checks = TRUE)
@@ -60,6 +60,7 @@ more precisely the most general is \code{edge_connectivity}, the others are
included only for having more descriptive function names.
}
\examples{
+
g <- barabasi.game(100, m=1)
g2 <- barabasi.game(100, m=5)
edge_connectivity(g, 100, 1)
@@ -70,9 +71,7 @@ g <- sample_gnp(50, 5/50)
g <- as.directed(g)
g <- induced_subgraph(g, subcomponent(g, 1))
adhesion(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Douglas R. White and Frank Harary: The cohesiveness of blocks in
@@ -82,5 +81,7 @@ social networks: node connectivity and conditional density, TODO: citation
\code{\link{max_flow}}, \code{\link{vertex_connectivity}},
\code{\link{vertex_disjoint_paths}}, \code{\link{cohesion}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/edge_density.Rd b/man/edge_density.Rd
index 42388bc..8efe75a 100644
--- a/man/edge_density.Rd
+++ b/man/edge_density.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{edge_density}
\alias{edge_density}
@@ -28,6 +28,7 @@ Note that this function may return strange results for graph with multiple
edges, density is ill-defined for graphs with multiple edges.
}
\examples{
+
g1 <- make_empty_graph(n=10)
g2 <- make_full_graph(n=10)
g3 <- sample_gnp(n=10, 0.4)
@@ -37,9 +38,7 @@ g <- graph( c(1,2, 2,2, 2,3) )
edge_density(g, loops=FALSE) # this is wrong!!!
edge_density(g, loops=TRUE) # this is right!!!
edge_density(simplify(g), loops=FALSE) # this is also right, but different
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Wasserman, S., and Faust, K. (1994). Social Network Analysis:
@@ -49,5 +48,7 @@ Methods and Applications. Cambridge: Cambridge University Press.
\code{\link{vcount}}, \code{\link{ecount}}, \code{\link{simplify}}
to get rid of the multiple and/or loop edges.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/ego.Rd b/man/ego.Rd
index 2b02381..1d6b42d 100644
--- a/man/ego.Rd
+++ b/man/ego.Rd
@@ -1,22 +1,26 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
-\name{ego}
-\alias{connect}
-\alias{connect.neighborhood}
+\name{ego_size}
+\alias{ego_size}
\alias{ego}
+\alias{neighborhood}
+\alias{neighborhood.size}
+\alias{graph.neighborhood}
\alias{ego_graph}
+\alias{connect.neighborhood}
+\alias{connect}
\alias{ego_size}
-\alias{graph.neighborhood}
\alias{make_ego_graph}
-\alias{neighborhood}
-\alias{neighborhood.size}
\title{Neighborhood of graph vertices}
\usage{
-ego(graph, order, nodes = V(graph), mode = c("all", "out", "in"),
+ego_size(graph, order = 1, nodes = V(graph), mode = c("all", "out", "in"),
mindist = 0)
-make_ego_graph(graph, order, nodes = V(graph), mode = c("all", "out", "in"),
+ego(graph, order = 1, nodes = V(graph), mode = c("all", "out", "in"),
mindist = 0)
+
+make_ego_graph(graph, order = 1, nodes = V(graph), mode = c("all", "out",
+ "in"), mindist = 0)
}
\arguments{
\item{graph}{The input graph.}
@@ -25,7 +29,7 @@ make_ego_graph(graph, order, nodes = V(graph), mode = c("all", "out", "in"),
\item{nodes}{The vertices for which the calculation is performed.}
-\item{mode}{Character constatnt, it specifies how to use the direction of
+\item{mode}{Character constant, it specifies how to use the direction of
the edges if a directed graph is analyzed. For \sQuote{out} only the
outgoing edges are followed, so all vertices reachable from the source
vertex in at most \code{order} steps are counted. For \sQuote{"in"} all
@@ -68,25 +72,26 @@ the vertex, edge and graph attributes.
all other vertices in its neighborhood.
}
\examples{
+
g <- make_ring(10)
-ego_size(g, 0, 1:3)
-ego_size(g, 1, 1:3)
-ego_size(g, 2, 1:3)
-ego(g, 0, 1:3)
-ego(g, 1, 1:3)
-ego(g, 2, 1:3)
+ego_size(g, order = 0, 1:3)
+ego_size(g, order = 1, 1:3)
+ego_size(g, order = 2, 1:3)
+ego(g, order = 0, 1:3)
+ego(g, order = 1, 1:3)
+ego(g, order = 2, 1:3)
# attributes are preserved
V(g)$name <- c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")
-make_ego_graph(g, 2, 1:3)
+make_ego_graph(g, order = 2, 1:3)
# connecting to the neighborhood
g <- make_ring(10)
g <- connect(g, 2)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}, the first version was
done by Vincent Matossian
}
\keyword{graphs}
-
diff --git a/man/eigen_centrality.Rd b/man/eigen_centrality.Rd
index 0aeeee2..41f3a64 100644
--- a/man/eigen_centrality.Rd
+++ b/man/eigen_centrality.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{eigen_centrality}
\alias{eigen_centrality}
@@ -26,7 +26,9 @@ used, even if the graph has a \code{weights} edge attribute. If this is
\code{NA}, then no edge weights are used (even if the graph has a
\code{weight} edge attribute. Note that if there are negative edge weights
and the direction of the edges is considered, then the eigenvector might be
-complex. In this case only the real part is reported.}
+complex. In this case only the real part is reported.
+This function interprets weights as connection strength. Higher
+weights spread the centrality better.}
\item{options}{A named list, to override some ARPACK options. See
\code{\link{arpack}} for details.}
@@ -66,20 +68,21 @@ computation, see \code{\link{arpack}} for more about ARPACK in igraph.
before extracting eigenvectors; don't send this routine asymmetric matrices
unless you really mean to do so.
}
+
\examples{
+
#Generate some test data
g <- make_ring(10, directed=FALSE)
#Compute eigenvector centrality scores
eigen_centrality(g)
}
+\references{
+Bonacich, P. (1987). Power and Centrality: A Family of
+Measures. \emph{American Journal of Sociology}, 92, 1170-1182.
+}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com} and Carter T. Butts
(\url{http://www.faculty.uci.edu/profile.cfm?faculty_id=5057}) for the
manual page.
}
-\references{
-Bonacich, P. (1987). Power and Centrality: A Family of
-Measures. \emph{American Journal of Sociology}, 92, 1170-1182.
-}
\keyword{graphs}
-
diff --git a/man/embed_adjacency_matrix.Rd b/man/embed_adjacency_matrix.Rd
index 0a856c3..3a387e6 100644
--- a/man/embed_adjacency_matrix.Rd
+++ b/man/embed_adjacency_matrix.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{embed_adjacency_matrix}
\alias{embed_adjacency_matrix}
@@ -16,9 +16,10 @@ spectral embedding. Should be smaller than the number of vertices. The
largest \code{no}-dimensional non-zero singular values are used for the
spectral embedding.}
-\item{weights}{Optional positive weight vector for calculating weighted
-closeness. If the graph has a \code{weight} edge attribute, then this is
-used by default.}
+\item{weights}{Optional positive weight vector for calculating a weighted
+embedding. If the graph has a \code{weight} edge attribute, then this is
+used by default. In a weighted embedding, the edge weights are used instead
+of the binary adjacencny matrix.}
\item{which}{Which eigenvalues (or singular values, for directed graphs) to
use. \sQuote{lm} means the ones with the largest magnitude, \sQuote{la} is
@@ -70,6 +71,7 @@ sqrt(D[no])}. (For undirected graphs \eqn{U=V}, so it is enough to keep one
of them.)
}
\examples{
+
## A small graph
lpvs <- matrix(rnorm(200), 20, 10)
lpvs <- apply(lpvs, 2, function(x) { return (abs(x)/sqrt(sum(x^2))) })
@@ -85,4 +87,3 @@ Consistent Adjacency Spectral Embedding for Stochastic Blockmodel Graphs,
\code{\link{sample_dot_product}}
}
\keyword{graphs}
-
diff --git a/man/embed_laplacian_matrix.Rd b/man/embed_laplacian_matrix.Rd
index 4809273..79c53d7 100644
--- a/man/embed_laplacian_matrix.Rd
+++ b/man/embed_laplacian_matrix.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{embed_laplacian_matrix}
\alias{embed_laplacian_matrix}
@@ -17,9 +17,11 @@ spectral embedding. Should be smaller than the number of vertices. The
largest \code{no}-dimensional non-zero singular values are used for the
spectral embedding.}
-\item{weights}{Optional positive weight vector for calculating weighted
-closeness. If the graph has a \code{weight} edge attribute, then this is
-used by default.}
+\item{weights}{Optional positive weight vector for calculating a weighted
+embedding. If the graph has a \code{weight} edge attribute, then this is
+used by default. For weighted embedding, edge weights are used instead
+of the binary adjacency matrix, and vertex stregth (see
+\code{\link{strength}}) is used instead of the degrees.}
\item{which}{Which eigenvalues (or singular values, for directed graphs) to
use. \sQuote{lm} means the ones with the largest magnitude, \sQuote{la} is
@@ -78,15 +80,13 @@ They are essentially doing the same as \code{\link{embed_adjacency_matrix}},
but work on the Laplacian matrix, instead of the adjacency matrix.
}
\examples{
+
## A small graph
lpvs <- matrix(rnorm(200), 20, 10)
lpvs <- apply(lpvs, 2, function(x) { return (abs(x)/sqrt(sum(x^2))) })
RDP <- sample_dot_product(lpvs)
embed <- embed_laplacian_matrix(RDP, 5)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Sussman, D.L., Tang, M., Fishkind, D.E., Priebe, C.E. A
Consistent Adjacency Spectral Embedding for Stochastic Blockmodel Graphs,
@@ -96,5 +96,7 @@ Consistent Adjacency Spectral Embedding for Stochastic Blockmodel Graphs,
\code{\link{embed_adjacency_matrix}},
\code{\link{sample_dot_product}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/ends.Rd b/man/ends.Rd
index 3974127..d0d80a9 100644
--- a/man/ends.Rd
+++ b/man/ends.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{ends}
\alias{ends}
-\alias{get.edge}
\alias{get.edges}
+\alias{get.edge}
\title{Incident vertices of some graph edges}
\usage{
ends(graph, es, names = TRUE)
@@ -27,14 +27,11 @@ g <- make_ring(5)
ends(g, E(g))
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{get.edge.ids}}; \code{\link{gorder}},
- \code{\link{vcount}}; \code{\link{head_of}};
- \code{\link{incident_edges}}; \code{\link{incident}};
- \code{\link{is.directed}}, \code{\link{is_directed}};
- \code{\link{neighbors}}; \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{get.edge.ids}},
+ \code{\link{gorder}}, \code{\link{gsize}},
+ \code{\link{head_of}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/erdos.renyi.game.Rd b/man/erdos.renyi.game.Rd
index 5543c1a..12a246a 100644
--- a/man/erdos.renyi.game.Rd
+++ b/man/erdos.renyi.game.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{erdos.renyi.game}
\alias{erdos.renyi.game}
@@ -50,12 +50,12 @@ Since igraph version 0.8.0, both \code{erdos.renyi.game} and
\code{random.graph.game} are deprecated, and \code{\link{sample_gnp}} and
\code{\link{sample_gnm}} should be used instead.
}
+
\examples{
+
g <- erdos.renyi.game(1000, 1/1000)
degree_distribution(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Erdos, P. and Renyi, A., On random graphs, \emph{Publicationes
@@ -64,5 +64,7 @@ Mathematicae} 6, 290--297 (1959).
\seealso{
\code{\link{sample_pa}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/fit_hrg.Rd b/man/fit_hrg.Rd
index 0bd7add..7160479 100644
--- a/man/fit_hrg.Rd
+++ b/man/fit_hrg.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{fit_hrg}
\alias{fit_hrg}
@@ -79,12 +79,8 @@ Notes in Computer Science} 4503, 1--13. Springer-Verlag, Berlin Heidelberg
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg_tree}}; \code{\link{hrg}},
- \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}};
- \code{\link{print.igraphHRG}}
+ \code{\link{hrg-methods}}, \code{\link{hrg_tree}},
+ \code{\link{hrg}}, \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/fit_power_law.Rd b/man/fit_power_law.Rd
index 68a5f67..819d884 100644
--- a/man/fit_power_law.Rd
+++ b/man/fit_power_law.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fit.R
\name{fit_power_law}
\alias{fit_power_law}
@@ -90,6 +90,7 @@ The function uses the method of Clauset, Shalizi and Newman to calculate the
parameters of the fitted distribution. See references below for the details.
}
\examples{
+
# This should approximately yield the correct exponent 3
g <- barabasi.game(1000) # increase this number to have a better estimate
d <- degree(g, mode="in")
@@ -100,10 +101,7 @@ fit1$alpha
stats4::coef(fit2)
fit1$logLik
stats4::logLik(fit2)
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com}
+
}
\references{
Power laws, Pareto distributions and Zipf's law, M. E. J.
@@ -115,5 +113,8 @@ distributions in empirical data. SIAM Review 51(4):661-703, 2009.
\seealso{
\code{\link[stats4]{mle}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/get.edge.ids.Rd b/man/get.edge.ids.Rd
index 1a18f88..a22dc1a 100644
--- a/man/get.edge.ids.Rd
+++ b/man/get.edge.ids.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{get.edge.ids}
\alias{get.edge.ids}
@@ -44,26 +44,24 @@ This function allows finding the edges of the graph, via their incident
vertices.
}
\examples{
+
g <- make_ring(10)
ei <- get.edge.ids(g, c(1,2, 4,5))
E(g)[ei]
## non-existant edge
get.edge.ids(g, c(2,1, 1,4, 5,4))
+
+}
+\seealso{
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{gorder}}, \code{\link{gsize}},
+ \code{\link{head_of}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
-\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{gorder}},
- \code{\link{vcount}}; \code{\link{head_of}};
- \code{\link{incident_edges}}; \code{\link{incident}};
- \code{\link{is.directed}}, \code{\link{is_directed}};
- \code{\link{neighbors}}; \code{\link{tail_of}}
-}
-
diff --git a/man/girth.Rd b/man/girth.Rd
index 4f6332a..ca24a8c 100644
--- a/man/girth.Rd
+++ b/man/girth.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{girth}
\alias{girth}
@@ -31,6 +31,7 @@ symposium on Theory of computing}, 1-10, 1977. The first implementation of
this function was done by Keith Briggs, thanks Keith.
}
\examples{
+
# No circle in a tree
g <- make_tree(1000, 3)
girth(g)
@@ -42,14 +43,14 @@ girth(g)
# What about a random graph?
g <- sample_gnp(1000, 1/1000)
girth(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Alon Itai and Michael Rodeh: Finding a minimum circuit in a
graph \emph{Proceedings of the ninth annual ACM symposium on Theory of
computing}, 1-10, 1977
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/gorder.Rd b/man/gorder.Rd
index 6039503..491897e 100644
--- a/man/gorder.Rd
+++ b/man/gorder.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{gorder}
\alias{gorder}
@@ -21,15 +21,11 @@ g <- make_ring(10)
gorder(g)
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{neighbors}};
- \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gsize}},
+ \code{\link{head_of}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/graph_.Rd b/man/graph_.Rd
index 3bbb780..eac9778 100644
--- a/man/graph_.Rd
+++ b/man/graph_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{graph_}
\alias{graph_}
@@ -20,4 +20,3 @@ TODO
graph_(cbind(1:5,2:6), from_edgelist(directed = FALSE))
graph_(cbind(1:5,2:6), from_edgelist(), directed = FALSE)
}
-
diff --git a/man/graph_attr-set.Rd b/man/graph_attr-set.Rd
index 98f08ae..96d7847 100644
--- a/man/graph_attr-set.Rd
+++ b/man/graph_attr-set.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{graph_attr<-}
-\alias{graph.attributes<-}
\alias{graph_attr<-}
+\alias{graph.attributes<-}
\title{Set all or some graph attributes}
\usage{
graph_attr(graph, name) <- value
@@ -32,45 +32,17 @@ graph_attr(g) <- list(layout = layout_with_fr(g),
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr_names}},
+ \code{\link{graph_attr}}, \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/graph_attr.Rd b/man/graph_attr.Rd
index 0ac9608..8a1cab4 100644
--- a/man/graph_attr.Rd
+++ b/man/graph_attr.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{graph_attr}
+\alias{graph_attr}
\alias{get.graph.attribute}
\alias{graph.attributes}
-\alias{graph_attr}
\title{Graph attributes of a graph}
\usage{
graph_attr(graph, name)
@@ -26,45 +26,18 @@ graph_attr(g)
graph_attr(g, "name")
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/graph_attr_names.Rd b/man/graph_attr_names.Rd
index 71b8891..cfd4f56 100644
--- a/man/graph_attr_names.Rd
+++ b/man/graph_attr_names.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{graph_attr_names}
-\alias{attributes}
\alias{graph_attr_names}
\alias{list.graph.attributes}
+\alias{attributes}
\title{List names of graph attributes}
\usage{
graph_attr_names(graph)
@@ -22,45 +22,17 @@ g <- make_ring(10)
graph_attr_names(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr}}, \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/graph_from_adj_list.Rd b/man/graph_from_adj_list.Rd
index ccdf6b6..095c1ec 100644
--- a/man/graph_from_adj_list.Rd
+++ b/man/graph_from_adj_list.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{graph_from_adj_list}
-\alias{graph.adjlist}
\alias{graph_from_adj_list}
+\alias{graph.adjlist}
\title{Create graphs from adjacency lists}
\usage{
graph_from_adj_list(adjlist, mode = c("out", "in", "all", "total"),
@@ -44,6 +44,7 @@ The idea is that you convert your graph to an adjacency list by
create again an igraph graph by calling \code{graph_from_adj_list}.
}
\examples{
+
## Directed
g <- make_ring(10, dir=TRUE)
al <- as_adj_list(g, mode="out")
@@ -60,11 +61,10 @@ g3 <- graph_from_adj_list(al, mode="all", duplicate=FALSE)
ecount(g3)
which_multiple(g3)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{as_edgelist}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/graph_from_adjacency_matrix.Rd b/man/graph_from_adjacency_matrix.Rd
index 747de90..4d127a9 100644
--- a/man/graph_from_adjacency_matrix.Rd
+++ b/man/graph_from_adjacency_matrix.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/adjacency.R
\name{graph_from_adjacency_matrix}
-\alias{from_adjacency}
-\alias{graph.adjacency}
\alias{graph_from_adjacency_matrix}
+\alias{graph.adjacency}
+\alias{from_adjacency}
\title{Create graphs from adjacency matrices}
\usage{
graph_from_adjacency_matrix(adjmatrix, mode = c("directed", "undirected",
@@ -99,6 +99,7 @@ undirected graph will be created, \code{A(i,j)+A(j,i)} gives the edge
weights.} }
}
\examples{
+
adjm <- matrix(sample(0:1, 100, replace=TRUE, prob=c(0.9,0.1)), nc=10)
g1 <- graph_from_adjacency_matrix( adjm )
adjm <- matrix(sample(0:5, 100, replace=TRUE,
@@ -138,13 +139,13 @@ rownames(adjm) <- sample(letters, nrow(adjm))
colnames(adjm) <- seq(ncol(adjm))
g10 <- graph_from_adjacency_matrix(adjm, weighted=TRUE, add.rownames="code")
summary(g10)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\link{graph} and \code{\link{graph_from_literal}} for other ways to
create graphs.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/graph_from_atlas.Rd b/man/graph_from_atlas.Rd
index ebbeaa6..1fa7014 100644
--- a/man/graph_from_atlas.Rd
+++ b/man/graph_from_atlas.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{graph_from_atlas}
-\alias{atlas}
-\alias{graph.atlas}
\alias{graph_from_atlas}
+\alias{graph.atlas}
+\alias{atlas}
\title{Create a graph from the Graph Atlas}
\usage{
graph_from_atlas(n)
@@ -40,35 +40,15 @@ graph_from_atlas(sample(0:1252, 1))
graph_from_atlas(sample(0:1252, 1))
}
\seealso{
-Other determimistic constructors: \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
\concept{
Graph Atlas.
}
-
diff --git a/man/graph_from_data_frame.Rd b/man/graph_from_data_frame.Rd
index 4ab1156..54c24db 100644
--- a/man/graph_from_data_frame.Rd
+++ b/man/graph_from_data_frame.Rd
@@ -1,11 +1,12 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R, R/data_frame.R
\name{as_data_frame}
\alias{as_data_frame}
-\alias{from_data_frame}
-\alias{get.data.frame}
-\alias{graph.data.frame}
\alias{graph_from_data_frame}
+\alias{graph.data.frame}
+\alias{as_data_frame}
+\alias{get.data.frame}
+\alias{from_data_frame}
\title{Creating igraph graphs from data frames or vice-versa}
\usage{
as_data_frame(x, what = c("edges", "vertices", "both"))
@@ -94,6 +95,7 @@ touched. In other words, vertex names (=the first column) cannot be
\code{NA}, but other vertex attributes can.
}
\examples{
+
## A simple example with a couple of actors
## The typical case is that these tables are read in from files....
actors <- data.frame(name=c("Alice", "Bob", "Cecil", "David",
@@ -111,14 +113,14 @@ print(g, e=TRUE, v=TRUE)
## The opposite operation
as_data_frame(g, what="vertices")
as_data_frame(g, what="edges")
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{graph_from_literal}}
for another way to create graphs, \code{\link{read.table}} to read in tables
from files.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/graph_from_edgelist.Rd b/man/graph_from_edgelist.Rd
index 92c9939..1feee11 100644
--- a/man/graph_from_edgelist.Rd
+++ b/man/graph_from_edgelist.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_frame.R
\name{graph_from_edgelist}
-\alias{from_edgelist}
-\alias{graph.edgelist}
\alias{graph_from_edgelist}
+\alias{graph.edgelist}
+\alias{from_edgelist}
\title{Create a graph from an edge list matrix}
\usage{
graph_from_edgelist(el, directed = TRUE)
@@ -36,35 +36,15 @@ graph_from_edgelist(el)
graph_from_edgelist(cbind(1:10, c(2:10, 1)))
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
\concept{
Edge list
}
-
diff --git a/man/graph_from_graphdb.Rd b/man/graph_from_graphdb.Rd
index 98db9da..0987b48 100644
--- a/man/graph_from_graphdb.Rd
+++ b/man/graph_from_graphdb.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/foreign.R
\name{graph_from_graphdb}
-\alias{graph.graphdb}
\alias{graph_from_graphdb}
+\alias{graph.graphdb}
\title{Load a graph from the graph database for testing graph isomorphism.}
\usage{
graph_from_graphdb(url = NULL, prefix = "iso", type = "r001",
@@ -66,6 +66,7 @@ its old version at
for the actual format of a graph database file and other information.
}
\examples{
+
\dontrun{
g <- graph_from_graphdb(prefix="iso", type="r001", nodes=20, pair="A",
which=10, compressed=TRUE)
@@ -78,9 +79,6 @@ g3 <- graph_from_graphdb(url=paste(sep="/",
"iso_b06m_m200.A09.gz"))
}
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
M. De Santo, P. Foggia, C. Sansone, M. Vento: A large database
of graphs and its use for benchmarking graph isomorphism algorithms,
@@ -89,5 +87,7 @@ of graphs and its use for benchmarking graph isomorphism algorithms,
\seealso{
\code{\link{read_graph}}, \code{\link{graph.isomorphic.vf2}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/graph_from_graphnel.Rd b/man/graph_from_graphnel.Rd
index dc5e923..2f8d7b6 100644
--- a/man/graph_from_graphnel.Rd
+++ b/man/graph_from_graphnel.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/conversion.R
\name{graph_from_graphnel}
\alias{graph_from_graphnel}
@@ -56,7 +56,7 @@ GNEL2 <- as_graphnel(g3)
g4 <- graph_from_graphnel(GNEL2)
g4
}
-#'
+#' @export
}
\seealso{
\code{\link{as_graphnel}} for the other direction,
@@ -64,4 +64,3 @@ g4
\code{\link{as_adj_list}} and \code{\link{graph.adjlist}} for other
graph representations.
}
-
diff --git a/man/graph_from_incidence_matrix.Rd b/man/graph_from_incidence_matrix.Rd
index 327e24b..dd4bb77 100644
--- a/man/graph_from_incidence_matrix.Rd
+++ b/man/graph_from_incidence_matrix.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/incidence.R
\name{graph_from_incidence_matrix}
-\alias{from_incidence_matrix}
-\alias{graph.incidence}
\alias{graph_from_incidence_matrix}
+\alias{graph.incidence}
+\alias{from_incidence_matrix}
\title{Create graphs from an incidence matrix}
\usage{
graph_from_incidence_matrix(incidence, directed = FALSE, mode = c("all",
@@ -69,17 +69,18 @@ the closest non-negative integer to get the number of edges to create
between a pair of vertices.
}
\examples{
+
inc <- matrix(sample(0:1, 15, repl=TRUE), 3, 5)
colnames(inc) <- letters[1:5]
rownames(inc) <- LETTERS[1:3]
graph_from_incidence_matrix(inc)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{make_bipartite_graph}} for another way to create bipartite
graphs
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/graph_from_isomorphism_class.Rd b/man/graph_from_isomorphism_class.Rd
index 56a8624..73712ab 100644
--- a/man/graph_from_isomorphism_class.Rd
+++ b/man/graph_from_isomorphism_class.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{graph_from_isomorphism_class}
-\alias{graph.isocreate}
\alias{graph_from_isomorphism_class}
+\alias{graph.isocreate}
\title{Create a graph from an isomorphism class}
\usage{
graph_from_isomorphism_class(size, number, directed = TRUE)
@@ -27,24 +27,10 @@ vertices.
}
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
\code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
- \code{\link{subgraph_isomorphic}}
+ \code{\link{isomorphic}},
+ \code{\link{isomorphism_class}},
+ \code{\link{isomorphisms}},
+ \code{\link{subgraph_isomorphic}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/graph_from_lcf.Rd b/man/graph_from_lcf.Rd
index 78f1061..e4a444b 100644
--- a/man/graph_from_lcf.Rd
+++ b/man/graph_from_lcf.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{graph_from_lcf}
-\alias{graph.lcf}
\alias{graph_from_lcf}
+\alias{graph.lcf}
\title{Creating a graph from LCF notation}
\usage{
graph_from_lcf(n, shifts, repeats = 1)
@@ -26,17 +26,17 @@ be performed. See \url{http://mathworld.wolfram.com/LCFNotation.html} for
details.
}
\examples{
+
# This is the Franklin graph:
g1 <- graph_from_lcf(12, c(5,-5), 6)
g2 <- make_graph("Franklin")
isomorphic(g1, g2)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{graph}} can create arbitrary graphs, see also the other
functions on the its manual page for creating special graphs.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/graph_from_literal.Rd b/man/graph_from_literal.Rd
index 52b3cf8..00ba5bd 100644
--- a/man/graph_from_literal.Rd
+++ b/man/graph_from_literal.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{graph_from_literal}
-\alias{from_literal}
-\alias{graph.formula}
\alias{graph_from_literal}
+\alias{graph.formula}
+\alias{from_literal}
\title{Creating (small) graphs via a simple interface}
\usage{
graph_from_literal(..., simplify = TRUE)
@@ -119,35 +119,15 @@ g5
# Special vertex names
g6 <- graph_from_literal( "+" -- "-", "*" -- "/", "\%\%" -- "\%/\%" )
g6
+
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
-
diff --git a/man/graph_id.Rd b/man/graph_id.Rd
new file mode 100644
index 0000000..bd6eb47
--- /dev/null
+++ b/man/graph_id.Rd
@@ -0,0 +1,32 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/iterators.R
+\name{graph_id}
+\alias{graph_id}
+\title{Get the id of a graph}
+\usage{
+graph_id(x, ...)
+}
+\arguments{
+\item{x}{A graph or a vertex sequence or an edge sequence.}
+
+\item{...}{Not used currently.}
+}
+\value{
+The id of the graph, a character scalar. For
+vertex and edge sequences the id of the graph they were created from.
+}
+\description{
+Graph ids are used to check that a vertex or edge sequence
+belongs to a graph. If you create a new graph by changing the
+structure of a graph, the new graph will have a new id.
+Changing the attributes will not change the id.
+}
+\examples{
+g <- make_ring(10)
+graph_id(g)
+graph_id(V(g))
+graph_id(E(g))
+
+g2 <- g + 1
+graph_id(g2)
+}
diff --git a/man/graph_version.Rd b/man/graph_version.Rd
index 6adc4c6..800e0e8 100644
--- a/man/graph_version.Rd
+++ b/man/graph_version.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/versions.R
\name{graph_version}
\alias{graph_version}
@@ -29,4 +29,3 @@ to the current one.
\seealso{
upgrade_graph to convert the data format of a graph.
}
-
diff --git a/man/graphlet_basis.Rd b/man/graphlet_basis.Rd
index c395150..513d58a 100644
--- a/man/graphlet_basis.Rd
+++ b/man/graphlet_basis.Rd
@@ -1,11 +1,12 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/glet.R
\name{graphlet_basis}
\alias{graphlet_basis}
-\alias{graphlet_proj}
\alias{graphlets}
-\alias{graphlets.candidate.basis}
\alias{graphlets.project}
+\alias{graphlet_proj}
+\alias{graphlets.candidate.basis}
+\alias{graphlet_proj}
\title{Graphlet decomposition of a graph}
\usage{
graphlet_basis(graph, weights = NULL)
@@ -59,6 +60,7 @@ the algorithm, and they are useful if the user wishes to perform them
individually: \code{graphlet_basis} and \code{graphlet_proj}.
}
\examples{
+
## Create an example graph first
D1 <- matrix(0, 5, 5)
D2 <- matrix(0, 5, 5)
@@ -66,7 +68,7 @@ D3 <- matrix(0, 5, 5)
D1[1:3, 1:3] <- 2
D2[3:5, 3:5] <- 3
D3[2:5, 2:5] <- 1
-
+
g <- simplify(graph_from_adjacency_matrix(D1 + D2 + D3,
mode="undirected", weighted=TRUE))
V(g)$color <- "white"
@@ -94,6 +96,4 @@ for (i in 1:length(gl$cliques)) {
E(g)[ width == 2 ]$color <- "#E495A5"
plot(g, layout=co)
}
-#'
}
-
diff --git a/man/groups.Rd b/man/groups.Rd
index cde49ac..6495e28 100644
--- a/man/groups.Rd
+++ b/man/groups.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{groups}
\alias{groups}
-\alias{groups.communities}
\alias{groups.default}
+\alias{groups.communities}
\title{Groups of a vertex partitioning}
\usage{
groups(x)
@@ -40,4 +40,3 @@ groups(components(g2))
\code{\link{components}} and the various community finding
functions.
}
-
diff --git a/man/gsize.Rd b/man/gsize.Rd
index 1a2d2e3..af549c6 100644
--- a/man/gsize.Rd
+++ b/man/gsize.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{gsize}
-\alias{ecount}
\alias{gsize}
+\alias{ecount}
\title{The size of the graph (number of edges)}
\usage{
gsize(graph)
@@ -26,15 +26,11 @@ replicate(100, sample_gnp(10, 1/2), simplify = FALSE) \%>\%
hist()
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{neighbors}};
- \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{head_of}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/head_of.Rd b/man/head_of.Rd
index cf7c90e..55e0ed3 100644
--- a/man/head_of.Rd
+++ b/man/head_of.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/basic.R
\name{head_of}
\alias{head_of}
@@ -20,15 +20,11 @@ For undirected graphs, head and tail is not defined. In this case
\code{tail_of} returns the other end(s) of the edge(s).
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{incident_edges}}; \code{\link{incident}};
- \code{\link{is.directed}}, \code{\link{is_directed}};
- \code{\link{neighbors}}; \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{incident_edges}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/head_print.Rd b/man/head_print.Rd
new file mode 100644
index 0000000..c5b5008
--- /dev/null
+++ b/man/head_print.Rd
@@ -0,0 +1,34 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/printr.R
+\name{head_print}
+\alias{head_print}
+\title{Print the only the head of an R object}
+\usage{
+head_print(x, max_lines = 20, header = "", footer = "",
+ omitted_footer = "", ...)
+}
+\arguments{
+\item{x}{The object to print, or a callback function. See
+\code{\link{printer_callback}} for details.}
+
+\item{max_lines}{Maximum number of lines to print, \emph{not}
+including the header and the footer.}
+
+\item{header}{The header, if a function, then it will be called,
+otherwise printed using \code{cat}.}
+
+\item{footer}{The footer, if a function, then it will be called,
+otherwise printed using \code{cat}.}
+
+\item{omitted_footer}{Footer that is only printed if anything
+is omitted from the printout. If a function, then it will be called,
+otherwise printed using \code{cat}.}
+
+\item{...}{Extra arguments to pass to \code{print()}.}
+}
+\value{
+\code{x}, invisibly.
+}
+\description{
+Print the only the head of an R object
+}
diff --git a/man/hrg-methods.Rd b/man/hrg-methods.Rd
index 74ebccf..cb9bb65 100644
--- a/man/hrg-methods.Rd
+++ b/man/hrg-methods.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{hrg-methods}
\alias{hrg-methods}
@@ -28,12 +28,8 @@ Aaron Clauset, at his website (not functional any more).
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg.game}},
- \code{\link{sample_hrg}}; \code{\link{hrg.predict}},
- \code{\link{predict_edges}}; \code{\link{hrg_tree}};
- \code{\link{hrg}}, \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}};
- \code{\link{print.igraphHRG}}
+ \code{\link{fit_hrg}}, \code{\link{hrg_tree}},
+ \code{\link{hrg}}, \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/hrg.Rd b/man/hrg.Rd
index 88b4a03..8e5c2b8 100644
--- a/man/hrg.Rd
+++ b/man/hrg.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{hrg}
\alias{hrg}
@@ -24,12 +24,8 @@ for each vertex; these are ignored for leaf vertices.
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg_tree}};
- \code{\link{print.igraphHRGConsensus}};
- \code{\link{print.igraphHRG}}
+ \code{\link{fit_hrg}}, \code{\link{hrg-methods}},
+ \code{\link{hrg_tree}}, \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/hrg_tree.Rd b/man/hrg_tree.Rd
index 4e2b4d3..e5e22b0 100644
--- a/man/hrg_tree.Rd
+++ b/man/hrg_tree.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{hrg_tree}
\alias{hrg_tree}
@@ -18,12 +18,8 @@ random graph model.
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg}}, \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}};
- \code{\link{print.igraphHRG}}
+ \code{\link{fit_hrg}}, \code{\link{hrg-methods}},
+ \code{\link{hrg}}, \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/hub_score.Rd b/man/hub_score.Rd
index afb999b..158addc 100644
--- a/man/hub_score.Rd
+++ b/man/hub_score.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{hub_score}
-\alias{hub.score}
\alias{hub_score}
+\alias{hub.score}
\title{Kleinberg's hub centrality scores.}
\usage{
hub_score(graph, scale = TRUE, weights = NULL, options = arpack_defaults)
@@ -16,7 +16,10 @@ in the Euclidean norm.}
\item{weights}{Optional positive weight vector for calculating weighted
scores. If the graph has a \code{weight} edge attribute, then this is used
-by default.}
+by default.
+This function interprets edge weights as connection strengths. In the
+random surfer model, an edge with a larger weight is more likely to be
+selected by the surfer.}
\item{options}{A named list, to override some ARPACK options. See
\code{\link{arpack}} for details.}
@@ -27,7 +30,7 @@ A named list with members:
\item{value}{The corresponding eigenvalue of the calculated
principal eigenvector.}
\item{options}{Some information about the ARPACK computation, it has
- the same members as the \code{options} member returned
+ the same members as the \code{options} member returned
by \code{\link{arpack}}, see that for documentation.}
}
\description{
@@ -61,4 +64,3 @@ as IBM Research Report RJ 10076, May 1997.
\code{\link{page_rank}} for the Page Rank scores. \code{\link{arpack}} for
the underlining machinery of the computation.
}
-
diff --git a/man/identical_graphs.Rd b/man/identical_graphs.Rd
index 6a35a91..84f2305 100644
--- a/man/identical_graphs.Rd
+++ b/man/identical_graphs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{identical_graphs}
\alias{identical_graphs}
@@ -7,7 +7,7 @@
identical_graphs(g1, g2)
}
\arguments{
-\item{g1,g2}{The two graphs}
+\item{g1, g2}{The two graphs}
}
\value{
Logical scalar
@@ -17,4 +17,3 @@ This is similar to \code{identical} in the \code{base} package,
but ignores the mutable piece of igraph objects, that might be
different, even if the two graphs are identical.
}
-
diff --git a/man/igraph-attribute-combination.Rd b/man/igraph-attribute-combination.Rd
index 3891c8b..7e755c7 100644
--- a/man/igraph-attribute-combination.Rd
+++ b/man/igraph-attribute-combination.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{igraph-attribute-combination}
-\alias{attribute.combination}
\alias{igraph-attribute-combination}
+\alias{attribute.combination}
\title{How igraph functions handle attributes when the graph changes}
\description{
Many times, when the structure of a graph is modified, vertices/edges map of
@@ -69,7 +69,9 @@ Calls the R \code{median} function for all attribute types.}
\item{"concat"}{Concatenate the attributes, using the \code{c}
function. This results almost always a complex attribute.} }
}
+
\examples{
+
g <- graph( c(1,2, 1,2, 1,2, 2,3, 3,4) )
E(g)$weight <- 1:5
@@ -97,13 +99,12 @@ simplify(g, edge.attr.comb=toString)
simplify(g, edge.attr.comb=list(weight=function(x) length(x)/sum(1/x),
name="ignore"))
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{graph_attr}}, \code{\link{vertex_attr}},
\code{\link{edge_attr}} on how to use graph/vertex/edge attributes in
general. \code{\link{igraph_options}} on igraph parameters.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/igraph-dollar.Rd b/man/igraph-dollar.Rd
index 121b6fe..46f1eb9 100644
--- a/man/igraph-dollar.Rd
+++ b/man/igraph-dollar.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{igraph-dollar}
+\alias{igraph-dollar}
\alias{$.igraph}
-\alias{$<-.igraph}
\alias{igraph-dollar}
+\alias{$<-.igraph}
\title{Getting and setting graph attributes, shortcut}
\usage{
\method{$}{igraph}(x, name)
@@ -29,45 +30,17 @@ g$name <- "10-ring"
g$name
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/igraph-es-attributes.Rd b/man/igraph-es-attributes.Rd
index e8bd6bf..a6a5f97 100644
--- a/man/igraph-es-attributes.Rd
+++ b/man/igraph-es-attributes.Rd
@@ -1,12 +1,16 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{igraph-es-attributes}
+\alias{igraph-es-attributes}
+\alias{[[<-.igraph.es}
+\alias{igraph-es-attributes}
+\alias{[<-.igraph.es}
+\alias{igraph-es-attributes}
\alias{$.igraph.es}
+\alias{igraph-es-attributes}
\alias{$<-.igraph.es}
-\alias{E<-}
-\alias{[<-.igraph.es}
-\alias{[[<-.igraph.es}
\alias{igraph-es-attributes}
+\alias{E<-}
\title{Query or set attributes of the edges in an edge sequence}
\usage{
\method{[[}{igraph.es}(x, i) <- value
@@ -72,46 +76,21 @@ E(g)[giant_v \%--\% giant_v]$color <- "blue"
plot(g)
}
\seealso{
-Other vertex and edge sequences: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
-Other vertex and edge sequences: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
}
-
diff --git a/man/igraph-es-indexing.Rd b/man/igraph-es-indexing.Rd
index f3814ed..aadff32 100644
--- a/man/igraph-es-indexing.Rd
+++ b/man/igraph-es-indexing.Rd
@@ -1,11 +1,11 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{igraph-es-indexing}
+\alias{igraph-es-indexing}
\alias{[.igraph.es}
\alias{\%--\%}
-\alias{\%->\%}
\alias{\%<-\%}
-\alias{igraph-es-indexing}
+\alias{\%->\%}
\title{Indexing edge sequences}
\usage{
\method{[}{igraph.es}(x, ...)
@@ -26,8 +26,8 @@ with some extras.
When using multiple indices within the bracket, all of them
are evaluated independently, and then the results are concatenated
-using the \code{c()} function. E.g. \code{E(g)[1, 2, inc(1)]}
-is equivalent to \code{c(E(g)[1], E(g)[2], E(g)[inc(1)])}.
+using the \code{c()} function. E.g. \code{E(g)[1, 2, .inc(1)]}
+is equivalent to \code{c(E(g)[1], E(g)[2], E(g)[.inc(1)])}.
}
\section{Index types}{
@@ -67,12 +67,12 @@ than one weight. See more examples below.
There are some special igraph functions that can be used
only in expressions indexing edge sequences: \describe{
- \item{\code{inc}}{takes a vertex sequence, and selects
+ \item{\code{.inc}}{takes a vertex sequence, and selects
all edges that have at least one incident vertex in the vertex
sequence.}
- \item{\code{from}}{similar to \code{inc()}, but only
+ \item{\code{.from}}{similar to \code{.inc()}, but only
the tails of the edges are considered.}
- \item{\code{to}}{is similar to \code{inc()}, but only
+ \item{\code{.to}}{is similar to \code{.inc()}, but only
the heads of the edges are considered.}
\item{\code{\%--\%}}{a special operator that can be
used to select all edges between two sets of vertices. It ignores
@@ -90,6 +90,7 @@ Note that multiple special functions can be used together, or with
regular indices, and then their results are concatenated. See more
examples below.
}
+
\examples{
# special operators for indexing based on graph structure
g <- sample_pa(100, power = 0.3)
@@ -108,47 +109,27 @@ g <- sample_gnp(20, 3/20) \%>\%
E(g)[[ weight < 0 ]]
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
- \code{\link{unique.igraph.vs}}
-
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing2}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
-}
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
+ \code{\link{unique.igraph.vs}}
+}
diff --git a/man/igraph-es-indexing2.Rd b/man/igraph-es-indexing2.Rd
index 355ae45..2b6a5f1 100644
--- a/man/igraph-es-indexing2.Rd
+++ b/man/igraph-es-indexing2.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{igraph-es-indexing2}
-\alias{[[.igraph.es}
\alias{igraph-es-indexing2}
+\alias{[[.igraph.es}
\title{Select edges and show their metadata}
\usage{
\method{[[}{igraph.es}(x, ...)
@@ -34,52 +34,30 @@ g <- make_(ring(10),
with_edge_(weight = 1:10, color = "green"))
E(g)
E(g)[[]]
-E(g)[[inc('A')]]
+E(g)[[.inc('A')]]
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
- \code{\link{unique.igraph.vs}}
-
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
-}
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
+ \code{\link{unique.igraph.vs}}
+}
diff --git a/man/igraph-minus.Rd b/man/igraph-minus.Rd
index fa25d0e..5e49d2e 100644
--- a/man/igraph-minus.Rd
+++ b/man/igraph-minus.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{igraph-minus}
-\alias{-.igraph}
\alias{igraph-minus}
+\alias{-.igraph}
\title{Delete vertices or edges from a graph}
\usage{
\method{-}{igraph}(e1, e2)
@@ -57,13 +57,9 @@ g <- g - path("a", "b", "c", "d")}
}
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{path}};
- \code{\link{vertex}}, \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{add_vertices}},
+ \code{\link{delete_edges}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{path}}, \code{\link{vertex}}
}
-
diff --git a/man/igraph-vs-attributes.Rd b/man/igraph-vs-attributes.Rd
index 9aa6127..82caaa9 100644
--- a/man/igraph-vs-attributes.Rd
+++ b/man/igraph-vs-attributes.Rd
@@ -1,12 +1,16 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{igraph-vs-attributes}
+\alias{igraph-vs-attributes}
+\alias{[[<-.igraph.vs}
+\alias{igraph-vs-attributes}
+\alias{[<-.igraph.vs}
+\alias{igraph-vs-attributes}
\alias{$.igraph.vs}
+\alias{igraph-vs-attributes}
\alias{$<-.igraph.vs}
-\alias{V<-}
-\alias{[<-.igraph.vs}
-\alias{[[<-.igraph.vs}
\alias{igraph-vs-attributes}
+\alias{V<-}
\title{Query or set attributes of the vertices in a vertex sequence}
\usage{
\method{[[}{igraph.vs}(x, i) <- value
@@ -25,7 +29,7 @@ V(x) <- value
\item{i}{Index.}
\item{value}{New value of the attribute, for the vertices in the
- vertex sequence.}
+vertex sequence.}
\item{name}{Name of the vertex attribute to query or set.}
}
@@ -74,60 +78,25 @@ V(g)[giant_v]$color <- "orange"
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph}},
- \code{\link{$<-.igraph}}, \code{\link{igraph-dollar}},
- \code{\link{igraph-dollar}}; \code{\link{attributes}},
- \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
+ \code{\link{print.igraph.vs}}
+
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
-
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
- \code{\link{print.igraph.vs}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}}, \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/igraph-vs-indexing.Rd b/man/igraph-vs-indexing.Rd
index efd4854..f114466 100644
--- a/man/igraph-vs-indexing.Rd
+++ b/man/igraph-vs-indexing.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{igraph-vs-indexing}
-\alias{[.igraph.vs}
\alias{igraph-vs-indexing}
+\alias{[.igraph.vs}
\title{Indexing vertex sequences}
\usage{
\method{[}{igraph.vs}(x, ..., na_ok = FALSE)
@@ -33,8 +33,8 @@ marks the result for printing vertex attributes.
When using multiple indices within the bracket, all of them
are evaluated independently, and then the results are concatenated
using the \code{c()} function (except for the \code{na_ok} argument,
-which is special an must be named. E.g. \code{V(g)[1, 2, nei(1)]}
-is equivalent to \code{c(V(g)[1], V(g)[2], V(g)[nei(1)])}.
+which is special an must be named. E.g. \code{V(g)[1, 2, .nei(1)]}
+is equivalent to \code{c(V(g)[1], V(g)[2], V(g)[.nei(1)])}.
}
\section{Index types}{
@@ -68,26 +68,27 @@ attribute, then \code{V(g)[name == "foo"]} is equivalent to
There are some special igraph functions that can be used only
in expressions indexing vertex sequences: \describe{
- \item{\code{nei}}{takes a vertex sequence as its argument
+ \item{\code{.nei}}{takes a vertex sequence as its argument
and selects neighbors of these vertices. An optional \code{mode}
argument can be used to select successors (\code{mode="out"}), or
precedessors (\code{mode="in"}) in directed graphs.}
- \item{\code{inc}}{Takes an edge sequence as an argument, and
+ \item{\code{.inc}}{Takes an edge sequence as an argument, and
selects vertices that have at least one incident edge in this
edge sequence.}
- \item{\code{from}}{Similar to \code{inc}, but only considers the
+ \item{\code{.from}}{Similar to \code{.inc}, but only considers the
tails of the edges.}
- \item{\code{to}}{Similar to \code{inc}, but only considers the
+ \item{\code{.to}}{Similar to \code{.inc}, but only considers the
heads of the edges.}
- \item{\code{innei}, \code{outnei}}{\code{innei(v)} is a shorthand for
- \code{nei(v, mode = "in")}, and \code{outnei(v)} is a shorthand for
- \code{nei(v, mode = "out")}.
+ \item{\code{.innei}, \code{.outnei}}{\code{.innei(v)} is a shorthand for
+ \code{.nei(v, mode = "in")}, and \code{.outnei(v)} is a shorthand for
+ \code{.nei(v, mode = "out")}.
}
}
Note that multiple special functions can be used together, or with
regular indices, and then their results are concatenated. See more
examples below.
}
+
\examples{
# -----------------------------------------------------------------
# Setting attributes for subsets of vertices
@@ -107,61 +108,39 @@ plot(g)
# -----------------------------------------------------------------
# nei() special function
g <- graph( c(1,2, 2,3, 2,4, 4,2) )
-V(g)[ nei( c(2,4) ) ]
-V(g)[ nei( c(2,4), "in") ]
-V(g)[ nei( c(2,4), "out") ]
+V(g)[ .nei( c(2,4) ) ]
+V(g)[ .nei( c(2,4), "in") ]
+V(g)[ .nei( c(2,4), "out") ]
# -----------------------------------------------------------------
# The same with vertex names
g <- graph(~ A -+ B, B -+ C:D, D -+ B)
-V(g)[ nei( c('B', 'D') ) ]
-V(g)[ nei( c('B', 'D'), "in" ) ]
-V(g)[ nei( c('B', 'D'), "out" ) ]
+V(g)[ .nei( c('B', 'D') ) ]
+V(g)[ .nei( c('B', 'D'), "in" ) ]
+V(g)[ .nei( c('B', 'D'), "out" ) ]
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
- \code{\link{unique.igraph.vs}}
-
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
-}
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
+ \code{\link{unique.igraph.vs}}
+}
diff --git a/man/igraph-vs-indexing2.Rd b/man/igraph-vs-indexing2.Rd
index 76436d2..3748eb0 100644
--- a/man/igraph-vs-indexing2.Rd
+++ b/man/igraph-vs-indexing2.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{igraph-vs-indexing2}
-\alias{[[.igraph.vs}
\alias{igraph-vs-indexing2}
+\alias{[[.igraph.vs}
\title{Select vertices and show their metadata}
\usage{
\method{[[}{igraph.vs}(x, ...)
@@ -38,49 +38,27 @@ V(g)[1:5]
V(g)[[1:5]]
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
- \code{\link{unique.igraph.vs}}
-
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{print.igraph.es}};
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{print.igraph.es}},
\code{\link{print.igraph.vs}}
-}
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
+ \code{\link{unique.igraph.vs}}
+}
diff --git a/man/igraph_demo.Rd b/man/igraph_demo.Rd
index ac941f9..eb190fb 100644
--- a/man/igraph_demo.Rd
+++ b/man/igraph_demo.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/demo.R
\name{igraph_demo}
\alias{igraph_demo}
@@ -27,16 +27,17 @@ chunk, with the possibility of inspecting the workspace between two chunks.
The \code{tcltk} package is needed for \code{igraph_demo}.
}
\examples{
+
igraph_demo()
if (interactive()) {
igraph_demo("centrality")
}
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{demo}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/igraph_options.Rd b/man/igraph_options.Rd
index bc2154f..bbdc6e0 100644
--- a/man/igraph_options.Rd
+++ b/man/igraph_options.Rd
@@ -1,10 +1,11 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/par.R
\name{igraph_options}
-\alias{getIgraphOpt}
+\alias{igraph_options}
\alias{igraph.options}
+\alias{getIgraphOpt}
+\alias{igraph_opt}
\alias{igraph_opt}
-\alias{igraph_options}
\title{Parameters for the igraph package}
\usage{
igraph_options(...)
@@ -12,20 +13,20 @@ igraph_options(...)
igraph_opt(x, default = NULL)
}
\arguments{
+\item{\dots}{A list may be given as the only argument, or any number of
+arguments may be in the \code{name=value} form, or no argument at all may be
+given. See the Value and Details sections for explanation.}
+
\item{x}{A character string holding an option name.}
\item{default}{If the specified option is not set in the options list, this
value is returned. This facilitates retrieving an option and checking
whether it is set and setting it separately if not.}
-
-\item{\dots}{A list may be given as the only argument, or any number of
-arguments may be in the \code{name=value} form, or no argument at all may be
-given. See the Value and Details sections for explanation.}
}
\value{
-\code{igraph_options} returns a list with the updated values of the
-parameters. If the argument list is not empty, the returned list is
-invisible.
+\code{igraph_options} returns a list with the old values of the
+updated parameters, invisibly. Without any arguments, it returns the
+values of all options.
For \code{igraph_opt}, the current value set for option \code{x}, or
\code{NULL} if the option is unset.
@@ -76,6 +77,12 @@ The currently used parameters in alphabetical order:
graph attributes when printing graphs. Defaults to \code{FALSE}.}
\item{print.vertex.attributes}{Logical constant, whether to print
vertex attributes when printing graphs. Defaults to \code{FALSE}.}
+ \item{return.vs.es}{Whether functions that return a set or sequence
+ of vertices/edges should return formal vertex/edge sequence
+ objects. This option was introduced in igraph version 1.0.0 and
+ defaults to TRUE. If your package requires the old behavior,
+ you can set it to FALSE in the \code{.onLoad} function of
+ your package, without affecting other packages.}
\item{sparsematrices}{Whether to use the \code{Matrix} package for
(sparse) matrices. It is recommended, if the user works with
larger graphs.}
@@ -89,18 +96,25 @@ The currently used parameters in alphabetical order:
}
}
\examples{
+
oldval <- igraph_opt("verbose")
-igraph_options(verbose=TRUE)
+igraph_options(verbose = TRUE)
layout_with_kk(make_ring(10))
-igraph_options(verbose=oldval)
-#'
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+igraph_options(verbose = oldval)
+
+oldval <- igraph_options(verbose = TRUE, sparsematrices = FALSE)
+make_ring(10)[]
+igraph_options(oldval)
+igraph_opt("verbose")
+
}
\seealso{
\code{igraph_options} is similar to \code{\link{options}} and
\code{igraph_opt} is similar to \code{\link{getOption}}.
+
+Other igraph options: \code{\link{with_igraph_opt}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/igraph_test.Rd b/man/igraph_test.Rd
index a622bb6..ebdf105 100644
--- a/man/igraph_test.Rd
+++ b/man/igraph_test.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test.R
\name{igraph_test}
\alias{igraph_test}
@@ -26,4 +26,3 @@ This function simply calls the \code{test_dir} function from the
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/igraph_version.Rd b/man/igraph_version.Rd
index 50b25b9..766a8e3 100644
--- a/man/igraph_version.Rd
+++ b/man/igraph_version.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test.R
\name{igraph_version}
-\alias{igraph.version}
\alias{igraph_version}
+\alias{igraph.version}
\title{Query igraph's version string}
\usage{
igraph_version()
@@ -23,6 +23,7 @@ enough to cover in-between releases versions, e.g. alpha and beta versions,
release candidates, etc.
}
\examples{
+
## Compare to the package version
packageDescription("igraph")$Version
igraph_version()
@@ -31,4 +32,3 @@ igraph_version()
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/incident.Rd b/man/incident.Rd
index d214833..31ff0cd 100644
--- a/man/incident.Rd
+++ b/man/incident.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{incident}
\alias{incident}
@@ -28,15 +28,11 @@ incident(g, 1)
incident(g, 34)
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{is.directed}}, \code{\link{is_directed}};
- \code{\link{neighbors}}; \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident_edges}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/incident_edges.Rd b/man/incident_edges.Rd
index 9477340..7d66e58 100644
--- a/man/incident_edges.Rd
+++ b/man/incident_edges.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{incident_edges}
\alias{incident_edges}
@@ -27,15 +27,11 @@ g <- make_graph("Zachary")
incident_edges(g, c(1, 34))
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident}};
- \code{\link{is.directed}}, \code{\link{is_directed}};
- \code{\link{neighbors}}; \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident}}, \code{\link{is_directed}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/indent_print.Rd b/man/indent_print.Rd
new file mode 100644
index 0000000..b4c8dab
--- /dev/null
+++ b/man/indent_print.Rd
@@ -0,0 +1,21 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/printr.R
+\name{indent_print}
+\alias{indent_print}
+\title{Indent a printout}
+\usage{
+indent_print(..., .indent = " ", .printer = print)
+}
+\arguments{
+\item{...}{Passed to the printing function.}
+
+\item{.indent}{Character scalar, indent the printout with this.}
+
+\item{.printer}{The printing function, defaults to \code{print}.}
+}
+\value{
+The first element in \code{...}, invisibly.
+}
+\description{
+Indent a printout
+}
diff --git a/man/intersection.Rd b/man/intersection.Rd
index 994979a..0add07d 100644
--- a/man/intersection.Rd
+++ b/man/intersection.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{intersection}
\alias{intersection}
@@ -21,4 +21,3 @@ sequences. See
\code{\link{intersection.igraph}}, and
\code{\link{intersection.igraph.vs}}.
}
-
diff --git a/man/intersection.igraph.Rd b/man/intersection.igraph.Rd
index ee7b401..8849ff9 100644
--- a/man/intersection.igraph.Rd
+++ b/man/intersection.igraph.Rd
@@ -1,15 +1,17 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{intersection.igraph}
-\alias{\%s\%}
-\alias{graph.intersection}
\alias{intersection.igraph}
+\alias{graph.intersection}
+\alias{\%s\%}
\title{Intersection of graphs}
\usage{
\method{intersection}{igraph}(..., byname = "auto",
keep.all.vertices = TRUE)
}
\arguments{
+\item{\dots}{Graph objects or lists of graph objects.}
+
\item{byname}{A logical scalar, or the character scalar \code{auto}. Whether
to perform the operation based on symbolic vertex names. If it is
\code{auto}, that means \code{TRUE} if all graphs are named and \code{FALSE}
@@ -18,8 +20,6 @@ graphs are named.}
\item{keep.all.vertices}{Logical scalar, whether to keep vertices that only
appear in a subset of the input graphs.}
-
-\item{\dots}{Graph objects or lists of graph objects.}
}
\value{
A new graph object.
@@ -50,14 +50,14 @@ An error is generated if some input graphs are directed and others are
undirected.
}
\examples{
+
## Common part of two social networks
net1 <- graph_from_literal(D-A:B:F:G, A-C-F-A, B-E-G-B, A-B, F-G,
H-F:G, H-I-J)
net2 <- graph_from_literal(D-A:F:Y, B-A-X-F-H-Z, F-Y)
-str(net1 \%s\% net2)
+print_all(net1 \%s\% net2)
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/intersection.igraph.es.Rd b/man/intersection.igraph.es.Rd
index 70b8cf0..0ef066d 100644
--- a/man/intersection.igraph.es.Rd
+++ b/man/intersection.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{intersection.igraph.es}
\alias{intersection.igraph.es}
@@ -26,23 +26,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
intersection(E(g)[1:6], E(g)[5:9])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/intersection.igraph.vs.Rd b/man/intersection.igraph.vs.Rd
index 0d786d5..dfb8eaa 100644
--- a/man/intersection.igraph.vs.Rd
+++ b/man/intersection.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{intersection.igraph.vs}
\alias{intersection.igraph.vs}
@@ -26,23 +26,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
intersection(E(g)[1:6], E(g)[5:9])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/is_chordal.Rd b/man/is_chordal.Rd
index 0506795..495af8e 100644
--- a/man/is_chordal.Rd
+++ b/man/is_chordal.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/decomposition.R
\name{is_chordal}
-\alias{is.chordal}
\alias{is_chordal}
+\alias{is.chordal}
\title{Chordality of a graph}
\usage{
is_chordal(graph, alpha = NULL, alpham1 = NULL, fillin = FALSE,
@@ -48,6 +48,7 @@ The set of fill-in edges is empty if and only if the graph is chordal.
It is also true that adding the fill-in edges to the graph makes it chordal.
}
\examples{
+
## The examples from the Tarjan-Yannakakis paper
g1 <- graph_from_literal(A-B:C:I, B-A:C:D, C-A:B:E:H, D-B:E:F,
E-C:D:F:H, F-D:E:G, G-F:H, H-C:E:G:I,
@@ -60,9 +61,7 @@ g2 <- graph_from_literal(A-B:E, B-A:E:F:D, C-E:D:G, D-B:F:E:C:G,
I-G:H:J, J-H:I)
max_cardinality(g2)
is_chordal(g2, fillin=TRUE)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Robert E Tarjan and Mihalis Yannakakis. (1984). Simple
@@ -73,5 +72,7 @@ of Computation} 13, 566--579.
\seealso{
\code{\link{max_cardinality}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/is_dag.Rd b/man/is_dag.Rd
index 7b14215..9e909f2 100644
--- a/man/is_dag.Rd
+++ b/man/is_dag.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{is_dag}
-\alias{is.dag}
\alias{is_dag}
+\alias{is.dag}
\title{Directed acyclic graphs}
\usage{
is_dag(graph)
@@ -23,6 +23,7 @@ graph.
the graph is a DAG.
}
\examples{
+
g <- make_tree(10)
is_dag(g)
g2 <- g + edge(5,1)
@@ -33,4 +34,3 @@ Tamas Nepusz \email{ntamas at gmail.com} for the C code, Gabor Csardi
\email{csardi.gabor at gmail.com} for the R interface.
}
\keyword{graphs}
-
diff --git a/man/is_degseq.Rd b/man/is_degseq.Rd
index a23cf2a..e76dac3 100644
--- a/man/is_degseq.Rd
+++ b/man/is_degseq.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/degseq.R
\name{is_degseq}
-\alias{is.degree.sequence}
\alias{is_degseq}
+\alias{is.degree.sequence}
\title{Check if a degree sequence is valid for a multi-graph}
\usage{
is_degseq(out.deg, in.deg = NULL)
@@ -26,9 +26,6 @@ For directed graphs, the function checks whether the lengths of the two
degree vectors are equal and whether their sums are also equal. These are
known sufficient and necessary conditions for a degree sequence to be valid.
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\references{
Hakimi SL: On the realizability of a set of integers as degrees
of the vertices of a simple graph. \emph{J SIAM Appl Math} 10:496-506, 1962.
@@ -42,8 +39,9 @@ Other graphical degree sequences
g <- sample_gnp(100, 2/100)
is_degseq(degree(g))
-is_graphical(degree(g)): \code{\link{is.graphical.degree.sequence}},
- \code{\link{is_graphical}}
+is_graphical(degree(g)): \code{\link{is_graphical}}
+}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/is_directed.Rd b/man/is_directed.Rd
index 80512d9..cfacd3b 100644
--- a/man/is_directed.Rd
+++ b/man/is_directed.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{is_directed}
-\alias{is.directed}
\alias{is_directed}
+\alias{is.directed}
\title{Check whether a graph is directed}
\usage{
is_directed(graph)
@@ -24,15 +24,11 @@ g2 <- make_ring(10, directed = TRUE)
is_directed(g2)
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{neighbors}};
- \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident_edges}}, \code{\link{incident}},
+ \code{\link{neighbors}}, \code{\link{tail_of}}
}
-
diff --git a/man/is_graphical.Rd b/man/is_graphical.Rd
index 51963c2..90870e3 100644
--- a/man/is_graphical.Rd
+++ b/man/is_graphical.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/degseq.R
\name{is_graphical}
-\alias{is.graphical.degree.sequence}
\alias{is_graphical}
+\alias{is.graphical.degree.sequence}
\title{Is a degree sequence graphical?}
\usage{
is_graphical(out.deg, in.deg = NULL)
@@ -22,9 +22,6 @@ Determine whether the given vertex degrees (in- and out-degrees for
directed graphs) can be reliazed in a simple graph, i.e. a graph without
multiple or loop edges.
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\references{
Hakimi SL: On the realizability of a set of integers as degrees
of the vertices of a simple graph. \emph{J SIAM Appl Math} 10:496-506, 1962.
@@ -38,8 +35,9 @@ Other graphical degree sequences
g <- sample_gnp(100, 2/100)
is_degseq(degree(g))
-is_graphical(degree(g)): \code{\link{is.degree.sequence}},
- \code{\link{is_degseq}}
+is_graphical(degree(g)): \code{\link{is_degseq}}
+}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/is_igraph.Rd b/man/is_igraph.Rd
index 079382f..a606e21 100644
--- a/man/is_igraph.Rd
+++ b/man/is_igraph.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/basic.R
\name{is_igraph}
-\alias{is.igraph}
\alias{is_igraph}
+\alias{is.igraph}
\title{Is this object an igraph graph?}
\usage{
is_igraph(graph)
@@ -18,6 +18,7 @@ object.
Is this object an igraph graph?
}
\examples{
+
g <- make_ring(10)
is_igraph(g)
is_igraph(numeric(10))
@@ -26,4 +27,3 @@ is_igraph(numeric(10))
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/is_min_separator.Rd b/man/is_min_separator.Rd
index 2e68836..1d08065 100644
--- a/man/is_min_separator.Rd
+++ b/man/is_min_separator.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{is_min_separator}
-\alias{is.minimal.separator}
\alias{is_min_separator}
+\alias{is.minimal.separator}
\title{Minumal vertex separators}
\usage{
is_min_separator(graph, candidate)
@@ -55,9 +55,9 @@ check.sep(mw2)
check.sep(mw3)
check.sep(mw4)
check.sep(mw5)
+
}
\seealso{
\code{\link{min_separators}} lists all vertex separator of minimum
size.
}
-
diff --git a/man/is_named.Rd b/man/is_named.Rd
index 3fec0d7..0709630 100644
--- a/man/is_named.Rd
+++ b/man/is_named.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{is_named}
-\alias{is.named}
\alias{is_named}
+\alias{is.named}
\title{Named graphs}
\usage{
is_named(graph)
@@ -31,14 +31,15 @@ igraph, you have to check that for yourself, when assigning the vertex
names.
}
\examples{
+
g <- make_ring(10)
is_named(g)
V(g)$name <- letters[1:10]
is_named(g)
neighbors(g, "a")
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/is_printer_callback.Rd b/man/is_printer_callback.Rd
new file mode 100644
index 0000000..69c3f0e
--- /dev/null
+++ b/man/is_printer_callback.Rd
@@ -0,0 +1,17 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/printr.R
+\name{is_printer_callback}
+\alias{is_printer_callback}
+\title{Is this a printer callback?}
+\usage{
+is_printer_callback(x)
+}
+\arguments{
+\item{x}{An R object.}
+}
+\description{
+Is this a printer callback?
+}
+\seealso{
+Other printer callbacks: \code{\link{printer_callback}}
+}
diff --git a/man/is_separator.Rd b/man/is_separator.Rd
index 5600bcc..e34460b 100644
--- a/man/is_separator.Rd
+++ b/man/is_separator.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{is_separator}
-\alias{is.separator}
\alias{is_separator}
+\alias{is.separator}
\title{Vertex separators}
\usage{
is_separator(graph, candidate)
@@ -33,4 +33,3 @@ set of \eqn{n-1} vertices is considered to be a vertex separator.
\code{\link{is_min_separator}}, \code{\link{min_separators}}
lists all vertex separator of minimum size.
}
-
diff --git a/man/is_weighted.Rd b/man/is_weighted.Rd
index 3d8b31c..cbf9e15 100644
--- a/man/is_weighted.Rd
+++ b/man/is_weighted.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{is_weighted}
-\alias{is.weighted}
\alias{is_weighted}
+\alias{is.weighted}
\title{Weighted graphs}
\usage{
is_weighted(graph)
@@ -30,13 +30,14 @@ vertices, etc. Check the manual pages of the functions working with weighted
graphs for details.
}
\examples{
+
g <- make_ring(10)
shortest_paths(g, 8, 2)
E(g)$weight <- seq_len(ecount(g))
shortest_paths(g, 8, 2)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/isomorphic.Rd b/man/isomorphic.Rd
index d279686..3076e7e 100644
--- a/man/isomorphic.Rd
+++ b/man/isomorphic.Rd
@@ -1,12 +1,12 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{isomorphic}
+\alias{isomorphic}
\alias{graph.isomorphic}
\alias{graph.isomorphic.34}
-\alias{graph.isomorphic.bliss}
\alias{graph.isomorphic.vf2}
+\alias{graph.isomorphic.bliss}
\alias{is_isomorphic_to}
-\alias{isomorphic}
\title{Decide if two graphs are isomorphic}
\usage{
isomorphic(graph1, graph2, method = c("auto", "direct", "vf2", "bliss"), ...)
@@ -91,6 +91,7 @@ Extra arguments:
}
\code{sh1} and \code{sh2} default to \sQuote{fm}.
}
+
\examples{
# create some non-isomorphic graphs
g1 <- graph_from_isomorphism_class(3, 10)
@@ -130,21 +131,10 @@ Tommi Junttila and Petteri Kaski: Engineering an Efficient Canonical
}
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
\code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
- \code{\link{subgraph_isomorphic}}
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphism_class}},
+ \code{\link{isomorphisms}},
+ \code{\link{subgraph_isomorphic}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/isomorphism_class.Rd b/man/isomorphism_class.Rd
index ac05cf8..772d6f5 100644
--- a/man/isomorphism_class.Rd
+++ b/man/isomorphism_class.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{isomorphism_class}
+\alias{isomorphism_class}
\alias{graph.isoclass}
\alias{graph.isoclass.subgraph}
-\alias{isomorphism_class}
\title{Isomorphism class of a graph}
\usage{
isomorphism_class(graph, v)
@@ -34,23 +34,9 @@ isomorphic(g1, g2)
}
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
\code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
- \code{\link{subgraph_isomorphic}}
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphic}}, \code{\link{isomorphisms}},
+ \code{\link{subgraph_isomorphic}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/isomorphisms.Rd b/man/isomorphisms.Rd
index 41bad4b..e4d767a 100644
--- a/man/isomorphisms.Rd
+++ b/man/isomorphisms.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{isomorphisms}
-\alias{graph.get.isomorphisms.vf2}
\alias{isomorphisms}
+\alias{graph.get.isomorphisms.vf2}
\title{Calculate all isomorphic mappings between the vertices of two graphs}
\usage{
isomorphisms(graph1, graph2, method = "vf2", ...)
@@ -26,24 +26,10 @@ Calculate all isomorphic mappings between the vertices of two graphs
}
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
\code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
- \code{\link{subgraph_isomorphic}}
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphic}},
+ \code{\link{isomorphism_class}},
+ \code{\link{subgraph_isomorphic}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/ivs.Rd b/man/ivs.Rd
index 9ac22be..797d5a5 100644
--- a/man/ivs.Rd
+++ b/man/ivs.Rd
@@ -1,13 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/cliques.R
\name{ivs}
-\alias{independence.number}
-\alias{independent.vertex.sets}
\alias{ivs}
-\alias{ivs_size}
+\alias{independent.vertex.sets}
\alias{largest.independent.vertex.sets}
-\alias{largest_ivs}
\alias{maximal.independent.vertex.sets}
+\alias{independence.number}
+\alias{ivs_size}
+\alias{largest_ivs}
\alias{maximal_ivs}
\title{Independent vertex sets}
\usage{
@@ -57,6 +57,7 @@ These functions use the algorithm described by Tsukiyama et al., see
reference below.
}
\examples{
+
# Do not run, takes a couple of seconds
\dontrun{
@@ -72,12 +73,6 @@ induced_subgraph(g, largest_ivs(g)[[1]])
length(maximal_ivs(g))
}
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} ported it from the Very Nauty
-Graph Library by Keith Briggs (\url{http://keithbriggs.info/}) and Gabor
-Csardi \email{csardi.gabor at gmail.com} wrote the R interface and this manual
-page.
-}
\references{
S. Tsukiyama, M. Ide, H. Ariyoshi and I. Shirawaka. A new
algorithm for generating all the maximal independent sets. \emph{SIAM J
@@ -86,5 +81,10 @@ Computing}, 6:505--517, 1977.
\seealso{
\code{\link{cliques}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} ported it from the Very Nauty
+Graph Library by Keith Briggs (\url{http://keithbriggs.info/}) and Gabor
+Csardi \email{csardi.gabor at gmail.com} wrote the R interface and this manual
+page.
+}
\keyword{graphs}
-
diff --git a/man/keeping_degseq.Rd b/man/keeping_degseq.Rd
index e15a21b..919fdff 100644
--- a/man/keeping_degseq.Rd
+++ b/man/keeping_degseq.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rewire.R
\name{keeping_degseq}
\alias{keeping_degseq}
@@ -27,17 +27,16 @@ g <- make_ring(10)
g \%>\%
rewire(keeping_degseq(niter = 20)) \%>\%
degree()
-str(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com}
+print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
}
\seealso{
\code{\link{sample_degseq}}
-Other rewiring functions: \code{\link{each_edge}};
+Other rewiring functions: \code{\link{each_edge}},
\code{\link{rewire}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/knn.Rd b/man/knn.Rd
index aa41d62..4252558 100644
--- a/man/knn.Rd
+++ b/man/knn.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{knn}
-\alias{graph.knn}
\alias{knn}
+\alias{graph.knn}
\title{Average nearest neighbor degree}
\usage{
knn(graph, vids = V(graph), weights = NULL)
@@ -20,7 +20,9 @@ on the given vertices only.}
attribute, then this is used by default. If this argument is given, then
vertex strength (see \code{\link{strength}}) is used instead of vertex
degree. But note that \code{knnk} is still given in the function of the
-normal vertex degree.}
+normal vertex degree.
+Weights are are used to calculate a weighted degree (also called
+\code{\link{strength}}) instead of the degree.}
}
\value{
A list with two members: \item{knn}{A numeric vector giving the
@@ -39,6 +41,7 @@ Note that for zero degree vertices the answer in \sQuote{\code{knn}} is
if a given degree never appears in the network.
}
\examples{
+
# Some trivial ones
g <- make_ring(10)
knn(g)
@@ -58,13 +61,12 @@ g5 <- make_star(10)
E(g5)$weight <- seq(ecount(g5))
knn(g5)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Alain Barrat, Marc Barthelemy, Romualdo Pastor-Satorras,
Alessandro Vespignani: The architecture of complex weighted networks, Proc.
Natl. Acad. Sci. USA 101, 3747 (2004)
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/laplacian_matrix.Rd b/man/laplacian_matrix.Rd
index 2d1cf45..7b29cdd 100644
--- a/man/laplacian_matrix.Rd
+++ b/man/laplacian_matrix.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{laplacian_matrix}
-\alias{graph.laplacian}
\alias{laplacian_matrix}
+\alias{graph.laplacian}
\title{Graph Laplacian}
\usage{
laplacian_matrix(graph, normalized = FALSE, weights = NULL,
@@ -46,13 +46,14 @@ j with weight w, and 0 otherwise. The weighted degree of a vertex is the sum
of the weights of its adjacent edges.
}
\examples{
+
g <- make_ring(10)
laplacian_matrix(g)
laplacian_matrix(g, norm=TRUE)
laplacian_matrix(g, norm=TRUE, sparse=FALSE)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout.deprecated.Rd b/man/layout.deprecated.Rd
index 86f4157..04bf301 100644
--- a/man/layout.deprecated.Rd
+++ b/man/layout.deprecated.Rd
@@ -1,13 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout.reingold.tilford}
+\alias{layout.reingold.tilford}
\alias{layout.circle}
+\alias{layout.sphere}
+\alias{layout.random}
\alias{layout.fruchterman.reingold}
\alias{layout.kamada.kawai}
\alias{layout.lgl}
-\alias{layout.random}
-\alias{layout.reingold.tilford}
-\alias{layout.sphere}
\title{Deprecated layout functions}
\usage{
layout.reingold.tilford(..., params = list())
@@ -32,4 +32,3 @@ layout.lgl(..., params = list())
\description{
Please use the new names, see \code{\link{layout_}}.
}
-
diff --git a/man/layout.fruchterman.reingold.grid.Rd b/man/layout.fruchterman.reingold.grid.Rd
index 8e80d65..4e0b0bd 100644
--- a/man/layout.fruchterman.reingold.grid.Rd
+++ b/man/layout.fruchterman.reingold.grid.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout.fruchterman.reingold.grid}
\alias{layout.fruchterman.reingold.grid}
@@ -17,4 +17,3 @@ Layout coordinates, a two column matrix.
\description{
Now it calls the Fruchterman-Reingold layout, with a warning.
}
-
diff --git a/man/layout.spring.Rd b/man/layout.spring.Rd
index 9b6e25f..2e53731 100644
--- a/man/layout.spring.Rd
+++ b/man/layout.spring.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout.spring}
\alias{layout.spring}
@@ -17,4 +17,3 @@ Layout coordinates, a two column matrix.
\description{
Now it calls the Fruchterman-Reingold layout, with a warning.
}
-
diff --git a/man/layout.svd.Rd b/man/layout.svd.Rd
index 3d0d03c..f9f997b 100644
--- a/man/layout.svd.Rd
+++ b/man/layout.svd.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout.svd}
\alias{layout.svd}
@@ -17,4 +17,3 @@ Layout coordinates, a two column matrix.
\description{
Now it calls the Fruchterman-Reingold layout, with a warning.
}
-
diff --git a/man/layout_.Rd b/man/layout_.Rd
index a6d6965..439d291 100644
--- a/man/layout_.Rd
+++ b/man/layout_.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_}
-\alias{layout}
\alias{layout_}
-\alias{print.igraph_layout_modifier}
+\alias{layout}
\alias{print.igraph_layout_spec}
+\alias{print.igraph_layout_modifier}
\title{Graph layouts}
\usage{
layout_(graph, layout, ...)
@@ -59,6 +59,7 @@ Currently implemented modifyers: \itemize{
\item \code{normalize} scales the layout to a square.
}
}
+
\examples{
g <- make_ring(10) + make_full_graph(5)
coords <- layout_(g, as_star())
@@ -68,40 +69,24 @@ plot(g, layout = coords)
\code{\link{add_layout_}} to add the layout to the
graph as an attribute.
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
+ \code{\link{merge_coords}}, \code{\link{norm_coords}},
\code{\link{normalize}}
}
-
diff --git a/man/layout_as_bipartite.Rd b/man/layout_as_bipartite.Rd
index bf9fb05..89c74b5 100644
--- a/man/layout_as_bipartite.Rd
+++ b/man/layout_as_bipartite.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_as_bipartite}
-\alias{as_bipartite}
-\alias{layout.bipartite}
\alias{layout_as_bipartite}
+\alias{layout.bipartite}
+\alias{as_bipartite}
\title{Simple two-row layout for bipartite graphs}
\usage{
layout_as_bipartite(graph, types = NULL, hgap = 1, vgap = 1,
@@ -57,48 +57,30 @@ g \%>\%
add_layout_(as_bipartite()) \%>\%
plot()
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{layout_with_sugiyama}}
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_star}}, \code{\link{layout.star}},
- \code{\link{layout_as_star}}; \code{\link{as_tree}},
- \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_as_star.Rd b/man/layout_as_star.Rd
index 95b0508..ca955cf 100644
--- a/man/layout_as_star.Rd
+++ b/man/layout_as_star.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_as_star}
-\alias{as_star}
-\alias{layout.star}
\alias{layout_as_star}
+\alias{layout.star}
+\alias{as_star}
\title{Generate coordinates to place the vertices of a graph in a star-shape}
\usage{
layout_as_star(graph, center = V(graph)[1], order = NULL)
@@ -34,57 +34,39 @@ It is possible to choose the vertex that will be in the center, and the
order of the vertices can be also given.
}
\examples{
+
g <- make_star(10)
layout_as_star(g)
## Alternative form
layout_(g, as_star())
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{layout}} and \code{\link{layout.drl}} for other layout
algorithms, \code{\link{plot.igraph}} and \code{\link{tkplot}} on how to
plot graphs and \code{\link{star}} on how to create ring graphs.
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_tree}},
- \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_as_tree.Rd b/man/layout_as_tree.Rd
index e36eaec..56a73c4 100644
--- a/man/layout_as_tree.Rd
+++ b/man/layout_as_tree.Rd
@@ -1,12 +1,12 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_as_tree}
-\alias{as_tree}
\alias{layout_as_tree}
+\alias{as_tree}
\title{The Reingold-Tilford graph layout algorithm}
\usage{
layout_as_tree(graph, root = numeric(), circular = FALSE,
- rootlevel = numeric(), mode = "out", flip.y = TRUE)
+ rootlevel = numeric(), mode = c("out", "in", "all"), flip.y = TRUE)
as_tree(...)
}
@@ -58,6 +58,7 @@ If the given graph is not a tree, a breadth-first search is executed first
to obtain a possible spanning tree.
}
\examples{
+
tree <- make_tree(20, 3)
plot(tree, layout=layout_as_tree)
plot(tree, layout=layout_as_tree(tree, flip.y=FALSE))
@@ -68,52 +69,33 @@ plot(tree2, layout=layout_as_tree)
plot(tree2, layout=layout_as_tree(tree2, root=c(1,11),
rootlevel=c(2,1)))
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com}
-}
\references{
Reingold, E and Tilford, J (1981). Tidier drawing of trees.
\emph{IEEE Trans. on Softw. Eng.}, SE-7(2):223--228.
}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_in_circle.Rd b/man/layout_in_circle.Rd
index 10614c6..99b5ede 100644
--- a/man/layout_in_circle.Rd
+++ b/man/layout_in_circle.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_in_circle}
-\alias{in_circle}
\alias{layout_in_circle}
+\alias{in_circle}
\title{Graph layout with vertices on a circle.}
\usage{
layout_in_circle(graph, order = V(graph))
@@ -29,6 +29,7 @@ If you want to order the vertices differently, then permute them using the
\code{\link{permute}} function.
}
\examples{
+
## Place vertices on a circle, order them according to their
## community
\dontrun{
@@ -43,46 +44,28 @@ V(karate)$shape <- "none"
plot(karate, layout = coords)
}
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{layout.auto}},
- \code{\link{layout_nicely}}, \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_nicely.Rd b/man/layout_nicely.Rd
index 52d66c2..f59b2b1 100644
--- a/man/layout_nicely.Rd
+++ b/man/layout_nicely.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_nicely}
-\alias{layout.auto}
\alias{layout_nicely}
+\alias{layout.auto}
\alias{nicely}
\title{Choose an appropriate graph layout algorithm automatically}
\usage{
@@ -39,48 +39,30 @@ if the graph is connected and has less than 1000 vertices, the
Fruchterman-Reingold layout is used, by calling \code{layout_with_fr}.
\item Otherwise the DrL layout is used, \code{layout_with_drl} is called. }
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{plot.igraph}}
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_on_grid.Rd b/man/layout_on_grid.Rd
index f177a80..fff1087 100644
--- a/man/layout_on_grid.Rd
+++ b/man/layout_on_grid.Rd
@@ -1,10 +1,11 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_on_grid}
+\alias{layout_on_grid}
\alias{layout.grid}
\alias{layout.grid.3d}
-\alias{layout_on_grid}
\alias{on_grid}
+\alias{layout.grid.3d}
\title{Simple grid layout}
\usage{
layout_on_grid(graph, width = 0, height = 0, dim = 2)
@@ -42,6 +43,7 @@ other. If you want to change the order of the vertices, then see the
\code{\link{permute}} function.
}
\examples{
+
g <- make_lattice( c(3,3) )
layout_on_grid(g)
@@ -53,47 +55,30 @@ plot(g, layout=layout_on_grid)
rglplot(g, layout=layout_on_grid(g, dim = 3))
}
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\seealso{
\code{\link{layout}} for other layout generators
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.mds}},
- \code{\link{layout_with_mds}}, \code{\link{with_mds}};
- \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_on_sphere.Rd b/man/layout_on_sphere.Rd
index 3a54ec9..b3a4888 100644
--- a/man/layout_on_sphere.Rd
+++ b/man/layout_on_sphere.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_on_sphere}
\alias{layout_on_sphere}
@@ -29,47 +29,28 @@ surface of a sphere, this is thus a 3d layout. It is not clear however what
If you want to order the vertices differently, then permute them using the
\code{\link{permute}} function.
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_randomly.Rd b/man/layout_randomly.Rd
index a8d0610..d4f6c1e 100644
--- a/man/layout_randomly.Rd
+++ b/man/layout_randomly.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_randomly}
\alias{layout_randomly}
@@ -29,47 +29,28 @@ Randomly places vertices on a [-1,1] square (in 2d) or in a cube (in 3d). It
is probably a useless layout, but it can use as a starting point for other
layout generators.
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_with_dh.Rd b/man/layout_with_dh.Rd
index 6379145..22d4988 100644
--- a/man/layout_with_dh.Rd
+++ b/man/layout_with_dh.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_dh}
-\alias{layout.davidson.harel}
\alias{layout_with_dh}
+\alias{layout.davidson.harel}
\alias{with_dh}
\title{The Davidson-Harel layout algorithm}
\usage{
@@ -71,6 +71,7 @@ possible. The only major difference is that coordinates are explicitly kept
within the bounds of the rectangle of the layout.
}
\examples{
+
set.seed(42)
## Figures from the paper
g_1b <- make_star(19, mode="undirected") + path(c(2:19, 2)) +
@@ -122,9 +123,6 @@ g_12 <- make_empty_graph(n=37, directed=FALSE) +
path(5,9,13,15,19,23,25,28,33) + path(3,12,16,25,35,26,22,13,3)
plot(g_12, layout=layout_with_dh, vertex.size=5, vertex.label=NA)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Ron Davidson, David Harel: Drawing Graphs Nicely Using Simulated
Annealing. \emph{ACM Transactions on Graphics} 15(4), pp. 301-331, 1996.
@@ -133,41 +131,26 @@ Annealing. \emph{ACM Transactions on Graphics} 15(4), pp. 301-331, 1996.
\code{\link{layout_with_fr}},
\code{\link{layout_with_kk}} for other layout algorithms.
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}}; \code{\link{layout.gem}},
- \code{\link{layout_with_gem}}, \code{\link{with_gem}};
- \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
-
diff --git a/man/layout_with_drl.Rd b/man/layout_with_drl.Rd
index d1c8a1b..1e7e7bd 100644
--- a/man/layout_with_drl.Rd
+++ b/man/layout_with_drl.Rd
@@ -1,14 +1,14 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout_drl.R
\name{layout_with_drl}
+\alias{layout_with_drl}
+\alias{layout.drl}
\alias{drl_defaults}
\alias{igraph.drl.coarsen}
\alias{igraph.drl.coarsest}
\alias{igraph.drl.default}
\alias{igraph.drl.final}
\alias{igraph.drl.refine}
-\alias{layout.drl}
-\alias{layout_with_drl}
\alias{with_drl}
\title{The DrL graph layout generator}
\usage{
@@ -32,7 +32,8 @@ below.}
\item{weights}{Optional edge weights. Supply \code{NULL} here if you want to
weight edges equally. By default the \code{weight} edge attribute is used if
-the graph has one.}
+the graph has one. Larger weights correspond to stronger connections,
+and the vertices will be placed closer to each other.}
\item{fixed}{Logical vector, it can be used to fix some vertices. All
vertices for which it is \code{TRUE} are kept at the coordinates supplied in
@@ -93,16 +94,13 @@ There are five pre-defined parameter settings as well, these are called
\code{drl_defaults$final}. }
}
\examples{
+
g <- as.undirected(sample_pa(100, m=1))
l <- layout_with_drl(g, options=list(simmer.attraction=0))
\dontrun{
plot(g, layout=l, vertex.size=3, vertex.label=NA)
}
-}
-\author{
-Shawn Martin (\url{http://www.cs.otago.ac.nz/homepages/smartin/})
-and Gabor Csardi \email{csardi.gabor at gmail.com} for the R/igraph interface
-and the three dimensional version.
+
}
\references{
See the following technical report: Martin, S., Brown, W.M.,
@@ -112,5 +110,9 @@ Reports, 2008. 2936: p. 1-10.
\seealso{
\code{\link{layout}} for other layout generators.
}
+\author{
+Shawn Martin (\url{http://www.cs.otago.ac.nz/homepages/smartin/})
+and Gabor Csardi \email{csardi.gabor at gmail.com} for the R/igraph interface
+and the three dimensional version.
+}
\keyword{graphs}
-
diff --git a/man/layout_with_fr.Rd b/man/layout_with_fr.Rd
index b018430..4c7f8b3 100644
--- a/man/layout_with_fr.Rd
+++ b/man/layout_with_fr.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_fr}
\alias{layout_with_fr}
@@ -36,7 +36,9 @@ vertices.}
\item{weights}{A vector giving edge weights. The \code{weight} edge
attribute is used by default, if present. If weights are given, then the
-attraction along the edges will be multiplied by the given edge weights.}
+attraction along the edges will be multiplied by the given edge weights.
+This places vertices connected with a highly weighted edge closer to
+each other.}
\item{minx}{If not \code{NULL}, then it must be a numeric vector that gives
lower boundaries for the \sQuote{x} coordinates of the vertices. The length
@@ -56,7 +58,7 @@ of the vector must match the number of vertices in the graph.}
\item{maxz}{Similar to \code{minx}, but gives the upper boundaries of the
\sQuote{z} coordinates.}
-\item{coolexp,maxdelta,area,repulserad}{These arguments are not supported
+\item{coolexp, maxdelta, area, repulserad}{These arguments are not supported
from igraph version 0.8.0 and are ignored (with a warning).}
\item{maxiter}{A deprecated synonym of \code{niter}, for compatibility.}
@@ -77,6 +79,7 @@ See the referenced paper below for the details of the algorithm.
This function was rewritten from scratch in igraph version 0.8.0.
}
\examples{
+
# Fixing ego
g <- sample_pa(20, m=2)
minC <- rep(-Inf, vcount(g))
@@ -91,9 +94,7 @@ plot(g, layout=co, vertex.size=30, edge.arrow.size=0.2,
vertex.label.color="red")
axis(1)
axis(2)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Fruchterman, T.M.J. and Reingold, E.M. (1991). Graph Drawing by
@@ -104,43 +105,27 @@ Force-directed Placement. \emph{Software - Practice and Experience},
\code{\link{layout_with_drl}}, \code{\link{layout_with_kk}} for
other layout algorithms.
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_with_gem.Rd b/man/layout_with_gem.Rd
index 95521d1..04dbec4 100644
--- a/man/layout_with_gem.Rd
+++ b/man/layout_with_gem.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_gem}
-\alias{layout.gem}
\alias{layout_with_gem}
+\alias{layout.gem}
\alias{with_gem}
\title{The GEM layout algorithm}
\usage{
@@ -47,12 +47,11 @@ Place vertices on the plane using the GEM force-directed layout algorithm.
See the referenced paper below for the details of the algorithm.
}
\examples{
+
set.seed(42)
g <- make_ring(10)
plot(g, layout=layout_with_gem)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Arne Frick, Andreas Ludwig, Heiko Mehldau: A Fast Adaptive
@@ -63,43 +62,27 @@ LNCS 894, pp. 388-403, 1995.
\code{\link{layout_with_fr}},
\code{\link{plot.igraph}}, \code{\link{tkplot}}
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_with_graphopt.Rd b/man/layout_with_graphopt.Rd
index a3afaab..c1297e9 100644
--- a/man/layout_with_graphopt.Rd
+++ b/man/layout_with_graphopt.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_graphopt}
-\alias{layout.graphopt}
\alias{layout_with_graphopt}
+\alias{layout.graphopt}
\alias{with_graphopt}
\title{The graphopt layout algorithm}
\usage{
@@ -62,47 +62,29 @@ that, so a stable fixed point is not guaranteed.)
See also \url{http://www.schmuhl.org/graphopt/} for the original graphopt.
}
+\seealso{
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
+ \code{\link{layout_with_sugiyama}},
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
\author{
Michael Schmuhl for the original graphopt code, rewritten and
wrapped by Gabor Csardi \email{csardi.gabor at gmail.com}.
}
-\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
- \code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
-}
\keyword{graphs}
-
diff --git a/man/layout_with_kk.Rd b/man/layout_with_kk.Rd
index ec86681..1ebfcc8 100644
--- a/man/layout_with_kk.Rd
+++ b/man/layout_with_kk.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_kk}
\alias{layout_with_kk}
@@ -34,7 +34,8 @@ iterations.}
\item{kkconst}{Numeric scalar, the Kamada-Kawai vertex attraction constant.
Typical (and default) value is the number of vertices.}
-\item{weights}{Edge weights, larger values will result longer edges.}
+\item{weights}{Edge weights, larger values will result longer edges.
+Note that this is opposite to \code{\link{layout_with_fr}}.}
\item{minx}{If not \code{NULL}, then it must be a numeric vector that gives
lower boundaries for the \sQuote{x} coordinates of the vertices. The length
@@ -54,7 +55,7 @@ of the vector must match the number of vertices in the graph.}
\item{maxz}{Similar to \code{minx}, but gives the upper boundaries of the
\sQuote{z} coordinates.}
-\item{niter,sigma,initemp,coolexp}{These arguments are not supported from
+\item{niter, sigma, initemp, coolexp}{These arguments are not supported from
igraph version 0.8.0 and are ignored (with a warning).}
\item{start}{Deprecated synonym for \code{coords}, for compatibility.}
@@ -77,12 +78,11 @@ This function was rewritten from scratch in igraph version 0.8.0 and it
follows truthfully the original publication by Kamada and Kawai now.
}
\examples{
+
g <- make_ring(10)
E(g)$weight <- rep(1:2, length.out=ecount(g))
plot(g, layout=layout_with_kk, edge.label=E(g)$weight)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Kamada, T. and Kawai, S.: An Algorithm for Drawing General
@@ -92,43 +92,27 @@ Undirected Graphs. \emph{Information Processing Letters}, 31/1, 7--15, 1989.
\code{\link{layout_with_drl}}, \code{\link{plot.igraph}},
\code{\link{tkplot}}
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_with_lgl.Rd b/man/layout_with_lgl.Rd
index a4059a2..291830c 100644
--- a/man/layout_with_lgl.Rd
+++ b/man/layout_with_lgl.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_lgl}
\alias{layout_with_lgl}
@@ -48,47 +48,28 @@ A layout generator for larger graphs.
generator of the Large Graph Layout software
(\url{http://lgl.sourceforge.net/}).
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_with_mds.Rd b/man/layout_with_mds.Rd
index 5fd1057..099ba18 100644
--- a/man/layout_with_mds.Rd
+++ b/man/layout_with_mds.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_mds}
-\alias{layout.mds}
\alias{layout_with_mds}
+\alias{layout.mds}
\alias{with_mds}
\title{Graph layout by multidimensional scaling}
\usage{
@@ -46,14 +46,11 @@ This function generates the layout separately for each graph component and
then merges them via \code{\link{merge_coords}}.
}
\examples{
+
g <- sample_gnp(100, 2/100)
l <- layout_with_mds(g)
plot(g, layout=l, vertex.label=NA, vertex.size=3)
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com}
-}
\references{
Cox, T. F. and Cox, M. A. A. (2001) \emph{Multidimensional
Scaling}. Second edition. Chapman and Hall.
@@ -61,43 +58,28 @@ Scaling}. Second edition. Chapman and Hall.
\seealso{
\code{\link{layout}}, \code{\link{plot.igraph}}
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
- \code{\link{normalize}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}, \code{\link{normalize}}
+}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/layout_with_sugiyama.Rd b/man/layout_with_sugiyama.Rd
index a54b0e6..868e658 100644
--- a/man/layout_with_sugiyama.Rd
+++ b/man/layout_with_sugiyama.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{layout_with_sugiyama}
-\alias{layout.sugiyama}
\alias{layout_with_sugiyama}
+\alias{layout.sugiyama}
\alias{with_sugiyama}
\title{The Sugiyama graph layout generator}
\usage{
@@ -29,7 +29,9 @@ you have too many edge crossings, increase this.}
\item{weights}{Optional edge weight vector. If \code{NULL}, then the
'weight' edge attribute is used, if there is one. Supply \code{NA} here and
-igraph ignores the edge weights.}
+igraph ignores the edge weights. These are used only if the graph
+contains cycles; igraph will tend to reverse edges with smaller weights
+when breaking the cycles.}
\item{attributes}{Which graph/vertex/edge attributes to keep in the extended
graph. \sQuote{default} keeps the \sQuote{size}, \sQuote{size2},
@@ -75,6 +77,7 @@ the dummy nodes.
For more details, see the reference below.
}
\examples{
+
## Data taken from http://tehnick-8.narod.ru/dc_clients/
DC <- graph_from_literal("DC++" -+
"LinuxDC++":"BCDC++":"EiskaltDC++":"StrongDC++":"DiCe!++",
@@ -192,9 +195,7 @@ plot(layex$extd_graph, vertex.label.cex=0.5,
vertex.shape=ifelse(origvert, "square", "none"),
vertex.label=ifelse(origvert, V(ex)$name, ""),
edge.arrow.mode=ifelse(realedge, 2, 0))
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
+
}
\references{
K. Sugiyama, S. Tagawa and M. Toda, "Methods for Visual
@@ -202,41 +203,27 @@ Understanding of Hierarchical Systems". IEEE Transactions on Systems, Man
and Cybernetics 11(2):109-125, 1981.
}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}}, \code{\link{layout_}},
+ \code{\link{merge_coords}}, \code{\link{norm_coords}},
\code{\link{normalize}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/local_scan.Rd b/man/local_scan.Rd
index 41c3931..cfa8e8b 100644
--- a/man/local_scan.Rd
+++ b/man/local_scan.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scan.R
\name{local_scan}
\alias{local_scan}
@@ -9,7 +9,7 @@ local_scan(graph.us, graph.them = NULL, k = 1, FUN = NULL,
...)
}
\arguments{
-\item{graph.us,graph}{An igraph object, the graph for which the scan
+\item{graph.us, graph}{An igraph object, the graph for which the scan
statistics will be computed}
\item{graph.them}{An igraph object or \code{NULL}, if not \code{NULL},
@@ -96,4 +96,3 @@ Priebe, C. E., Conroy, J. M., Marchette, D. J., Park,
\seealso{
Other scan statistics: \code{\link{scan_stat}}
}
-
diff --git a/man/make_.Rd b/man/make_.Rd
index c6bc40f..f891074 100644
--- a/man/make_.Rd
+++ b/man/make_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_}
\alias{make_}
@@ -45,4 +45,3 @@ is_simple(ran)
simplified with_edge_ with_graph_ with_vertex_
without_loops without_multiples
}
-
diff --git a/man/make_bipartite_graph.Rd b/man/make_bipartite_graph.Rd
index 5625670..85a3c61 100644
--- a/man/make_bipartite_graph.Rd
+++ b/man/make_bipartite_graph.Rd
@@ -1,11 +1,12 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R, R/make.R
\name{is_bipartite}
-\alias{bipartite_graph}
+\alias{is_bipartite}
+\alias{make_bipartite_graph}
\alias{graph.bipartite}
\alias{is.bipartite}
\alias{is_bipartite}
-\alias{make_bipartite_graph}
+\alias{bipartite_graph}
\title{Create a bipartite graph}
\usage{
is_bipartite(graph)
@@ -55,14 +56,15 @@ a vertex attribute called \code{type}.
checks whether the graph has a vertex attribute called \code{type}.
}
\examples{
+
g <- make_bipartite_graph( rep(0:1,length=10), c(1:10))
print(g, v=TRUE)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{graph}} to create one-mode networks
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/make_chordal_ring.Rd b/man/make_chordal_ring.Rd
index a1dbd1e..5781398 100644
--- a/man/make_chordal_ring.Rd
+++ b/man/make_chordal_ring.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_chordal_ring}
-\alias{chordal_ring}
-\alias{graph.extended.chordal.ring}
\alias{make_chordal_ring}
+\alias{graph.extended.chordal.ring}
+\alias{chordal_ring}
\title{Create an extended chordal ring graph}
\usage{
make_chordal_ring(n, w)
@@ -39,32 +39,12 @@ chord <- make_chordal_ring(15,
matrix(c(3, 12, 4, 7, 8, 11), nr = 2))
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
-
diff --git a/man/make_clusters.Rd b/man/make_clusters.Rd
index 9ec90a0..e51c7da 100644
--- a/man/make_clusters.Rd
+++ b/man/make_clusters.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{make_clusters}
-\alias{create.communities}
\alias{make_clusters}
+\alias{create.communities}
\title{Creates a communities object.}
\usage{
make_clusters(graph, membership = NULL, algorithm = NULL, merges = NULL,
@@ -32,4 +32,3 @@ A \code{communities} object.
This is useful to integrate the results of community finding algorithms
that are not included in igraph.
}
-
diff --git a/man/make_de_bruijn_graph.Rd b/man/make_de_bruijn_graph.Rd
index 9f7cec5..0c500f3 100644
--- a/man/make_de_bruijn_graph.Rd
+++ b/man/make_de_bruijn_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_de_bruijn_graph}
-\alias{de_bruijn_graph}
-\alias{graph.de.bruijn}
\alias{make_de_bruijn_graph}
+\alias{graph.de.bruijn}
+\alias{de_bruijn_graph}
\title{De Bruijn graphs}
\usage{
make_de_bruijn_graph(m, n)
@@ -39,16 +39,16 @@ De Bruijn graphs have some interesting properties, please see another
source, eg. Wikipedia for details.
}
\examples{
+
# de Bruijn graphs can be created recursively by line graphs as well
g <- make_de_bruijn_graph(2,1)
make_de_bruijn_graph(2,2)
make_line_graph(g)
}
-\author{
-Gabor Csardi <csardi.gabor at gmail.com>
-}
\seealso{
\code{\link{make_kautz_graph}}, \code{\link{make_line_graph}}
}
+\author{
+Gabor Csardi <csardi.gabor at gmail.com>
+}
\keyword{graphs}
-
diff --git a/man/make_empty_graph.Rd b/man/make_empty_graph.Rd
index b893b81..611e953 100644
--- a/man/make_empty_graph.Rd
+++ b/man/make_empty_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_empty_graph}
-\alias{empty_graph}
-\alias{graph.empty}
\alias{make_empty_graph}
+\alias{graph.empty}
+\alias{empty_graph}
\title{A graph with no edges}
\usage{
make_empty_graph(n = 0, directed = TRUE)
@@ -28,36 +28,15 @@ make_empty_graph(n = 10)
make_empty_graph(n = 5, directed = FALSE)
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
\concept{
Empty graph.
}
-
diff --git a/man/make_full_bipartite_graph.Rd b/man/make_full_bipartite_graph.Rd
index 903625d..60c9956 100644
--- a/man/make_full_bipartite_graph.Rd
+++ b/man/make_full_bipartite_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_full_bipartite_graph}
-\alias{full_bipartite_graph}
-\alias{graph.full.bipartite}
\alias{make_full_bipartite_graph}
+\alias{graph.full.bipartite}
+\alias{full_bipartite_graph}
\title{Create a full bipartite graph}
\usage{
make_full_bipartite_graph(n1, n2, directed = FALSE, mode = c("all", "out",
@@ -39,16 +39,17 @@ this is boolean and \code{FALSE} for the vertices of the first kind and
\code{TRUE} for vertices of the second kind.
}
\examples{
+
g <- make_full_bipartite_graph(2, 3)
g2 <- make_full_bipartite_graph(2, 3, dir=TRUE)
g3 <- make_full_bipartite_graph(2, 3, dir=TRUE, mode="in")
g4 <- make_full_bipartite_graph(2, 3, dir=TRUE, mode="all")
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{make_full_graph}} for creating one-mode full graphs
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/make_full_citation_graph.Rd b/man/make_full_citation_graph.Rd
index 3871aab..8d30fa2 100644
--- a/man/make_full_citation_graph.Rd
+++ b/man/make_full_citation_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_full_citation_graph}
-\alias{full_citation_graph}
-\alias{graph.full.citation}
\alias{make_full_citation_graph}
+\alias{graph.full.citation}
+\alias{full_citation_graph}
\title{Create a complete (full) citation graph}
\usage{
make_full_citation_graph(n, directed = TRUE)
@@ -26,35 +26,15 @@ directed graph, where every \code{i->j} edge is present if and only if
\eqn{j<i}. If \code{directed=FALSE} then the graph is just a full graph.
}
\examples{
-str(make_full_citation_graph(10))
+print_all(make_full_citation_graph(10))
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
-
diff --git a/man/make_full_graph.Rd b/man/make_full_graph.Rd
index e9c6a1c..0074f1a 100644
--- a/man/make_full_graph.Rd
+++ b/man/make_full_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_full_graph}
-\alias{full_graph}
-\alias{graph.full}
\alias{make_full_graph}
+\alias{graph.full}
+\alias{full_graph}
\title{Create a full graph}
\usage{
make_full_graph(n, directed = FALSE, loops = FALSE)
@@ -27,39 +27,19 @@ Create a full graph
}
\examples{
make_full_graph(5)
-str(make_full_graph(4, directed = TRUE))
+print_all(make_full_graph(4, directed = TRUE))
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_graph}}, \code{\link{make_lattice}},
+ \code{\link{make_ring}}, \code{\link{make_star}},
+ \code{\link{make_tree}}
}
\concept{
Full graph
}
-
diff --git a/man/make_graph.Rd b/man/make_graph.Rd
index bfffdc7..739a5ae 100644
--- a/man/make_graph.Rd
+++ b/man/make_graph.Rd
@@ -1,13 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\encoding{UTF-8}
\name{make_graph}
-\alias{directed_graph}
-\alias{graph}
+\alias{make_graph}
\alias{graph.famous}
+\alias{graph}
\alias{make_directed_graph}
-\alias{make_graph}
\alias{make_undirected_graph}
+\alias{directed_graph}
\alias{undirected_graph}
\title{Create an igraph graph from a list of edges, or a notable graph}
\usage{
@@ -165,6 +165,7 @@ is given is they are specified.)
W. Zachary, An information flow model for conflict and fission in small
groups, Journal of Anthropological Research 33, 452-473 (1977). } }
}
+
\examples{
make_graph(c(1, 2, 2, 3, 3, 4, 5, 6), directed = FALSE)
make_graph(c("A", "B", "B", "C", "C", "D"), directed = FALSE)
@@ -183,29 +184,13 @@ graph <- make_graph( ~ A-B-C-D-A, E-A:B:C:D,
C-P, C-L, I-L, I-P)
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}, \code{\link{make_tree}}
}
-
diff --git a/man/make_kautz_graph.Rd b/man/make_kautz_graph.Rd
index e844609..1b25789 100644
--- a/man/make_kautz_graph.Rd
+++ b/man/make_kautz_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_kautz_graph}
+\alias{make_kautz_graph}
\alias{graph.kautz}
\alias{kautz_graph}
-\alias{make_kautz_graph}
\title{Kautz graphs}
\usage{
make_kautz_graph(m, n)
@@ -35,15 +35,16 @@ Kautz graphs have some interesting properties, see eg. Wikipedia for
details.
}
\examples{
+
make_line_graph(make_kautz_graph(2,1))
make_kautz_graph(2,2)
+
+}
+\seealso{
+\code{\link{make_de_bruijn_graph}}, \code{\link{make_line_graph}}
}
\author{
Gabor Csardi <csardi.gabor at gmail.com>, the first version in R was
written by Vincent Matossian.
}
-\seealso{
-\code{\link{make_de_bruijn_graph}}, \code{\link{make_line_graph}}
-}
\keyword{graphs}
-
diff --git a/man/make_lattice.Rd b/man/make_lattice.Rd
index 69652e6..f777848 100644
--- a/man/make_lattice.Rd
+++ b/man/make_lattice.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_lattice}
+\alias{make_lattice}
\alias{graph.lattice}
\alias{lattice}
-\alias{make_lattice}
\title{Create a lattice graph}
\usage{
make_lattice(dimvector = NULL, length = NULL, dim = NULL, nei = 1,
@@ -48,36 +48,16 @@ make_lattice(c(5, 5, 5))
make_lattice(length = 5, dim = 3)
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}; \code{\link{graph.tree}},
- \code{\link{make_tree}}, \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_ring}}, \code{\link{make_star}},
+ \code{\link{make_tree}}
}
\concept{
Lattice
}
-
diff --git a/man/make_line_graph.Rd b/man/make_line_graph.Rd
index ccbe667..2ffc786 100644
--- a/man/make_line_graph.Rd
+++ b/man/make_line_graph.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_line_graph}
+\alias{make_line_graph}
\alias{line.graph}
\alias{line_graph}
-\alias{make_line_graph}
\title{Line graph of a graph}
\usage{
make_line_graph(graph)
@@ -34,15 +34,16 @@ the first vertex's corresponding edge is the same as the source of the
second vertex's corresponding edge.
}
\examples{
+
# generate the first De-Bruijn graphs
g <- make_full_graph(2, directed=TRUE, loops=TRUE)
make_line_graph(g)
make_line_graph(make_line_graph(g))
make_line_graph(make_line_graph(make_line_graph(g)))
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}, the first version of
the C code was written by Vincent Matossian.
}
\keyword{graphs}
-
diff --git a/man/make_ring.Rd b/man/make_ring.Rd
index 32dc495..607a432 100644
--- a/man/make_ring.Rd
+++ b/man/make_ring.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_ring}
-\alias{graph.ring}
\alias{make_ring}
+\alias{graph.ring}
\alias{ring}
\title{Create a ring graph}
\usage{
@@ -32,38 +32,17 @@ A ring is a one-dimensional lattice and this function is a special case
of \code{\link{make_lattice}}.
}
\examples{
-str(make_ring(10))
-str(make_ring(10, directed = TRUE, mutual = TRUE))
+print_all(make_ring(10))
+print_all(make_ring(10, directed = TRUE, mutual = TRUE))
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.star}},
- \code{\link{make_star}}, \code{\link{star}};
- \code{\link{graph.tree}}, \code{\link{make_tree}},
- \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_star}},
+ \code{\link{make_tree}}
}
-
diff --git a/man/make_star.Rd b/man/make_star.Rd
index 8583732..b61627c 100644
--- a/man/make_star.Rd
+++ b/man/make_star.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_star}
-\alias{graph.star}
\alias{make_star}
+\alias{graph.star}
\alias{star}
\title{Create a star graph, a tree with n vertices and n - 1 leaves}
\usage{
@@ -35,37 +35,16 @@ make_star(10, mode = "out")
make_star(5, mode = "undirected")
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.tree}}, \code{\link{make_tree}},
- \code{\link{tree}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_tree}}
}
\concept{
Star graph
}
-
diff --git a/man/make_tree.Rd b/man/make_tree.Rd
index 6a153de..094bc11 100644
--- a/man/make_tree.Rd
+++ b/man/make_tree.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{make_tree}
-\alias{graph.tree}
\alias{make_tree}
+\alias{graph.tree}
\alias{tree}
\title{Create tree graphs}
\usage{
@@ -35,37 +35,16 @@ make_tree(10, 2)
make_tree(10, 3, mode = "undirected")
}
\seealso{
-Other determimistic constructors: \code{\link{atlas}},
- \code{\link{graph.atlas}},
- \code{\link{graph_from_atlas}};
- \code{\link{chordal_ring}},
- \code{\link{graph.extended.chordal.ring}},
- \code{\link{make_chordal_ring}};
- \code{\link{directed_graph}}, \code{\link{graph}},
- \code{\link{graph.famous}},
- \code{\link{make_directed_graph}},
- \code{\link{make_graph}},
- \code{\link{make_undirected_graph}},
- \code{\link{undirected_graph}};
- \code{\link{empty_graph}}, \code{\link{graph.empty}},
- \code{\link{make_empty_graph}};
- \code{\link{from_edgelist}},
- \code{\link{graph.edgelist}},
- \code{\link{graph_from_edgelist}};
- \code{\link{from_literal}}, \code{\link{graph.formula}},
- \code{\link{graph_from_literal}};
- \code{\link{full_citation_graph}},
- \code{\link{graph.full.citation}},
- \code{\link{make_full_citation_graph}};
- \code{\link{full_graph}}, \code{\link{graph.full}},
- \code{\link{make_full_graph}};
- \code{\link{graph.lattice}}, \code{\link{lattice}},
- \code{\link{make_lattice}}; \code{\link{graph.ring}},
- \code{\link{make_ring}}, \code{\link{ring}};
- \code{\link{graph.star}}, \code{\link{make_star}},
- \code{\link{star}}
+Other determimistic constructors: \code{\link{graph_from_atlas}},
+ \code{\link{graph_from_edgelist}},
+ \code{\link{graph_from_literal}},
+ \code{\link{make_chordal_ring}},
+ \code{\link{make_empty_graph}},
+ \code{\link{make_full_citation_graph}},
+ \code{\link{make_full_graph}}, \code{\link{make_graph}},
+ \code{\link{make_lattice}}, \code{\link{make_ring}},
+ \code{\link{make_star}}
}
\concept{
Trees.
}
-
diff --git a/man/match_vertices.Rd b/man/match_vertices.Rd
index 32efc64..8b38c1c 100644
--- a/man/match_vertices.Rd
+++ b/man/match_vertices.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sgm.R
\name{match_vertices}
\alias{match_vertices}
@@ -51,7 +51,8 @@ Frank-Wolfe algorithm.
See references for further details.
}
\examples{
-#require(Matrix)
+
+ #require(Matrix)
g1 <- erdos.renyi.game(10, .1)
randperm <- c(1:3, 3+sample(7))
g2 <- sample_correlated_gnp(g1, corr=1, p=g1$p, perm=randperm)
@@ -59,10 +60,6 @@ See references for further details.
B <- as.matrix(get.adjacency(g2))
P <-match_vertices (A, B, m=3, start=diag(rep(1, nrow(A)-3)), 20)
P
- #'
-}
-\author{
-Vince Lyzinski \url{http://www.ams.jhu.edu/~lyzinski/}
}
\references{
Vogelstein, J. T., Conroy, J. M., Podrazik, L. J., Kratzer, S.
@@ -76,5 +73,7 @@ Online: \url{http://arxiv.org/abs/1209.0367}
\seealso{
\code{\link{sample_correlated_gnp}},\code{\link{sample_correlated_gnp_pair}}
}
+\author{
+Vince Lyzinski \url{http://www.ams.jhu.edu/~lyzinski/}
+}
\keyword{graphs}
-
diff --git a/man/matching.Rd b/man/matching.Rd
index fbb4cf1..293190d 100644
--- a/man/matching.Rd
+++ b/man/matching.Rd
@@ -1,12 +1,14 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{is_matching}
+\alias{is_matching}
\alias{is.matching}
\alias{is.maximal.matching}
-\alias{is_matching}
\alias{is_max_matching}
-\alias{max_bipartite_match}
\alias{maximum.bipartite.matching}
+\alias{max_bipartite_match}
+\alias{is_max_matching}
+\alias{max_bipartite_match}
\title{Graph matching}
\usage{
is_matching(graph, matching, types = NULL)
@@ -29,7 +31,9 @@ are taken from the \sQuote{\code{type}} vertex attribute, if present.}
\item{weights}{Potential edge weights. If the graph has an edge
attribute called \sQuote{\code{weight}}, and this argument is
-\code{NULL}, then the edge attribute is used automatically.}
+\code{NULL}, then the edge attribute is used automatically.
+In weighed matching, the weights of the edges must match as
+much as possible.}
\item{eps}{A small real number used in equality tests in the weighted
bipartite matching algorithm. Two real numbers are considered equal in
@@ -98,17 +102,15 @@ is_max_matching(g, m2)
is_max_matching(g, m3)
V(g)$type <- c(FALSE,TRUE)
-str(g, v=TRUE)
+print_all(g, v=TRUE)
max_bipartite_match(g)
g2 <- graph_from_literal( a-b-c-d-e-f-g )
V(g2)$type <- rep(c(FALSE,TRUE), length=vcount(g2))
-str(g2, v=TRUE)
+print_all(g2, v=TRUE)
max_bipartite_match(g2)
-#'
+#' @keywords graphs
}
\author{
Tamas Nepusz \email{ntamas at gmail.com}
}
-\keyword{graphs}
-
diff --git a/man/max_cardinality.Rd b/man/max_cardinality.Rd
index 16e55e0..50cf5cb 100644
--- a/man/max_cardinality.Rd
+++ b/man/max_cardinality.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{max_cardinality}
\alias{max_cardinality}
@@ -29,6 +29,7 @@ The algorithm provides a simple basis for deciding whether a graph is
chordal, see References below, and also \code{\link{is_chordal}}.
}
\examples{
+
## The examples from the Tarjan-Yannakakis paper
g1 <- graph_from_literal(A-B:C:I, B-A:C:D, C-A:B:E:H, D-B:E:F,
E-C:D:F:H, F-D:E:G, G-F:H, H-C:E:G:I,
@@ -42,9 +43,6 @@ g2 <- graph_from_literal(A-B:E, B-A:E:F:D, C-E:D:G, D-B:F:E:C:G,
max_cardinality(g2)
is_chordal(g2, fillin=TRUE)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Robert E Tarjan and Mihalis Yannakakis. (1984). Simple
linear-time algorithms to test chordality of graphs, test acyclicity of
@@ -54,5 +52,7 @@ of Computation} 13, 566--579.
\seealso{
\code{\link{is_chordal}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/max_flow.Rd b/man/max_flow.Rd
index 5e7a73a..75dc627 100644
--- a/man/max_flow.Rd
+++ b/man/max_flow.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{max_flow}
-\alias{graph.maxflow}
\alias{max_flow}
+\alias{graph.maxflow}
\title{Maximum flow in a graph}
\usage{
max_flow(graph, source, target, capacity = NULL)
@@ -15,7 +15,8 @@ max_flow(graph, source, target, capacity = NULL)
\item{target}{The id of the target vertex (sometimes also called sink).}
\item{capacity}{Vector giving the capacity of the edges. If this is
-\code{NULL} (the default) then the \code{capacity} edge attribute is used.}
+\code{NULL} (the default) then the \code{capacity} edge attribute is used.
+Note that the \code{weight} edge attribute is not used by this function.}
}
\value{
A named list with components:
@@ -25,13 +26,13 @@ A named list with components:
these the flow direction is not predetermined by the edge
direction. For these graphs the elements of the this vector can be
negative, this means that the flow goes from the bigger vertex id to
- the smaller one. Positive values mean that the flow goes from
+ the smaller one. Positive values mean that the flow goes from
the smaller vertex id to the bigger one.}
\item{cut}{A numeric vector of edge ids, the minimum cut corresponding
- to the maximum flow.}
+ to the maximum flow.}
\item{partition1}{A numeric vector of vertex ids, the vertices in the
first partition of the minimum cut corresponding to the maximum
- flow.}
+ flow.}
\item{partition2}{A numeric vector of vertex ids, the vertices in the
second partition of the minimum cut corresponding to the maximum
flow.}
@@ -60,6 +61,7 @@ the flow is the incoming flow of the \code{target} vertex. The maximum flow
is the flow of maximum value.
}
\examples{
+
E <- rbind( c(1,3,3), c(3,4,1), c(4,2,2), c(1,5,1), c(5,6,2), c(6,2,10))
colnames(E) <- c("from", "to", "capacity")
g1 <- graph_from_data_frame(as.data.frame(E))
@@ -74,4 +76,3 @@ Flow Problem \emph{Journal of the ACM} 35:921-940, 1988.
\code{\link{distances}}, \code{\link{edge_connectivity}},
\code{\link{vertex_connectivity}}
}
-
diff --git a/man/merge_coords.Rd b/man/merge_coords.Rd
index 4b09824..87ed33e 100644
--- a/man/merge_coords.Rd
+++ b/man/merge_coords.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{merge_coords}
+\alias{merge_coords}
\alias{layout.merge}
+\alias{piecewise.layout}
\alias{layout_components}
-\alias{merge_coords}
\alias{piecewise.layout}
\title{Merging graph layouts}
\usage{
@@ -53,6 +54,7 @@ for each component separately. Finally it merges the layouts via calling
\code{merge_coords}.
}
\examples{
+
# create 20 scale-free graphs and place them in a common layout
graphs <- lapply(sample(5:20, 20, replace=TRUE),
barabasi.game, directed=FALSE)
@@ -61,46 +63,32 @@ lay <- merge_coords(graphs, layouts)
g <- disjoint_union(graphs)
\dontrun{plot(g, layout=lay, vertex.size=3, labels=NA, edge.color="black")}
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{plot.igraph}}, \code{\link{tkplot}},
\code{\link{layout}}, \code{\link{disjoint_union}}
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.norm}},
- \code{\link{norm_coords}}; \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
+ \code{\link{layout_}}, \code{\link{norm_coords}},
\code{\link{normalize}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/min_cut.Rd b/man/min_cut.Rd
index 7bd83ab..3be360e 100644
--- a/man/min_cut.Rd
+++ b/man/min_cut.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{min_cut}
-\alias{graph.mincut}
\alias{min_cut}
+\alias{graph.mincut}
\title{Minimum cut in a graph}
\usage{
min_cut(graph, source = NULL, target = NULL, capacity = NULL,
@@ -78,4 +78,3 @@ M. Stoer and F. Wagner: A simple min-cut algorithm,
problem, \code{\link{distances}}, \code{\link{edge_connectivity}},
\code{\link{vertex_connectivity}}
}
-
diff --git a/man/min_separators.Rd b/man/min_separators.Rd
index c97166f..6d2cf6a 100644
--- a/man/min_separators.Rd
+++ b/man/min_separators.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{min_separators}
\alias{min_separators}
@@ -78,4 +78,3 @@ hierarchical concept of social groups. \emph{American Sociological Review},
\seealso{
\code{\link{is.separator}}
}
-
diff --git a/man/min_st_separators.Rd b/man/min_st_separators.Rd
index 5afc8c4..799b772 100644
--- a/man/min_st_separators.Rd
+++ b/man/min_st_separators.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{min_st_separators}
\alias{min_st_separators}
@@ -29,20 +29,20 @@ A \eqn{(s,t)} vertex separator is minimal if none of its subsets is an
\eqn{(s,t)} vertex separator.
}
\examples{
+
ring <- make_ring(4)
min_st_separators(ring)
chvatal <- make_graph("chvatal")
min_st_separators(chvatal)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Anne Berry, Jean-Paul Bordat and Olivier Cogis: Generating All
the Minimal Separators of a Graph, In: Peter Widmayer, Gabriele Neyer and
Stephan Eidenbenz (editors): \emph{Graph-theoretic concepts in computer
science}, 1665, 167--172, 1999. Springer.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/modularity.igraph.Rd b/man/modularity.igraph.Rd
index c3d58ba..3ad1add 100644
--- a/man/modularity.igraph.Rd
+++ b/man/modularity.igraph.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{modularity.igraph}
-\alias{mod.matrix}
-\alias{modularity}
\alias{modularity.igraph}
+\alias{modularity}
\alias{modularity_matrix}
+\alias{mod.matrix}
\title{Modularity of a community structure of a graph}
\usage{
\method{modularity}{igraph}(x, membership, weights = NULL, ...)
@@ -12,7 +12,7 @@
modularity_matrix(graph, membership, weights = NULL)
}
\arguments{
-\item{x,graph}{The input graph.}
+\item{x, graph}{The input graph.}
\item{membership}{Numeric vector, for each vertex it gives its community.
The communities are numbered from one.}
@@ -62,14 +62,13 @@ and \eqn{m} is the number of edges (or the total weights in the graph, if it
is weighed).
}
\examples{
+
g <- make_full_graph(5) \%du\% make_full_graph(5) \%du\% make_full_graph(5)
g <- add_edges(g, c(1,6, 1,11, 6, 11))
wtc <- cluster_walktrap(g)
modularity(wtc)
modularity(g, membership(wtc))
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Clauset, A.; Newman, M. E. J. & Moore, C. Finding community
@@ -81,5 +80,7 @@ structure in very large networks, \emph{Phyisical Review E} 2004, 70, 066111
\code{\link{cluster_fast_greedy}}, \code{\link{cluster_spinglass}} for
various community detection methods.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/motifs.Rd b/man/motifs.Rd
index e70706d..6433e83 100644
--- a/man/motifs.Rd
+++ b/man/motifs.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/motifs.R
\name{motifs}
-\alias{graph.motifs}
\alias{motifs}
+\alias{graph.motifs}
\title{Graph motifs}
\usage{
motifs(graph, size = 3, cut.prob = rep(0, size))
@@ -42,8 +42,5 @@ sample_motifs(g, 3)
\code{\link{isomorphism_class}}
Other graph motifs: \code{\link{count_motifs}},
- \code{\link{graph.motifs.no}};
- \code{\link{graph.motifs.est}},
\code{\link{sample_motifs}}
}
-
diff --git a/man/mst.Rd b/man/mst.Rd
index 4790021..07cb617 100644
--- a/man/mst.Rd
+++ b/man/mst.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/minimum.spanning.tree.R
\name{mst}
-\alias{minimum.spanning.tree}
\alias{mst}
+\alias{minimum.spanning.tree}
\title{Minimum spanning tree}
\usage{
mst(graph, weights = NULL, algorithm = NULL, ...)
@@ -12,7 +12,8 @@ mst(graph, weights = NULL, algorithm = NULL, ...)
\item{weights}{Numeric algorithm giving the weights of the edges in the
graph. The order is determined by the edge ids. This is ignored if the
-\code{unweighted} algorithm is chosen}
+\code{unweighted} algorithm is chosen. Edge weights are interpreted as
+distances.}
\item{algorithm}{The algorithm to use for calculation. \code{unweighted} can
be used for unwieghted graphs, and \code{prim} runs Prim's algorithm for
@@ -39,11 +40,10 @@ consisting of the minimum spanning trees of its components.
If the graph is unconnected a minimum spanning forest is returned.
}
\examples{
+
g <- sample_gnp(100, 3/100)
g_mst <- mst(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Prim, R.C. 1957. Shortest connection networks and some
@@ -52,5 +52,7 @@ generalizations \emph{Bell System Technical Journal}, 37 1389--1401.
\seealso{
\code{\link{components}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/neighbors.Rd b/man/neighbors.Rd
index d6db6b1..01ea5a6 100644
--- a/man/neighbors.Rd
+++ b/man/neighbors.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/interface.R
\name{neighbors}
\alias{neighbors}
@@ -29,15 +29,11 @@ n34 <- neighbors(g, 34)
intersection(n1, n34)
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{tail_of}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident_edges}}, \code{\link{incident}},
+ \code{\link{is_directed}}, \code{\link{tail_of}}
}
-
diff --git a/man/nexus.Rd b/man/nexus.Rd
index e5f2005..c100017 100644
--- a/man/nexus.Rd
+++ b/man/nexus.Rd
@@ -1,20 +1,26 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nexus.R
\name{print.nexusDatasetInfo}
-\alias{[.nexusDatasetInfoList}
+\alias{print.nexusDatasetInfo}
+\alias{summary.nexusDatasetInfoList}
+\alias{print.nexusDatasetInfoList}
+\alias{nexus_list}
\alias{nexus}
-\alias{nexus.get}
-\alias{nexus.info}
\alias{nexus.list}
+\alias{nexus.info}
+\alias{nexus.get}
\alias{nexus.search}
-\alias{nexusDatasetInfo}
-\alias{nexus_get}
\alias{nexus_info}
-\alias{nexus_list}
+\alias{nexus_get}
\alias{nexus_search}
+\alias{nexusDatasetInfo}
\alias{print.nexusDatasetInfo}
\alias{print.nexusDatasetInfoList}
\alias{summary.nexusDatasetInfoList}
+\alias{nexus_info}
+\alias{nexus_get}
+\alias{nexus_search}
+\alias{[.nexusDatasetInfoList}
\title{Query and download from the Nexus network repository}
\usage{
\method{print}{nexusDatasetInfo}(x, ...)
@@ -38,7 +44,9 @@ nexus_search(q, offset = 0, limit = 10, order = c("date", "name",
\method{[}{nexusDatasetInfoList}(x, i)
}
\arguments{
-\item{x,object}{The \code{nexusDatasetInfo} object to print.}
+\item{x, object}{The \code{nexusDatasetInfo} object to print.}
+
+\item{\dots}{Currently ignored.}
\item{tags}{A character vector, the tags that are searched. If not given (or
\code{NULL}), then all datasets are listed.}
@@ -63,13 +71,9 @@ Instead of the data set ids, it is possible to supply a
\code{nexusDatasetInfo} or \code{nexusDatasetInfoList} object here directly
and then the query is done on the corresponding data set(s).}
-\item{q}{Nexus search string. See examples below. For the complete
-documentation please see the Nexus homepage at
-\url{http://nexus.igraph.org}.}
+\item{q}{Nexus search string. See examples below.}
\item{i}{Index.}
-
-\item{\dots}{Currently ignored.}
}
\value{
\code{nexus_list} and \code{nexus_search} return a list of
@@ -115,7 +119,7 @@ following fields: \describe{
the data set consists of multiple networks, then they are separated
by spaces.}
\item{tags}{Character vector, the tags of the dataset. Directed graph
- have the tags \sQuote{directed}. Undirected graphs are tagged
+ have the tags \sQuote{directed}. Undirected graphs are tagged
as \sQuote{undirected}. Other common tags are: \sQuote{weighted},
\sQuote{bipartite}, \sQuote{social network}, etc.}
\item{networks}{The ids and names of the networks in the data set. The
@@ -126,7 +130,7 @@ following fields: \describe{
\code{nexusDatasetInfo} objects returned by \code{nexus_info} have the
following additional fields: \describe{
\item{date}{Character scalar, e.g. \sQuote{2011-01-09}, the date when
- the dataset was added to the database.}
+ the dataset was added to the database.}
\item{formats}{Character vector, the data formats in which the data set is
available. The various formats are separated by semicolons.}
\item{licence}{Character scalar, the licence of the dataset.}
@@ -144,12 +148,12 @@ following additional fields: \describe{
\item{type}{Type of the attribute, either \sQuote{graph},
\sQuote{vertex} or \sQuote{edge}.}
\item{datatype}{Data type of the attribute, currently it can be
- \sQuote{numeric} and \sQuote{string}.}
+ \sQuote{numeric} and \sQuote{string}.}
\item{name}{Character scalar, the name of the attribute.}
\item{description}{Character scalar, the description of the
attribute.}
}
- }
+ }
}
The results of the Nexus queries are printed to the screen in a consise
@@ -208,7 +212,3 @@ nexus_search("name:network")
nexus_search("blog or US or karate")
}
}
-\seealso{
-\url{http://nexus.igraph.org}
-}
-
diff --git a/man/norm_coords.Rd b/man/norm_coords.Rd
index a5f0e47..ce0e693 100644
--- a/man/norm_coords.Rd
+++ b/man/norm_coords.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{norm_coords}
-\alias{layout.norm}
\alias{norm_coords}
+\alias{layout.norm}
\title{Normalize coordinates for plotting graphs}
\usage{
norm_coords(layout, xmin = -1, xmax = 1, ymin = -1, ymax = 1,
@@ -11,14 +11,14 @@ norm_coords(layout, xmin = -1, xmax = 1, ymin = -1, ymax = 1,
\arguments{
\item{layout}{A matrix with two or three columns, the layout to normalize.}
-\item{xmin,xmax}{The limits for the first coordinate, if one of them or both
+\item{xmin, xmax}{The limits for the first coordinate, if one of them or both
are \code{NULL} then no normalization is performed along this direction.}
-\item{ymin,ymax}{The limits for the second coordinate, if one of them or
+\item{ymin, ymax}{The limits for the second coordinate, if one of them or
both are \code{NULL} then no normalization is performed along this
direction.}
-\item{zmin,zmax}{The limits for the third coordinate, if one of them or both
+\item{zmin, zmax}{The limits for the third coordinate, if one of them or both
are \code{NULL} then no normalization is performed along this direction.}
}
\value{
@@ -31,47 +31,29 @@ Rescale coordinates linearly to be within given bounds.
\code{norm_coords} normalizes a layout, it linearly transforms each
coordinate separately to fit into the given limits.
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}};
+ \code{\link{layout_}}, \code{\link{merge_coords}},
\code{\link{normalize}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/normalize.Rd b/man/normalize.Rd
index c8fd5e5..48f5262 100644
--- a/man/normalize.Rd
+++ b/man/normalize.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layout.R
\name{normalize}
\alias{normalize}
@@ -8,11 +8,11 @@ normalize(xmin = -1, xmax = 1, ymin = xmin, ymax = xmax, zmin = xmin,
zmax = xmax)
}
\arguments{
-\item{xmin,xmax}{Minimum and maximum for x coordinates.}
+\item{xmin, xmax}{Minimum and maximum for x coordinates.}
-\item{ymin,ymax}{Minimum and maximum for y coordinates.}
+\item{ymin, ymax}{Minimum and maximum for y coordinates.}
-\item{zmin,zmax}{Minimum and maximum for z coordinates.}
+\item{zmin, zmax}{Minimum and maximum for z coordinates.}
}
\description{
Scale coordinates of a layout.
@@ -23,44 +23,26 @@ layout_(make_ring(10), with_fr(), normalize())
\seealso{
\code{\link{merge_coords}}, \code{\link{layout_}}.
-Other graph layouts: \code{\link{add_layout_}};
- \code{\link{as_bipartite}},
- \code{\link{layout.bipartite}},
- \code{\link{layout_as_bipartite}}; \code{\link{as_star}},
- \code{\link{layout.star}}, \code{\link{layout_as_star}};
- \code{\link{as_tree}}, \code{\link{layout_as_tree}};
- \code{\link{component_wise}}; \code{\link{in_circle}},
- \code{\link{layout_in_circle}};
- \code{\link{layout.auto}}, \code{\link{layout_nicely}},
- \code{\link{nicely}};
- \code{\link{layout.davidson.harel}},
- \code{\link{layout_with_dh}}, \code{\link{with_dh}};
- \code{\link{layout.gem}}, \code{\link{layout_with_gem}},
- \code{\link{with_gem}}; \code{\link{layout.graphopt}},
+Other layout modifiers: \code{\link{component_wise}}
+
+Other graph layouts: \code{\link{add_layout_}},
+ \code{\link{component_wise}},
+ \code{\link{layout_as_bipartite}},
+ \code{\link{layout_as_star}},
+ \code{\link{layout_as_tree}},
+ \code{\link{layout_in_circle}},
+ \code{\link{layout_nicely}},
+ \code{\link{layout_on_grid}},
+ \code{\link{layout_on_sphere}},
+ \code{\link{layout_randomly}},
+ \code{\link{layout_with_dh}},
+ \code{\link{layout_with_fr}},
+ \code{\link{layout_with_gem}},
\code{\link{layout_with_graphopt}},
- \code{\link{with_graphopt}}; \code{\link{layout.grid}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout.grid.3d}},
- \code{\link{layout_on_grid}}, \code{\link{on_grid}};
- \code{\link{layout.mds}}, \code{\link{layout_with_mds}},
- \code{\link{with_mds}}; \code{\link{layout.merge}},
- \code{\link{layout_components}},
- \code{\link{merge_coords}},
- \code{\link{piecewise.layout}},
- \code{\link{piecewise.layout}};
- \code{\link{layout.norm}}, \code{\link{norm_coords}};
- \code{\link{layout.sugiyama}},
+ \code{\link{layout_with_kk}},
+ \code{\link{layout_with_lgl}},
+ \code{\link{layout_with_mds}},
\code{\link{layout_with_sugiyama}},
- \code{\link{with_sugiyama}};
- \code{\link{layout_on_sphere}}, \code{\link{on_sphere}};
- \code{\link{layout_randomly}}, \code{\link{randomly}};
- \code{\link{layout_with_fr}}, \code{\link{with_fr}};
- \code{\link{layout_with_kk}}, \code{\link{with_kk}};
- \code{\link{layout_with_lgl}}, \code{\link{with_lgl}};
- \code{\link{layout}}, \code{\link{layout_}},
- \code{\link{print.igraph_layout_modifier}},
- \code{\link{print.igraph_layout_spec}}
-
-Other layout modifiers: \code{\link{component_wise}}
+ \code{\link{layout_}}, \code{\link{merge_coords}},
+ \code{\link{norm_coords}}
}
-
diff --git a/man/page_rank.Rd b/man/page_rank.Rd
index 5d478cf..e6ccf8a 100644
--- a/man/page_rank.Rd
+++ b/man/page_rank.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{page_rank}
+\alias{page_rank}
\alias{page.rank}
\alias{page.rank.old}
-\alias{page_rank}
+\alias{page_rank_old}
\alias{page_rank_old}
\title{The Page Rank algorithm}
\usage{
@@ -45,7 +46,10 @@ to give edge weights for calculating the weighted PageRank of vertices. If
this is \code{NULL} and the graph has a \code{weight} edge attribute then
that is used. If \code{weights} is a numerical vector then it used, even if
the graph has a \code{weights} edge attribute. If this is \code{NA}, then no
-edge weights are used (even if the graph has a \code{weight} edge attribute.}
+edge weights are used (even if the graph has a \code{weight} edge attribute.
+This function interprets edge weights as connection strengths. In the
+random surfer model, an edge with a larger weight is more likely to be
+selected by the surfer.}
\item{options}{Either a named list, to override some ARPACK options. See
\code{\link{arpack}} for details; or a named list to override the default
@@ -113,6 +117,7 @@ after a given count of iterations or if the PageRank value differences
between iterations are less than a predefined value.
}
\examples{
+
g <- sample_gnp(20, 5/20, directed=TRUE)
page_rank(g)$vector
@@ -125,10 +130,6 @@ page_rank(g3)$vector
reset <- seq(vcount(g3))
page_rank(g3, personalized=reset)$vector
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com}
-}
\references{
Sergey Brin and Larry Page: The Anatomy of a Large-Scale
Hypertextual Web Search Engine. Proceedings of the 7th World-Wide Web
@@ -138,5 +139,8 @@ Conference, Brisbane, Australia, April 1998.
Other centrality scores: \code{\link{closeness}},
\code{\link{betweenness}}, \code{\link{degree}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/path.Rd b/man/path.Rd
index 91e485d..94b8d39 100644
--- a/man/path.Rd
+++ b/man/path.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{path}
\alias{path}
@@ -45,14 +45,9 @@ g4 <- g3 + path(c("f", "c", "j", "d"), width=1:3, color="green")
E(g4)[[]]
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{vertex}},
- \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{add_vertices}},
+ \code{\link{delete_edges}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{vertex}}
}
-
diff --git a/man/permute.Rd b/man/permute.Rd
index a612f13..fa4645f 100644
--- a/man/permute.Rd
+++ b/man/permute.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{permute}
\alias{permute}
@@ -29,6 +29,7 @@ of a graph.
\code{permute} keeps all graph, vertex and edge attributes of the graph.
}
\examples{
+
# Random permutation of a random graph
g <- sample_gnm(20, 50)
g2 <- permute(g, sample(vcount(g)))
@@ -45,11 +46,10 @@ V(g2)$name
E(g2)$weight
all(sort(E(g2)$weight) == sort(E(g)$weight))
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{canonical_permutation}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/pipe.Rd b/man/pipe.Rd
index ba29b0c..837a482 100644
--- a/man/pipe.Rd
+++ b/man/pipe.Rd
@@ -1,11 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/igraph-package.R
\name{\%>\%}
\alias{\%>\%}
\title{Magrittr's pipes}
-\usage{
-lhs \%>\% rhs
-}
\arguments{
\item{lhs}{Left hand side of the pipe.}
@@ -25,4 +22,3 @@ make_ring(10) \%>\%
add_edges(c(1,6)) \%>\%
plot()
}
-
diff --git a/man/plot.igraph.Rd b/man/plot.igraph.Rd
index 793fab4..5f1c92a 100644
--- a/man/plot.igraph.Rd
+++ b/man/plot.igraph.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{plot.igraph}
-\alias{plot.graph}
\alias{plot.igraph}
+\alias{plot.graph}
\title{Plotting of graphs}
\usage{
\method{plot}{igraph}(x, axes = FALSE, add = FALSE, xlim = c(-1, 1),
@@ -66,11 +66,10 @@ first, handtune the placement of the vertices, query the coordinates by the
plot the graph to any R device.
}
\examples{
+
g <- ring(10)
\dontrun{plot(g, layout=layout_with_kk, vertex.color="green")}
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{layout}} for different layouts,
@@ -78,5 +77,7 @@ Gabor Csardi \email{csardi.gabor at gmail.com}
parameters and \code{\link{tkplot}} and \code{\link{rglplot}} for other
graph plotting functions.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/plot.sir.Rd b/man/plot.sir.Rd
index 293955b..bcc6d95 100644
--- a/man/plot.sir.Rd
+++ b/man/plot.sir.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi.R
\name{plot.sir}
\alias{plot.sir}
@@ -60,13 +60,11 @@ The number of susceptible/infected/recovered individuals is plotted over
time, for multiple simulations.
}
\examples{
+
g <- sample_gnm(100, 100)
sm <- sir(g, beta=5, gamma=1)
plot(sm)
-}
-\author{
-Eric Kolaczyk (\url{http://math.bu.edu/people/kolaczyk/}) and Gabor
-Csardi \email{csardi.gabor at gmail.com}.
+
}
\references{
Bailey, Norman T. J. (1975). The mathematical theory of
@@ -75,5 +73,8 @@ infectious diseases and its applications (2nd ed.). London: Griffin.
\seealso{
\code{\link{sir}} for running the actual simulation.
}
+\author{
+Eric Kolaczyk (\url{http://math.bu.edu/people/kolaczyk/}) and Gabor
+Csardi \email{csardi.gabor at gmail.com}.
+}
\keyword{graphs}
-
diff --git a/man/plot_dendrogram.communities.Rd b/man/plot_dendrogram.communities.Rd
index cd5b851..126a59b 100644
--- a/man/plot_dendrogram.communities.Rd
+++ b/man/plot_dendrogram.communities.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{plot_dendrogram}
-\alias{dendPlot}
\alias{plot_dendrogram}
+\alias{dendPlot}
\alias{plot_dendrogram.communities}
\title{Community structure dendrogram plots}
\usage{
@@ -17,13 +17,13 @@ plot_dendrogram(x, mode = igraph_opt("dend.plot.type"), ...)
\item{mode}{Which dendrogram plotting function to use. See details below.}
+\item{\dots}{Additional arguments to supply to the dendrogram plotting
+function.}
+
\item{use.modularity}{Logical scalar, whether to use the modularity values
to define the height of the branches.}
\item{palette}{The color palette to use for colored plots.}
-
-\item{\dots}{Additional arguments to supply to the dendrogram plotting
-function.}
}
\value{
Returns whatever the return value was from the plotting function,
@@ -89,12 +89,13 @@ The syntax for \code{plot.dendrogram} (\code{mode="dendrogram"}):
} The extra arguments are simply passed to \code{as.dendrogram}.
}
\examples{
+
karate <- make_graph("Zachary")
fc <- cluster_fast_greedy(karate)
plot_dendrogram(fc)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/plot_dendrogram.igraphHRG.Rd b/man/plot_dendrogram.igraphHRG.Rd
index 4fbe545..9990d5e 100644
--- a/man/plot_dendrogram.igraphHRG.Rd
+++ b/man/plot_dendrogram.igraphHRG.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{plot_dendrogram.igraphHRG}
-\alias{hrg.dendrogram}
\alias{plot_dendrogram.igraphHRG}
+\alias{hrg.dendrogram}
\title{HRG dendrogram plot}
\usage{
\method{plot_dendrogram}{igraphHRG}(x, mode = igraph_opt("dend.plot.type"),
@@ -81,12 +81,13 @@ The syntax for \code{plot.dendrogram} (\code{mode="dendrogram"}):
} The extra arguments are simply passed to \code{as.dendrogram}.
}
\examples{
+
g <- make_full_graph(5) + make_full_graph(5)
hrg <- fit_hrg(g)
plot_dendrogram(hrg)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/plus-.igraph.Rd b/man/plus-.igraph.Rd
index c6c92fd..d0652eb 100644
--- a/man/plus-.igraph.Rd
+++ b/man/plus-.igraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{+.igraph}
\alias{+.igraph}
@@ -104,14 +104,9 @@ g$layout <- layout_in_circle
plot(g)
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{-.igraph}},
- \code{\link{igraph-minus}}; \code{\link{add.edges}},
- \code{\link{add_edges}}; \code{\link{add.vertices}},
- \code{\link{add_vertices}}; \code{\link{delete.edges}},
- \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{path}};
- \code{\link{vertex}}, \code{\link{vertices}}
+Other functions for manipulating graph structure: \code{\link{add_edges}},
+ \code{\link{add_vertices}}, \code{\link{delete_edges}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{path}},
+ \code{\link{vertex}}
}
-
diff --git a/man/power_centrality.Rd b/man/power_centrality.Rd
index 994495b..9b1b8c1 100644
--- a/man/power_centrality.Rd
+++ b/man/power_centrality.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{power_centrality}
-\alias{bonpow}
\alias{power_centrality}
+\alias{bonpow}
\title{Find Bonacich Power Centrality Scores of Network Positions}
\usage{
power_centrality(graph, nodes = V(graph), loops = FALSE, exponent = 1,
@@ -88,7 +88,9 @@ fixed when I get a better algorithm. \code{power_centrality} will not symmetriz
data before extracting eigenvectors; don't send this routine asymmetric
matrices unless you really mean to do so.
}
+
\examples{
+
# Generate some test data from Bonacich, 1987:
g.c <- graph( c(1,2,1,3,2,4,3,5), dir=FALSE)
g.d <- graph( c(1,2,1,3,1,4,2,5,3,6,4,7), dir=FALSE)
@@ -110,11 +112,7 @@ for (e in seq(-0.4,.4, by=0.1)) {
for (e in seq(-0.4,.4, by=0.1)) {
print(round(power_centrality(g.f, exp=e)[c(1,2,5)], 2))
}
-}
-\author{
-Carter T. Butts
-(\url{http://www.faculty.uci.edu/profile.cfm?faculty_id=5057}), ported to
-igraph by Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Bonacich, P. (1972). ``Factoring and Weighting Approaches to
@@ -127,5 +125,9 @@ Bonacich, P. (1987). ``Power and Centrality: A Family of Measures.''
\seealso{
\code{\link{eigen_centrality}} and \code{\link{alpha_centrality}}
}
+\author{
+Carter T. Butts
+(\url{http://www.faculty.uci.edu/profile.cfm?faculty_id=5057}), ported to
+igraph by Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/predict_edges.Rd b/man/predict_edges.Rd
index b3ed071..307560d 100644
--- a/man/predict_edges.Rd
+++ b/man/predict_edges.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{predict_edges}
-\alias{hrg.predict}
\alias{predict_edges}
+\alias{hrg.predict}
\title{Predict edges based on a hierarchical random graph model}
\usage{
predict_edges(graph, hrg = NULL, start = FALSE, num.samples = 10000,
@@ -74,12 +74,8 @@ Notes in Computer Science} 4503, 1--13. Springer-Verlag, Berlin Heidelberg
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg_tree}}; \code{\link{hrg}},
- \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}};
- \code{\link{print.igraphHRG}}
+ \code{\link{fit_hrg}}, \code{\link{hrg-methods}},
+ \code{\link{hrg_tree}}, \code{\link{hrg}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/print.igraph.Rd b/man/print.igraph.Rd
index ad6253d..a6a26ef 100644
--- a/man/print.igraph.Rd
+++ b/man/print.igraph.Rd
@@ -1,7 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/print.R
\name{print.igraph}
\alias{print.igraph}
+\alias{print_all}
+\alias{summary.igraph}
\alias{str.igraph}
\alias{summary.igraph}
\title{Print graphs to the terminal}
@@ -33,9 +35,9 @@ the \code{name} vertex attribute) or vertex ids.}
\item{max.lines}{The maximum number of lines to use. The rest of the
output will be truncated.}
-\item{object}{The graph of which the summary will be printed.}
-
\item{\dots}{Additional agruments.}
+
+\item{object}{The graph of which the summary will be printed.}
}
\value{
All these functions return the graph invisibly.
@@ -48,22 +50,24 @@ form.
\code{summary.igraph} prints the number of vertices, edges and whether the
graph is directed.
-\code{str.igraph} prints the same information, and also lists the edges, and
+\code{print_all} prints the same information, and also lists the edges, and
optionally graph, vertex and/or edge attributes.
\code{print.igraph} behaves either as \code{summary.igraph} or
-\code{str.igraph} depending on the \code{full} argument. See also the
+\code{print_all} depending on the \code{full} argument. See also the
\sQuote{print.full} igraph option and \code{\link{igraph_opt}}.
The graph summary printed by \code{summary.igraph} (and \code{print.igraph}
-and \code{str.igraph}) consists one or more lines. The first line contains
+and \code{print_all}) consists one or more lines. The first line contains
the basic properties of the graph, and the rest contains its attributes.
Here is an example, a small star graph with weighed directed edges and named
-vertices: \preformatted{ IGRAPH DNW- 10 9 -- In-star
+vertices: \preformatted{ IGRAPH badcafe DNW- 10 9 -- In-star
+ attr: name (g/c), mode (g/c), center (g/n), name (v/c),
weight (e/n) }
The first line always
starts with \code{IGRAPH}, showing you that the object is an igraph graph.
+Then a seven character code is printed, this the first seven characters
+of the unique id of the graph. See \code{\link{graph_id}} for more.
Then a four letter long code string is printed. The first letter
distinguishes between directed (\sQuote{\code{D}}) and undirected
(\sQuote{\code{U}}) graphs. The second letter is \sQuote{\code{N}} for named
@@ -82,16 +86,20 @@ comma. After the attribute names, the kind of the attribute -- graph
(\sQuote{\code{c}}), numeric (\sQuote{\code{n}}), logical
(\sQuote{\code{l}}), or other (\sQuote{\code{x}}).
-As of igraph 0.4 \code{str.igraph} and \code{print.igraph} use the
+As of igraph 0.4 \code{print_all} and \code{print.igraph} use the
\code{max.print} option, see \code{\link[base]{options}} for details.
+
+As of igraph 1.1.1, the \code{str.igraph} function is defunct, use
+\code{print_all()}.
}
\examples{
+
g <- make_ring(10)
g
summary(g)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/print.igraph.es.Rd b/man/print.igraph.es.Rd
index 9a551dc..d8da01d 100644
--- a/man/print.igraph.es.Rd
+++ b/man/print.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{print.igraph.es}
\alias{print.igraph.es}
@@ -52,32 +52,12 @@ E(g4)[[]]
E(g4)[[1:5]]
}
\seealso{
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
\code{\link{print.igraph.vs}}
}
-
diff --git a/man/print.igraph.vs.Rd b/man/print.igraph.vs.Rd
index fcf7ff0..ff48f9b 100644
--- a/man/print.igraph.vs.Rd
+++ b/man/print.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{print.igraph.vs}
\alias{print.igraph.vs}
@@ -18,7 +18,7 @@ to the screen size.}
The vertex sequence, invisibly.
}
\description{
-For long vertex sequences, the printing is truncated to fit to the
+For long vertex sequences, the printing is truncated to fit to the
screen. Use \code{print} explicitly and the \code{full} argument to
see the full sequence.
}
@@ -50,32 +50,12 @@ V(g4)[[]]
V(g4)[[2:5, 7:8]]
}
\seealso{
-Other vertex and edge sequences: \code{\link{$.igraph.es}},
- \code{\link{$<-.igraph.es}}, \code{\link{E<-}},
- \code{\link{[<-.igraph.es}},
- \code{\link{[[<-.igraph.es}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}},
- \code{\link{igraph-es-attributes}};
- \code{\link{$.igraph.vs}}, \code{\link{$<-.igraph.vs}},
- \code{\link{V<-}}, \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
+Other vertex and edge sequences: \code{\link{E}},
+ \code{\link{V}}, \code{\link{igraph-es-attributes}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
\code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}}; \code{\link{E}};
- \code{\link{V}}; \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
\code{\link{print.igraph.es}}
}
-
diff --git a/man/print.igraphHRG.Rd b/man/print.igraphHRG.Rd
index 2d4fe69..2d2aef2 100644
--- a/man/print.igraphHRG.Rd
+++ b/man/print.igraphHRG.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{print.igraphHRG}
\alias{print.igraphHRG}
@@ -26,10 +26,10 @@ print function. By default the \code{auto} type is used, which selects
\code{tree} for small graphs and \code{simple} (=list) for bigger
ones. The \code{tree} format looks like
this: \preformatted{Hierarchical random graph, at level 3:
-g1 p= 0
-'- g15 p=0.33 1
- '- g13 p=0.88 6 3 9 4 2 10 7 5 8
-'- g8 p= 0.5
+g1 p= 0
+'- g15 p=0.33 1
+ '- g13 p=0.88 6 3 9 4 2 10 7 5 8
+'- g8 p= 0.5
'- g16 p= 0.2 20 14 17 19 11 15 16 13
'- g5 p= 0 12 18 }
This is a graph with 20 vertices, and the
@@ -43,24 +43,21 @@ single vertex (vertex 1), and another larger subgroup that contains
vertices 6, 3, etc. on lower levels, etc.
The \code{plain} printing is simpler and faster to produce, but less
visual: \preformatted{Hierarchical random graph:
-g1 p=0.0 -> g12 g10 g2 p=1.0 -> 7 10 g3 p=1.0 -> g18 14
-g4 p=1.0 -> g17 15 g5 p=0.4 -> g15 17 g6 p=0.0 -> 1 4
-g7 p=1.0 -> 11 16 g8 p=0.1 -> g9 3 g9 p=0.3 -> g11 g16
-g10 p=0.2 -> g4 g5 g11 p=1.0 -> g6 5 g12 p=0.8 -> g8 8
-g13 p=0.0 -> g14 9 g14 p=1.0 -> 2 6 g15 p=0.2 -> g19 18
-g16 p=1.0 -> g13 g2 g17 p=0.5 -> g7 13 g18 p=1.0 -> 12 19
+g1 p=0.0 -> g12 g10 g2 p=1.0 -> 7 10 g3 p=1.0 -> g18 14
+g4 p=1.0 -> g17 15 g5 p=0.4 -> g15 17 g6 p=0.0 -> 1 4
+g7 p=1.0 -> 11 16 g8 p=0.1 -> g9 3 g9 p=0.3 -> g11 g16
+g10 p=0.2 -> g4 g5 g11 p=1.0 -> g6 5 g12 p=0.8 -> g8 8
+g13 p=0.0 -> g14 9 g14 p=1.0 -> 2 6 g15 p=0.2 -> g19 18
+g16 p=1.0 -> g13 g2 g17 p=0.5 -> g7 13 g18 p=1.0 -> 12 19
g19 p=0.7 -> g3 20}
It lists the two subgroups of each internal node, in
as many columns as the screen width allows.
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg_tree}}; \code{\link{hrg}},
- \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}}
+ \code{\link{fit_hrg}}, \code{\link{hrg-methods}},
+ \code{\link{hrg_tree}}, \code{\link{hrg}},
+ \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
+ \code{\link{sample_hrg}}
}
-
diff --git a/man/print.igraphHRGConsensus.Rd b/man/print.igraphHRGConsensus.Rd
index 3153cdc..5af6ca7 100644
--- a/man/print.igraphHRGConsensus.Rd
+++ b/man/print.igraphHRGConsensus.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{print.igraphHRGConsensus}
\alias{print.igraphHRGConsensus}
@@ -19,18 +19,15 @@ Consensus dendrograms (\code{igraphHRGConsensus} objects) are printed
simply by listing the children of each internal node of the
dendrogram: \preformatted{HRG consensus tree:
g1 -> 11 12 13 14 15 16 17 18 19 20
-g2 -> 1 2 3 4 5 6 7 8 9 10
+g2 -> 1 2 3 4 5 6 7 8 9 10
g3 -> g1 g2}
The root of the dendrogram is \code{g3} (because it has no incoming
edges), and it has two subgroups, \code{g1} and \code{g2}.
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.game}}, \code{\link{sample_hrg}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg_tree}}; \code{\link{hrg}},
- \code{\link{hrg.create}}; \code{\link{print.igraphHRG}}
+ \code{\link{fit_hrg}}, \code{\link{hrg-methods}},
+ \code{\link{hrg_tree}}, \code{\link{hrg}},
+ \code{\link{predict_edges}},
+ \code{\link{print.igraphHRG}}, \code{\link{sample_hrg}}
}
-
diff --git a/man/printer_callback.Rd b/man/printer_callback.Rd
new file mode 100644
index 0000000..46ab182
--- /dev/null
+++ b/man/printer_callback.Rd
@@ -0,0 +1,36 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/printr.R
+\name{printer_callback}
+\alias{printer_callback}
+\title{Create a printer callback function}
+\usage{
+printer_callback(fun)
+}
+\arguments{
+\item{fun}{The function to use as a printer callback function.}
+}
+\description{
+A printer callback fucntion is a function can performs the actual
+printing. It has a number of subcommands, that are called by
+the \code{printer} package, in a form \preformatted{
+ printer_callback("subcommand", argument1, argument2, ...)
+} See the examples below.
+}
+\details{
+The subcommands:
+
+\describe{
+ \item{\code{length}}{The length of the data to print, the number of
+ items, in natural units. E.g. for a list of objects, it is the
+ number of objects.}
+ \item{\code{min_width}}{TODO}
+ \item{\code{width}}{Width of one item, if \code{no} items will be
+ printed. TODO}
+ \item{\code{print}}{Argument: \code{no}. Do the actual printing,
+ print \code{no} items.}
+ \item{\code{done}}{TODO}
+}
+}
+\seealso{
+Other printer callbacks: \code{\link{is_printer_callback}}
+}
diff --git a/man/printr.Rd b/man/printr.Rd
new file mode 100644
index 0000000..b690b34
--- /dev/null
+++ b/man/printr.Rd
@@ -0,0 +1,10 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/printr.R
+\docType{package}
+\name{printr}
+\alias{printr}
+\alias{printr-package}
+\title{Better printing of R packages}
+\description{
+Better printing of R packages
+}
diff --git a/man/r_pal.Rd b/man/r_pal.Rd
index 48b00b2..f3c916d 100644
--- a/man/r_pal.Rd
+++ b/man/r_pal.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/palette.R
\name{r_pal}
\alias{r_pal}
@@ -18,7 +18,6 @@ colors of older igraph versions. Its colors are appropriate
for categories, but they are not very attractive.
}
\seealso{
-Other palettes: \code{\link{categorical_pal}};
- \code{\link{diverging_pal}}; \code{\link{sequential_pal}}
+Other palettes: \code{\link{categorical_pal}},
+ \code{\link{diverging_pal}}, \code{\link{sequential_pal}}
}
-
diff --git a/man/radius.Rd b/man/radius.Rd
index afc5c3e..a8081bf 100644
--- a/man/radius.Rd
+++ b/man/radius.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paths.R
\name{radius}
\alias{radius}
@@ -46,4 +46,3 @@ Harary, F. Graph Theory. Reading, MA: Addison-Wesley, p. 35,
calculations, code{\link{distances}} for general shortest path
calculations.
}
-
diff --git a/man/random_walk.Rd b/man/random_walk.Rd
index 401b1bd..8622503 100644
--- a/man/random_walk.Rd
+++ b/man/random_walk.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/random_walk.R
\name{random_walk}
\alias{random_walk}
@@ -16,7 +16,7 @@ random_walk(graph, start, steps, mode = c("out", "in", "all"),
\item{mode}{How to follow directed edges. \code{"out"} steps along the
edge direction, \code{"in"} is opposite to that. \code{"all"} ignores
-edge directions. This argument is ignored for directed graphs.}
+edge directions. This argument is ignored for undirected graphs.}
\item{stuck}{What to do if the random walk gets stuck. \code{"return"}
returns the partial walk, \code{"error"} raises an error.}
@@ -45,4 +45,3 @@ cor(table(w), ec)
## But these are (almost) the same
cor(table(w), pg)
}
-
diff --git a/man/read_graph.Rd b/man/read_graph.Rd
index 985e78e..371c646 100644
--- a/man/read_graph.Rd
+++ b/man/read_graph.Rd
@@ -1,14 +1,14 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/foreign.R
\name{read_graph}
-\alias{DL}
-\alias{GML}
-\alias{GraphML}
+\alias{read_graph}
+\alias{read.graph}
\alias{LGL}
\alias{Pajek}
+\alias{GraphML}
+\alias{GML}
+\alias{DL}
\alias{UCINET}
-\alias{read.graph}
-\alias{read_graph}
\title{Reading foreign file formats}
\usage{
read_graph(file, format = c("edgelist", "pajek", "ncol", "lgl", "graphml",
@@ -50,11 +50,11 @@ then it is ignored; so it is safe to set it to zero (the default).}
\item{directed}{Logical scalar, whether to create a directed graph. The
default value is \code{TRUE}.} }
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
+
\seealso{
\code{\link{write_graph}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/reciprocity.Rd b/man/reciprocity.Rd
index 1b7fc4e..d53ef6d 100644
--- a/man/reciprocity.Rd
+++ b/man/reciprocity.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{reciprocity}
\alias{reciprocity}
@@ -37,12 +37,13 @@ The result is the size of group (3), divided by the sum of group sizes
(2)+(3). This measure is calculated if \code{mode} is \code{ratio}.
}
\examples{
+
g <- sample_gnp(20, 5/20, directed=TRUE)
reciprocity(g)
+
}
\author{
Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
\email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/rep.igraph.Rd b/man/rep.igraph.Rd
index 4256799..beba58c 100644
--- a/man/rep.igraph.Rd
+++ b/man/rep.igraph.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{rep.igraph}
-\alias{*.igraph}
\alias{rep.igraph}
+\alias{*.igraph}
\title{Replicate a graph multiple times}
\usage{
\method{rep}{igraph}(x, n, mark = TRUE, ...)
@@ -19,7 +19,7 @@ an integer number denoting which replication the vertex is coming
from.}
\item{...}{Additional arguments to satisfy S3 requirements,
- currently ignored.}
+currently ignored.}
}
\description{
The new graph will contain the input graph the given number
@@ -28,4 +28,3 @@ of times, as unconnected components.
\examples{
rings <- make_ring(5) * 5
}
-
diff --git a/man/rev.igraph.es.Rd b/man/rev.igraph.es.Rd
index 1462296..5525cf2 100644
--- a/man/rev.igraph.es.Rd
+++ b/man/rev.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{rev.igraph.es}
\alias{rev.igraph.es}
@@ -21,24 +21,19 @@ E(g)
E(g) \%>\% rev()
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/rev.igraph.vs.Rd b/man/rev.igraph.vs.Rd
index 84d0f9a..0f06af2 100644
--- a/man/rev.igraph.vs.Rd
+++ b/man/rev.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{rev.igraph.vs}
\alias{rev.igraph.vs}
@@ -20,24 +20,19 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
V(g) \%>\% rev()
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/rewire.Rd b/man/rewire.Rd
index 9a86fc4..ecc60ae 100644
--- a/man/rewire.Rd
+++ b/man/rewire.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rewire.R
\name{rewire}
\alias{rewire}
@@ -23,10 +23,9 @@ g <- make_ring(10)
g \%>\%
rewire(each_edge(p = .1, loops = FALSE)) \%>\%
plot(layout=layout_in_circle)
-str(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
+print_all(rewire(g, with = keeping_degseq(niter = vcount(g) * 10)))
}
\seealso{
-Other rewiring functions: \code{\link{each_edge}};
+Other rewiring functions: \code{\link{each_edge}},
\code{\link{keeping_degseq}}
}
-
diff --git a/man/rglplot.Rd b/man/rglplot.Rd
index d46811c..a95ec34 100644
--- a/man/rglplot.Rd
+++ b/man/rglplot.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.R
\name{rglplot}
\alias{rglplot}
@@ -27,18 +27,19 @@ very useful either. See \code{\link{igraph.plotting}} for the possible
arguments.
}
\examples{
+
\dontrun{
g <- make_lattice( c(5,5,5) )
coords <- layout_with_fr(g, dim=3)
rglplot(g, layout=coords)
}
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{igraph.plotting}}, \code{\link{plot.igraph}} for the 2D
version, \code{\link{tkplot}} for interactive graph drawing in 2D.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/running_mean.Rd b/man/running_mean.Rd
index 8b95bf2..45eae46 100644
--- a/man/running_mean.Rd
+++ b/man/running_mean.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/other.R
\name{running_mean}
-\alias{running.mean}
\alias{running_mean}
+\alias{running.mean}
\title{Running mean of a time series}
\usage{
running_mean(v, binwidth)
@@ -27,10 +27,11 @@ the first \code{binwidth} elements of \code{v}, the second element of
\code{w} is the average of elements \code{2:(binwidth+1)}, etc.
}
\examples{
+
running_mean(1:100, 10)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{manip}
-
diff --git a/man/sample_.Rd b/man/sample_.Rd
index 7e6666d..8c2d1c5 100644
--- a/man/sample_.Rd
+++ b/man/sample_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{sample_}
\alias{sample_}
@@ -27,4 +27,3 @@ blocky2 <- pref_matrix \%>\%
blocky3 <- pref_matrix \%>\%
sample_(sbm(), n = 20, block.sizes = c(10, 10))
}
-
diff --git a/man/sample_bipartite.Rd b/man/sample_bipartite.Rd
index 9b1e572..ee6b350 100644
--- a/man/sample_bipartite.Rd
+++ b/man/sample_bipartite.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_bipartite}
-\alias{bipartite}
-\alias{bipartite.random.game}
\alias{sample_bipartite}
+\alias{bipartite.random.game}
+\alias{bipartite}
\title{Bipartite random graphs}
\usage{
sample_bipartite(n1, n2, type = c("gnp", "gnm"), p, m, directed = FALSE,
@@ -52,6 +52,7 @@ with probablity $p$, independently of the rest of the edges. In $G(n,m)$, we
uniformly choose $m$ edges to realize.
}
\examples{
+
## empty graph
sample_bipartite(10, 5, p=0)
@@ -63,12 +64,12 @@ sample_bipartite(10, 5, p=.1)
## directed bipartite graph, G(n,m)
sample_bipartite(10, 5, type="Gnm", m=20, directed=TRUE, mode="all")
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{sample_gnp}} for the unipartite version.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_correlated_gnp.Rd b/man/sample_correlated_gnp.Rd
index cc56316..8ef2ab0 100644
--- a/man/sample_correlated_gnp.Rd
+++ b/man/sample_correlated_gnp.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_correlated_gnp}
\alias{sample_correlated_gnp}
@@ -50,4 +50,3 @@ graph matching for correlated Erdos-Renyi graphs.
\code{\link{sample_correlated_gnp_pair}},
\code{\link{sample_gnp}}
}
-
diff --git a/man/sample_correlated_gnp_pair.Rd b/man/sample_correlated_gnp_pair.Rd
index eae691b..8110d4c 100644
--- a/man/sample_correlated_gnp_pair.Rd
+++ b/man/sample_correlated_gnp_pair.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_correlated_gnp_pair}
\alias{sample_correlated_gnp_pair}
@@ -51,4 +51,3 @@ graph matching for correlated Erdos-Renyi graphs.
}
\keyword{graphs}
\keyword{graphs,random}
-
diff --git a/man/sample_degseq.Rd b/man/sample_degseq.Rd
index e4b1e78..5da0c72 100644
--- a/man/sample_degseq.Rd
+++ b/man/sample_degseq.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_degseq}
+\alias{sample_degseq}
\alias{degree.sequence.game}
\alias{degseq}
-\alias{sample_degseq}
\title{Generate random graphs with a given degree sequence}
\usage{
sample_degseq(out.deg, in.deg = NULL, method = c("simple", "vl",
@@ -57,10 +57,10 @@ first creating an initial (possibly unconnected) simple undirected graph
with the given degree sequence (if this is possible at all). Then some
rewiring is done to make the graph connected. Finally a Monte-Carlo
algorithm is used to randomize the graph. The \dQuote{vl} samples from the
-undirected, connected simple graphs unformly. See
-\url{http://www-rp.lip6.fr/~latapy/FV/generation.html} for details.
+undirected, connected simple graphs unformly.
}
\examples{
+
## The simple generator
g <- sample_degseq(rep(2,100))
degree(g)
@@ -88,12 +88,11 @@ if (sum(degs) \%\% 2 != 0) { degs[1] <- degs[1] + 1 }
g5 <- sample_degseq(degs, method="vl")
all(degree(g5) == degs)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{sample_gnp}}, \code{\link{sample_pa}},
\code{\link{simplify}} to get rid of the multiple and/or loops edges.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_dirichlet.Rd b/man/sample_dirichlet.Rd
index 3ce54d2..0e1b51c 100644
--- a/man/sample_dirichlet.Rd
+++ b/man/sample_dirichlet.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{sample_dirichlet}
\alias{sample_dirichlet}
@@ -32,7 +32,6 @@ RDP.graph.2 <- sample_dot_product(lpvs.dir)
colSums(lpvs.dir)
}
\seealso{
-Other latent position vector samplers: \code{\link{sample_sphere_surface}};
+Other latent position vector samplers: \code{\link{sample_sphere_surface}},
\code{\link{sample_sphere_volume}}
}
-
diff --git a/man/sample_dot_product.Rd b/man/sample_dot_product.Rd
index 46095a0..33810b9 100644
--- a/man/sample_dot_product.Rd
+++ b/man/sample_dot_product.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_dot_product}
-\alias{dot_product}
\alias{sample_dot_product}
+\alias{dot_product}
\title{Generate random graphs according to the random dot product graph model}
\usage{
sample_dot_product(vecs, directed = FALSE)
@@ -31,6 +31,7 @@ interval, otherwise a warning is given. For negative dot products, no edges
are added; dot products that are larger than one always add an edge.
}
\examples{
+
## A randomly generated graph
lpvs <- matrix(rnorm(200), 20, 10)
lpvs <- apply(lpvs, 2, function(x) { return (abs(x)/sqrt(sum(x^2))) })
@@ -42,9 +43,6 @@ lpvs2 <- sample_sphere_surface(dim=5, n=20)
g2 <- sample_dot_product(lpvs2)
g2
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Christine Leigh Myers Nickel: Random dot product graphs, a model
for social networks. Dissertation, Johns Hopkins University, Maryland, USA,
@@ -54,5 +52,7 @@ for social networks. Dissertation, Johns Hopkins University, Maryland, USA,
\code{\link{sample_dirichlet}}, \code{\link{sample_sphere_surface}}
and \code{\link{sample_sphere_volume}} for sampling position vectors.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_fitness.Rd b/man/sample_fitness.Rd
index 3fc739c..63999b8 100644
--- a/man/sample_fitness.Rd
+++ b/man/sample_fitness.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_fitness}
\alias{sample_fitness}
@@ -62,18 +62,18 @@ distribution. Alternatively, you may use \code{\link{sample_fitness_pl}}
which generates the fitnesses for you with a given exponent.
}
\examples{
+
N <- 10000
g <- sample_fitness(5*N, sample((1:50)^-2, N, replace=TRUE))
degree_distribution(g)
\dontrun{plot(degree_distribution(g, cumulative=TRUE), log="xy")}
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\references{
Goh K-I, Kahng B, Kim D: Universal behaviour of load
distribution in scale-free networks. \emph{Phys Rev Lett} 87(27):278701,
2001.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_fitness_pl.Rd b/man/sample_fitness_pl.Rd
index 46e75b7..924e699 100644
--- a/man/sample_fitness_pl.Rd
+++ b/man/sample_fitness_pl.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_fitness_pl}
\alias{sample_fitness_pl}
@@ -64,12 +64,10 @@ the square root of the number of edges times the average degree; see the
paper of Chung and Lu, and Cho et al for more details.
}
\examples{
+
g <- sample_fitness_pl(10000, 30000, 2.2, 2.3)
\dontrun{plot(degree_distribution(g, cumulative=TRUE, mode="out"), log="xy")}
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\references{
Goh K-I, Kahng B, Kim D: Universal behaviour of load
distribution in scale-free networks. \emph{Phys Rev Lett} 87(27):278701,
@@ -82,5 +80,7 @@ Cho YS, Kim JS, Park J, Kahng B, Kim D: Percolation transitions in
scale-free networks under the Achlioptas process. \emph{Phys Rev Lett}
103:135702, 2009.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_forestfire.Rd b/man/sample_forestfire.Rd
index b154cd7..e23989c 100644
--- a/man/sample_forestfire.Rd
+++ b/man/sample_forestfire.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_forestfire}
-\alias{forest.fire.game}
\alias{sample_forestfire}
+\alias{forest.fire.game}
\title{Forest Fire Network Model}
\usage{
sample_forestfire(nodes, fw.prob, bw.factor = 1, ambs = 1,
@@ -56,15 +56,13 @@ corrected version is available from
implementation is based on this.
}
\examples{
+
g <- sample_forestfire(10000, fw.prob=0.37, bw.factor=0.32/0.37)
dd1 <- degree_distribution(g, mode="in")
dd2 <- degree_distribution(g, mode="out")
plot(seq(along=dd1)-1, dd1, log="xy")
points(seq(along=dd2)-1, dd2, col=2, pch=2)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Jure Leskovec, Jon Kleinberg and Christos Faloutsos. Graphs over
time: densification laws, shrinking diameters and possible explanations.
@@ -75,5 +73,7 @@ conference on Knowledge discovery in data mining}, 177--187, 2005.
\code{\link{barabasi.game}} for the basic preferential attachment
model.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_gnm.Rd b/man/sample_gnm.Rd
index c619dea..c840f56 100644
--- a/man/sample_gnm.Rd
+++ b/man/sample_gnm.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_gnm}
-\alias{gnm}
\alias{sample_gnm}
+\alias{gnm}
\title{Generate random graphs according to the G(n,m) Erdos-Renyi model}
\usage{
sample_gnm(n, m, directed = FALSE, loops = FALSE)
@@ -35,12 +35,10 @@ possible edges. This set includes loop edges as well if the \code{loops}
parameter is TRUE.
}
\examples{
+
g <- sample_gnm(1000, 1000)
degree_distribution(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Erdos, P. and Renyi, A., On random graphs, \emph{Publicationes
Mathematicae} 6, 290--297 (1959).
@@ -48,5 +46,7 @@ Mathematicae} 6, 290--297 (1959).
\seealso{
\code{\link{sample_gnp}}, \code{\link{sample_pa}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_gnp.Rd b/man/sample_gnp.Rd
index 750c527..2818874 100644
--- a/man/sample_gnp.Rd
+++ b/man/sample_gnp.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_gnp}
-\alias{gnp}
\alias{sample_gnp}
+\alias{gnp}
\title{Generate random graphs according to the G(n,p) Erdos-Renyi model}
\usage{
sample_gnp(n, p, directed = FALSE, loops = FALSE)
@@ -34,12 +34,10 @@ The graph has \sQuote{n} vertices and for each edge the
probability that it is present in the graph is \sQuote{p}.
}
\examples{
+
g <- sample_gnp(1000, 1/1000)
degree_distribution(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Erdos, P. and Renyi, A., On random graphs, \emph{Publicationes
Mathematicae} 6, 290--297 (1959).
@@ -47,5 +45,7 @@ Mathematicae} 6, 290--297 (1959).
\seealso{
\code{\link{sample_gnm}}, \code{\link{sample_pa}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_grg.Rd b/man/sample_grg.Rd
index e80eedc..7c148c4 100644
--- a/man/sample_grg.Rd
+++ b/man/sample_grg.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_grg}
-\alias{grg}
-\alias{grg.game}
\alias{sample_grg}
+\alias{grg.game}
+\alias{grg}
\title{Geometric random graphs}
\usage{
sample_grg(nodes, radius, torus = FALSE, coords = FALSE)
@@ -39,15 +39,16 @@ Euclidean norm than a given radius. If the \code{torus} argument is
\code{TRUE} then a unit area torus is used instead of a square.
}
\examples{
+
g <- sample_grg(1000, 0.05, torus=FALSE)
g2 <- sample_grg(1000, 0.05, torus=TRUE)
+
+}
+\seealso{
+\code{\link{sample_gnp}}
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}, first version was
written by Keith Briggs (\url{http://keithbriggs.info/}).
}
-\seealso{
-\code{\link{sample_gnp}}
-}
\keyword{graphs}
-
diff --git a/man/sample_growing.Rd b/man/sample_growing.Rd
index 1c9af5b..40c72ff 100644
--- a/man/sample_growing.Rd
+++ b/man/sample_growing.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_growing}
-\alias{growing}
-\alias{growing.random.game}
\alias{sample_growing}
+\alias{growing.random.game}
+\alias{growing}
\title{Growing random graph generation}
\usage{
sample_growing(n, m = 1, directed = TRUE, citation = FALSE)
@@ -36,14 +36,15 @@ vertices, otherwise the edges are connecting new vertex to uniformly
randomly chosen old vertices.
}
\examples{
+
g <- sample_growing(500, citation=FALSE)
g2 <- sample_growing(500, citation=TRUE)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{sample_pa}}, \code{\link{sample_gnp}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_hierarchical_sbm.Rd b/man/sample_hierarchical_sbm.Rd
index cbd0b2d..70de594 100644
--- a/man/sample_hierarchical_sbm.Rd
+++ b/man/sample_hierarchical_sbm.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_hierarchical_sbm}
-\alias{hierarchical_sbm}
\alias{sample_hierarchical_sbm}
+\alias{hierarchical_sbm}
\title{Sample the hierarchical stochastic block model}
\usage{
sample_hierarchical_sbm(n, m, rho, C, p)
@@ -40,6 +40,7 @@ The function generates a random graph according to the hierarchical
stochastic block model.
}
\examples{
+
## Ten blocks with three clusters each
C <- matrix(c(1 , 3/4, 0,
3/4, 0, 3/4,
@@ -48,13 +49,12 @@ g <- sample_hierarchical_sbm(100, 10, rho=c(3, 3, 4)/10, C=C, p=1/20)
g
if (require(Matrix)) { image(g[]) }
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{sbm.game}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
\keyword{graphs,}
\keyword{random}
-
diff --git a/man/sample_hrg.Rd b/man/sample_hrg.Rd
index e245c42..147261e 100644
--- a/man/sample_hrg.Rd
+++ b/man/sample_hrg.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hrg.R
\name{sample_hrg}
-\alias{hrg.game}
\alias{sample_hrg}
+\alias{hrg.game}
\title{Sample from a hierarchical random graph model}
\usage{
sample_hrg(hrg)
@@ -19,12 +19,9 @@ model.
}
\seealso{
Other hierarchical random graph functions: \code{\link{consensus_tree}},
- \code{\link{hrg.consensus}}; \code{\link{fit_hrg}},
- \code{\link{hrg.fit}}; \code{\link{hrg-methods}};
- \code{\link{hrg.predict}}, \code{\link{predict_edges}};
- \code{\link{hrg_tree}}; \code{\link{hrg}},
- \code{\link{hrg.create}};
- \code{\link{print.igraphHRGConsensus}};
+ \code{\link{fit_hrg}}, \code{\link{hrg-methods}},
+ \code{\link{hrg_tree}}, \code{\link{hrg}},
+ \code{\link{predict_edges}},
+ \code{\link{print.igraphHRGConsensus}},
\code{\link{print.igraphHRG}}
}
-
diff --git a/man/sample_islands.Rd b/man/sample_islands.Rd
index 7bf882b..867b6d7 100644
--- a/man/sample_islands.Rd
+++ b/man/sample_islands.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_islands}
-\alias{interconnected.islands.game}
\alias{sample_islands}
+\alias{interconnected.islands.game}
\title{A graph with subgraphs that are each a random graph.}
\usage{
sample_islands(islands.n, islands.size, islands.pin, n.inter)
@@ -25,15 +25,15 @@ Create a number of Erdos-Renyi random graphs with identical parameters, and
connect them with the specified number of edges.
}
\examples{
+
g <- sample_islands(3, 10, 5/10, 1)
oc <- cluster_optimal(g)
oc
}
-\author{
-Samuel Thiriot (\url{https://www.linkedin.com/in/samthiriot})
-}
\seealso{
\code{\link{sample_gnp}}
}
+\author{
+Samuel Thiriot
+}
\keyword{graphs}
-
diff --git a/man/sample_k_regular.Rd b/man/sample_k_regular.Rd
index 9895345..60c0b79 100644
--- a/man/sample_k_regular.Rd
+++ b/man/sample_k_regular.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_k_regular}
-\alias{k.regular.game}
\alias{sample_k_regular}
+\alias{k.regular.game}
\title{Create a random regular graph}
\usage{
sample_k_regular(no.of.nodes, k, directed = FALSE, multiple = FALSE)
@@ -33,6 +33,7 @@ The game simply uses \code{\link{sample_degseq}} with appropriately
constructed degree sequences.
}
\examples{
+
## A simple ring
ring <- sample_k_regular(10, 2)
plot(ring)
@@ -43,12 +44,11 @@ k10 <- lapply(1:9, sample_k_regular, no.of.nodes=10)
layout(matrix(1:9, nrow=3, byrow=TRUE))
sapply(k10, plot, vertex.label=NA)
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com}
-}
\seealso{
\code{\link{sample_degseq}} for a generator with prescribed degree
sequence.
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_last_cit.Rd b/man/sample_last_cit.Rd
index 712c15e..752f403 100644
--- a/man/sample_last_cit.Rd
+++ b/man/sample_last_cit.Rd
@@ -1,15 +1,17 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_last_cit}
-\alias{cit_cit_types}
-\alias{cit_types}
+\alias{sample_last_cit}
\alias{cited.type.game}
+\alias{sample_cit_types}
\alias{citing.cited.type.game}
-\alias{last_cit}
-\alias{lastcit.game}
\alias{sample_cit_cit_types}
+\alias{lastcit.game}
+\alias{last_cit}
\alias{sample_cit_types}
-\alias{sample_last_cit}
+\alias{cit_types}
+\alias{sample_cit_cit_types}
+\alias{cit_cit_types}
\title{Random citation graphs}
\usage{
sample_last_cit(n, edges = 1, agebins = n/7100, pref = (1:(agebins +
@@ -68,4 +70,3 @@ vertex only.
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/sample_motifs.Rd b/man/sample_motifs.Rd
index 1d65552..27a026b 100644
--- a/man/sample_motifs.Rd
+++ b/man/sample_motifs.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/motifs.R
\name{sample_motifs}
-\alias{graph.motifs.est}
\alias{sample_motifs}
+\alias{graph.motifs.est}
\title{Graph motifs}
\usage{
sample_motifs(graph, size = 3, cut.prob = rep(0, size),
@@ -45,7 +45,5 @@ sample_motifs(g, 3)
\code{\link{isomorphism_class}}
Other graph motifs: \code{\link{count_motifs}},
- \code{\link{graph.motifs.no}};
- \code{\link{graph.motifs}}, \code{\link{motifs}}
+ \code{\link{motifs}}
}
-
diff --git a/man/sample_pa.Rd b/man/sample_pa.Rd
index bd30d72..76099b7 100644
--- a/man/sample_pa.Rd
+++ b/man/sample_pa.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_pa}
-\alias{ba.game}
+\alias{sample_pa}
\alias{barabasi.game}
+\alias{ba.game}
\alias{pa}
-\alias{sample_pa}
\title{Generate scale-free graphs according to the Barabasi-Albert model}
\usage{
sample_pa(n, power = 1, m = NULL, out.dist = NULL, out.seq = NULL,
@@ -105,11 +105,10 @@ of adjacent edges not initiated by the vertex itself and not the total (in-
\code{TRUE}.
}
\examples{
+
g <- sample_pa(10000)
degree_distribution(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Barabasi, A.-L. and Albert R. 1999. Emergence of scaling in
@@ -118,5 +117,7 @@ random networks \emph{Science}, 286 509--512.
\seealso{
\code{\link{sample_gnp}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_pa_age.Rd b/man/sample_pa_age.Rd
index 844e3d6..dbd4003 100644
--- a/man/sample_pa_age.Rd
+++ b/man/sample_pa_age.Rd
@@ -1,11 +1,11 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_pa_age}
-\alias{aging.ba.game}
-\alias{aging.barabasi.game}
+\alias{sample_pa_age}
\alias{aging.prefatt.game}
+\alias{aging.barabasi.game}
+\alias{aging.ba.game}
\alias{pa_age}
-\alias{sample_pa_age}
\title{Generate an evolving random graph with preferential attachment and aging}
\usage{
sample_pa_age(n, pa.exp, aging.exp, m = NULL, aging.bin = 300,
@@ -117,6 +117,7 @@ If the \code{time.window} argument is given (and not NULL) then
This function might generate graphs with multiple edges.
}
\examples{
+
# The maximum degree for graph with different aging exponents
g1 <- sample_pa_age(10000, pa.exp=1, aging.exp=0, aging.bin=1000)
g2 <- sample_pa_age(10000, pa.exp=1, aging.exp=-1, aging.bin=1000)
@@ -125,11 +126,10 @@ max(degree(g1))
max(degree(g2))
max(degree(g3))
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{sample_pa}}, \code{\link{sample_gnp}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_pref.Rd b/man/sample_pref.Rd
index 3adb123..6756f9d 100644
--- a/man/sample_pref.Rd
+++ b/man/sample_pref.Rd
@@ -1,12 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_pref}
-\alias{asym_pref}
+\alias{sample_pref}
+\alias{sample_asym_pref}
+\alias{preference.game}
\alias{asymmetric.preference.game}
\alias{pref}
-\alias{preference.game}
\alias{sample_asym_pref}
-\alias{sample_pref}
+\alias{asym_pref}
\title{Trait-based random generation}
\usage{
sample_pref(nodes, types, type.dist = rep(1, types), fixed.sizes = FALSE,
@@ -67,6 +68,7 @@ asymmetric. The joint distribution for the in- and out-types is given in the
\sQuote{type.dist.matrix} argument.
}
\examples{
+
pf <- matrix( c(1, 0, 0, 1), nr=2)
g <- sample_pref(20, 2, pref.matrix=pf)
\dontrun{tkplot(g, layout=layout_with_fr)}
@@ -74,14 +76,14 @@ g <- sample_pref(20, 2, pref.matrix=pf)
pf <- matrix( c(0, 1, 0, 0), nr=2)
g <- sample_asym_pref(20, 2, pref.matrix=pf)
\dontrun{tkplot(g, layout=layout_in_circle)}
-}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
-\email{csardi.gabor at gmail.com} for the R interface
+
}
\seealso{
\code{\link{sample_traits}}.
\code{\link{sample_traits_callaway}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+\email{csardi.gabor at gmail.com} for the R interface
+}
\keyword{graphs}
-
diff --git a/man/sample_sbm.Rd b/man/sample_sbm.Rd
index 400bcd1..a10ac4c 100644
--- a/man/sample_sbm.Rd
+++ b/man/sample_sbm.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_sbm}
\alias{sample_sbm}
-\alias{sbm}
\alias{sbm.game}
+\alias{sbm}
\title{Sample stochastic block model}
\usage{
sample_sbm(n, pref.matrix, block.sizes, directed = FALSE, loops = FALSE)
@@ -38,14 +38,12 @@ equivalent of) Bernoulli trials for each potential edge with the
probabilities given by the Bernoulli rate matrix, \code{pref.matrix}.
}
\examples{
+
## Two groups with not only few connection between groups
pm <- cbind( c(.1, .001), c(.001, .05) )
g <- sample_sbm(1000, pref.matrix=pm, block.sizes=c(300,700))
g
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Faust, K., & Wasserman, S. (1992a). Blockmodels: Interpretation
and evaluation. \emph{Social Networks}, 14, 5--61.
@@ -53,5 +51,7 @@ and evaluation. \emph{Social Networks}, 14, 5--61.
\seealso{
\code{\link{sample_gnp}}, \code{\link{sample_gnm}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_seq.Rd b/man/sample_seq.Rd
index 76b6d02..24b8500 100644
--- a/man/sample_seq.Rd
+++ b/man/sample_seq.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/other.R
\name{sample_seq}
-\alias{igraph.sample}
\alias{sample_seq}
+\alias{igraph.sample}
\title{Sampling a random integer sequence}
\usage{
sample_seq(low, high, length)
@@ -27,16 +27,17 @@ The algorithm runs in \code{O(length)} expected time, even if
the builtin \code{sample} function of R.
}
\examples{
+
rs <- sample_seq(1, 100000000, 10)
rs
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Jeffrey Scott Vitter: An Efficient Algorithm for Sequential
Random Sampling, \emph{ACM Transactions on Mathematical Software}, 13/1,
58--67.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{datagen}
-
diff --git a/man/sample_smallworld.Rd b/man/sample_smallworld.Rd
index aa7ceff..db85212 100644
--- a/man/sample_smallworld.Rd
+++ b/man/sample_smallworld.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_smallworld}
\alias{sample_smallworld}
-\alias{smallworld}
\alias{watts.strogatz.game}
+\alias{smallworld}
\title{The Watts-Strogatz small-world model}
\usage{
sample_smallworld(dim, size, nei, p, loops = FALSE, multiple = FALSE)
@@ -43,12 +43,11 @@ Note that this function might create graphs with loops and/or multiple
edges. You can use \code{\link{simplify}} to get rid of these.
}
\examples{
+
g <- sample_smallworld(1, 100, 5, 0.05)
mean_distance(g)
transitivity(g, type="average")
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Duncan J Watts and Steven H Strogatz: Collective dynamics of
@@ -57,5 +56,7 @@ Duncan J Watts and Steven H Strogatz: Collective dynamics of
\seealso{
\code{\link{make_lattice}}, \code{\link{rewire}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sample_sphere_surface.Rd b/man/sample_sphere_surface.Rd
index a7b970f..7814c05 100644
--- a/man/sample_sphere_surface.Rd
+++ b/man/sample_sphere_surface.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{sample_sphere_surface}
\alias{sample_sphere_surface}
@@ -37,7 +37,6 @@ vec.norm <- apply(lpvs.sph, 2, function(x) { sum(x^2) })
vec.norm
}
\seealso{
-Other latent position vector samplers: \code{\link{sample_dirichlet}};
+Other latent position vector samplers: \code{\link{sample_dirichlet}},
\code{\link{sample_sphere_volume}}
}
-
diff --git a/man/sample_sphere_volume.Rd b/man/sample_sphere_volume.Rd
index d891c70..8021ab7 100644
--- a/man/sample_sphere_volume.Rd
+++ b/man/sample_sphere_volume.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/embedding.R
\name{sample_sphere_volume}
\alias{sample_sphere_volume}
@@ -37,7 +37,6 @@ vec.norm <- apply(lpvs.sph.vol, 2, function(x) { sum(x^2) })
vec.norm
}
\seealso{
-Other latent position vector samplers: \code{\link{sample_dirichlet}};
+Other latent position vector samplers: \code{\link{sample_dirichlet}},
\code{\link{sample_sphere_surface}}
}
-
diff --git a/man/sample_traits_callaway.Rd b/man/sample_traits_callaway.Rd
index 9112659..c0e2a4c 100644
--- a/man/sample_traits_callaway.Rd
+++ b/man/sample_traits_callaway.Rd
@@ -1,12 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/games.R
\name{sample_traits_callaway}
+\alias{sample_traits_callaway}
+\alias{sample_traits}
\alias{callaway.traits.game}
\alias{establishment.game}
+\alias{traits_callaway}
\alias{sample_traits}
-\alias{sample_traits_callaway}
\alias{traits}
-\alias{traits_callaway}
\title{Graph generation based on different vertex types}
\usage{
sample_traits_callaway(nodes, types, edge.per.step = 1, type.dist = rep(1,
@@ -62,6 +63,7 @@ depends on the types of the vertices involved and is taken from
\code{pref.matrix}.
}
\examples{
+
# two types of vertices, they like only themselves
g1 <- sample_traits_callaway(1000, 2, pref.matrix=matrix( c(1,0,0,1), nc=2))
g2 <- sample_traits(1000, 2, k=2, pref.matrix=matrix( c(1,0,0,1), nc=2))
@@ -70,4 +72,3 @@ g2 <- sample_traits(1000, 2, k=2, pref.matrix=matrix( c(1,0,0,1), nc=2))
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/scan_stat.Rd b/man/scan_stat.Rd
index d0cc769..ee3cace 100644
--- a/man/scan_stat.Rd
+++ b/man/scan_stat.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scan.R
\name{scan_stat}
\alias{scan_stat}
@@ -61,4 +61,3 @@ scan_stat(graphs = tsg, locality = "them", k = 1, tau = 4, ell = 2)
\seealso{
Other scan statistics: \code{\link{local_scan}}
}
-
diff --git a/man/scg-method.Rd b/man/scg-method.Rd
index 644077a..39d9565 100644
--- a/man/scg-method.Rd
+++ b/man/scg-method.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scg.R
\name{scg-method}
\alias{scg-method}
@@ -29,10 +29,7 @@ SCG should be of interest to practitioners of various fields dealing with
problems where matrix eigenpairs play an important role, as for instance is
the case of dynamical processes on networks.
}
-\author{
-David Morton de Lachapelle,
-\url{http://people.epfl.ch/david.morton}.
-}
+
\references{
D. Morton de Lachapelle, D. Gfeller, and P. De Los Rios,
Shrinking Matrices while Preserving their Eigenpairs with Application to the
@@ -48,5 +45,8 @@ D. Gfeller, and P. De Los Rios, Spectral Coarse Graining of Complex
Networks, \emph{Physical Review Letters}, \bold{99}(3), 2007.
\url{http://arxiv.org/abs/0706.0812}
}
+\author{
+David Morton de Lachapelle,
+\url{http://people.epfl.ch/david.morton}.
+}
\keyword{graphs}
-
diff --git a/man/scg.Rd b/man/scg.Rd
index dba8d43..e552014 100644
--- a/man/scg.Rd
+++ b/man/scg.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scg.R
\name{scg}
\alias{scg}
@@ -135,6 +135,8 @@ components in each eigenvector. The last three algorithms essentially have
linear running time and memory load.
}
\examples{
+
+
## We are not running these examples any more, because they
## take a long time (~20 seconds) to run and this is against the CRAN
## repository policy. Copy and paste them by hand to your R prompt if
@@ -156,7 +158,7 @@ ewidth <- round(E(cg$Xt)$weight,2)
op <- par(mfrow=c(1,2))
plot(g, vertex.color = col[cg$groups], vertex.size = 20,
vertex.label = NA, layout = layout)
-plot(cg$Xt, edge.width = ewidth, edge.label = ewidth,
+plot(cg$Xt, edge.width = ewidth, edge.label = ewidth,
vertex.color = col, vertex.size = 20*vsize/max(vsize),
vertex.label=NA, layout = layout_with_kk)
par(op)
@@ -198,15 +200,12 @@ vsize <- sqrt(as.vector(table(cg$groups)))
op <- par(mfrow=c(1,2))
plot(immuno, layout=layout, vertex.size=3, vertex.color=col[com],
vertex.label=NA)
-plot(gt, layout=layout.cg, vertex.size=15*vsize/max(vsize),
+plot(gt, layout=layout.cg, vertex.size=15*vsize/max(vsize),
vertex.color=col[com.cg],vertex.label=NA)
par(op)
}
-}
-\author{
-David Morton de Lachapelle,
-\url{http://people.epfl.ch/david.morton}.
+
}
\references{
D. Morton de Lachapelle, D. Gfeller, and P. De Los Rios,
@@ -219,5 +218,8 @@ Matrix Analysis and Applications}, 2008.
\link{scg-method} for an introduction. \code{\link{scg_eps}},
\code{\link{scg_group}} and \code{\link{scg_semi_proj}}.
}
+\author{
+David Morton de Lachapelle,
+\url{http://people.epfl.ch/david.morton}.
+}
\keyword{graphs}
-
diff --git a/man/scg_eps.Rd b/man/scg_eps.Rd
index 11a67a1..260f12c 100644
--- a/man/scg_eps.Rd
+++ b/man/scg_eps.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scg.R
\name{scg_eps}
-\alias{scgNormEps}
\alias{scg_eps}
+\alias{scgNormEps}
\title{Error of the spectral coarse graining (SCG) approximation}
\usage{
scg_eps(V, groups, mtype = c("symmetric", "laplacian", "stochastic"),
@@ -37,15 +37,12 @@ component is \eqn{\Vert v_i-Pv_i\Vert}{|v[i]-Pv[i]|} (see Details).
projector corresponding to the \code{mtype} argument.
}
\examples{
+
v <- rexp(20)
km <- kmeans(v,5)
sum(km$withinss)
scg_eps(cbind(v), km$cluster)^2
}
-\author{
-David Morton de Lachapelle,
-\url{http://people.epfl.ch/david.morton}.
-}
\references{
D. Morton de Lachapelle, D. Gfeller, and P. De Los Rios,
Shrinking Matrices while Preserving their Eigenpairs with Application to the
@@ -56,4 +53,7 @@ Matrix Analysis and Applications}, 2008.
\seealso{
\link{scg-method} and \code{\link{scg}}.
}
-
+\author{
+David Morton de Lachapelle,
+\url{http://people.epfl.ch/david.morton}.
+}
diff --git a/man/scg_group.Rd b/man/scg_group.Rd
index c3d4312..81484b1 100644
--- a/man/scg_group.Rd
+++ b/man/scg_group.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scg.R
\name{scg_group}
-\alias{scgGrouping}
\alias{scg_group}
+\alias{scgGrouping}
\title{SCG Problem Solver}
\usage{
scg_group(V, nt, mtype = c("symmetric", "laplacian", "stochastic"),
@@ -73,6 +73,8 @@ components in each eigenvector. The last three algorithms essentially have
linear running time and memory load.
}
\examples{
+
+
## We are not running these examples any more, because they
## take a long time to run and this is against the CRAN repository
## policy. Copy and paste them by hand to your R prompt if
@@ -113,10 +115,7 @@ gr.km <- kmeans(x, 100, 100, 300)$cluster
scg_eps(cbind(x), gr.true)
scg_eps(cbind(x), gr.km)
}
-}
-\author{
-David Morton de Lachapelle \email{david.morton at epfl.ch},
-\email{david.mortondelachapelle at swissquote.ch}
+
}
\references{
D. Morton de Lachapelle, D. Gfeller, and P. De Los Rios,
@@ -129,5 +128,8 @@ Matrix Analysis and Applications}, 2008.
\link{scg-method} for a detailed introduction. \code{\link{scg}},
\code{\link{scg_eps}}
}
+\author{
+David Morton de Lachapelle \email{david.morton at epfl.ch},
+\email{david.mortondelachapelle at swissquote.ch}
+}
\keyword{graphs}
-
diff --git a/man/scg_semi_proj.Rd b/man/scg_semi_proj.Rd
index 29fb313..7ea8bec 100644
--- a/man/scg_semi_proj.Rd
+++ b/man/scg_semi_proj.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scg.R
\name{scg_semi_proj}
-\alias{scgSemiProjectors}
\alias{scg_semi_proj}
+\alias{scgSemiProjectors}
\title{Semi-Projectors}
\usage{
scg_semi_proj(groups, mtype = c("symmetric", "laplacian", "stochastic"),
@@ -61,10 +61,11 @@ associated with the one-eigenvalue of the stochastic matrix. \eqn{L} and
semi-projectors verify various properties described in the reference.
}
\examples{
+
library(Matrix)
# compute the semi-projectors and projector for the partition
# provided by a community detection method
-g <- barabasi.game(20, m=1.5)
+g <- sample_pa(20, m = 1.5, directed = FALSE)
eb <- cluster_edge_betweenness(g)
memb <- membership(eb)
lr <- scg_semi_proj(memb)
@@ -81,10 +82,7 @@ L <- laplacian_matrix(g)
Lt <- lr$L \%*\% L \%*\% t(lr$R)
## or better lr$L \%*\% tcrossprod(L,lr$R)
rowSums(Lt)
-}
-\author{
-David Morton de Lachapelle,
-\url{http://people.epfl.ch/david.morton}.
+
}
\references{
D. Morton de Lachapelle, D. Gfeller, and P. De Los Rios,
@@ -97,4 +95,7 @@ Matrix Analysis and Applications}, 2008.
\link{scg-method} for a detailed introduction. \code{\link{scg}},
\code{\link{scg_eps}}, \code{\link{scg_group}}
}
-
+\author{
+David Morton de Lachapelle,
+\url{http://people.epfl.ch/david.morton}.
+}
diff --git a/man/sequential_pal.Rd b/man/sequential_pal.Rd
index 9f5c890..e7bf041 100644
--- a/man/sequential_pal.Rd
+++ b/man/sequential_pal.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/palette.R
\name{sequential_pal}
\alias{sequential_pal}
@@ -35,7 +35,6 @@ plot(karate)
}
}
\seealso{
-Other palettes: \code{\link{categorical_pal}};
- \code{\link{diverging_pal}}; \code{\link{r_pal}}
+Other palettes: \code{\link{categorical_pal}},
+ \code{\link{diverging_pal}}, \code{\link{r_pal}}
}
-
diff --git a/man/set_edge_attr.Rd b/man/set_edge_attr.Rd
index 4bf4513..9eeaba8 100644
--- a/man/set_edge_attr.Rd
+++ b/man/set_edge_attr.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{set_edge_attr}
-\alias{set.edge.attribute}
\alias{set_edge_attr}
+\alias{set.edge.attribute}
\title{Set edge attributes}
\usage{
set_edge_attr(graph, name, index = E(graph), value)
@@ -31,45 +31,17 @@ g
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/set_graph_attr.Rd b/man/set_graph_attr.Rd
index aed4b51..7f996ba 100644
--- a/man/set_graph_attr.Rd
+++ b/man/set_graph_attr.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{set_graph_attr}
-\alias{set.graph.attribute}
\alias{set_graph_attr}
+\alias{set.graph.attribute}
\title{Set a graph attribute}
\usage{
set_graph_attr(graph, name, value)
@@ -27,45 +27,17 @@ g
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/set_vertex_attr.Rd b/man/set_vertex_attr.Rd
index a741d44..c7f0055 100644
--- a/man/set_vertex_attr.Rd
+++ b/man/set_vertex_attr.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{set_vertex_attr}
-\alias{set.vertex.attribute}
\alias{set_vertex_attr}
+\alias{set.vertex.attribute}
\title{Set vertex attributes}
\usage{
set_vertex_attr(graph, name, index = V(graph), value)
@@ -31,45 +31,17 @@ g
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/shapes.Rd b/man/shapes.Rd
index 14550bd..73104af 100644
--- a/man/shapes.Rd
+++ b/man/shapes.Rd
@@ -1,15 +1,15 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.shapes.R
\name{shapes}
+\alias{shapes}
\alias{add.vertex.shape}
-\alias{add_shape}
\alias{igraph.shape.noclip}
\alias{igraph.shape.noplot}
+\alias{vertex.shapes}
\alias{igraph.vertex.shapes}
\alias{shape_noclip}
\alias{shape_noplot}
-\alias{shapes}
-\alias{vertex.shapes}
+\alias{add_shape}
\title{Various vertex shapes when plotting igraph graphs}
\usage{
shapes(shape = NULL)
@@ -26,7 +26,7 @@ add_shape(shape, clip = shape_noclip, plot = shape_noplot,
\code{NULL} for \code{shapes}, then the names of all defined
vertex shapes are returned.}
-\item{coords,el,params,end,v}{See parameters of the clipping/plotting
+\item{coords, el, params, end, v}{See parameters of the clipping/plotting
functions below.}
\item{clip}{An R function object, the clipping function.}
@@ -78,7 +78,7 @@ The clipping function has the following arguments:
second is a character string giving the name of the
parameter. E.g.
\preformatted{
- params("vertex", "size")
+params("vertex", "size")
}
}
\item{end}{Character string, it gives which end points will be
@@ -247,7 +247,7 @@ if (loadIfYouCan("XML") && loadIfYouCan("png") &&
musnet <- simplify(graph_from_data_frame(edges, dir=FALSE,
vertices=data.frame(name=c(ego$name, ego$similar))))
- str(musnet)
+ print_all(musnet)
V(musnet)$raster <- c(list(ego$image), lapply(similar, "[[", "image"))
plot(musnet, layout=layout_as_star, vertex.shape="raster",
@@ -258,4 +258,3 @@ if (loadIfYouCan("XML") && loadIfYouCan("png") &&
message("You need the `XML', `png' and `jpeg' packages to run this")
}
}
-
diff --git a/man/similarity.Rd b/man/similarity.Rd
index 02f1a14..d7141c9 100644
--- a/man/similarity.Rd
+++ b/man/similarity.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/similarity.R
\name{similarity}
\alias{similarity}
+\alias{similarity.jaccard}
\alias{similarity.dice}
\alias{similarity.invlogweighted}
-\alias{similarity.jaccard}
\title{Similarity measures of two vertices}
\usage{
similarity(graph, vids = V(graph), mode = c("all", "out", "in", "total"),
@@ -56,14 +56,11 @@ Eytan Adar: Friends and neighbors on the Web. Social Networks,
25(3):211-230, 2003.
}
\examples{
+
g <- make_ring(5)
similarity(g, method = "dice")
similarity(g, method = "jaccard")
}
-\author{
-Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
- \email{csardi.gabor at gmail.com} for the manual page.
-}
\references{
Lada A. Adamic and Eytan Adar: Friends and neighbors on the Web.
\emph{Social Networks}, 25(3):211-230, 2003.
@@ -71,5 +68,8 @@ Lada A. Adamic and Eytan Adar: Friends and neighbors on the Web.
\seealso{
\code{\link{cocitation}} and \code{\link{bibcoupling}}
}
+\author{
+Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
+ \email{csardi.gabor at gmail.com} for the manual page.
+}
\keyword{graphs}
-
diff --git a/man/simplified.Rd b/man/simplified.Rd
index 6ed3dcb..0d91de4 100644
--- a/man/simplified.Rd
+++ b/man/simplified.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{simplified}
\alias{simplified}
@@ -14,9 +14,8 @@ sample_(pa(10, m = 3, algorithm = "bag"))
sample_(pa(10, m = 3, algorithm = "bag"), simplified())
}
\seealso{
-Other constructor modifiers: \code{\link{with_edge_}};
- \code{\link{with_graph_}}; \code{\link{with_vertex_}};
- \code{\link{without_attr}}; \code{\link{without_loops}};
+Other constructor modifiers: \code{\link{with_edge_}},
+ \code{\link{with_graph_}}, \code{\link{with_vertex_}},
+ \code{\link{without_attr}}, \code{\link{without_loops}},
\code{\link{without_multiples}}
}
-
diff --git a/man/simplify.Rd b/man/simplify.Rd
index a56582a..967dda6 100644
--- a/man/simplify.Rd
+++ b/man/simplify.Rd
@@ -1,9 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/simple.R
\name{simplify}
+\alias{simplify}
\alias{is.simple}
\alias{is_simple}
-\alias{simplify}
+\alias{is_simple}
\title{Simple graphs}
\usage{
simplify(graph, remove.multiple = TRUE, remove.loops = TRUE,
@@ -43,19 +44,19 @@ both \code{remove.loops} and \code{remove.multiple} are \code{TRUE} the
function returns a simple graph.
}
\examples{
+
g <- graph( c(1,2,1,2,3,3) )
is_simple(g)
is_simple(simplify(g, remove.loops=FALSE))
is_simple(simplify(g, remove.multiple=FALSE))
is_simple(simplify(g))
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{which_loop}}, \code{\link{which_multiple}} and
\code{\link{count_multiple}}, \code{\link{delete_edges}},
\code{\link{delete_vertices}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sir.Rd b/man/sir.Rd
index af032d1..ceefefb 100644
--- a/man/sir.Rd
+++ b/man/sir.Rd
@@ -1,16 +1,19 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/epi.R, R/sir.R
\name{time_bins.sir}
+\alias{time_bins.sir}
\alias{median.sir}
\alias{quantile.sir}
\alias{sir}
+\alias{median.sir}
+\alias{quantile.sir}
\alias{time_bins}
\alias{time_bins.sir}
\title{SIR model on graphs}
\usage{
\method{time_bins}{sir}(x, middle = TRUE)
-\method{median}{sir}(x, na.rm = FALSE)
+\method{median}{sir}(x, na.rm = FALSE, ...)
\method{quantile}{sir}(x, comp = c("NI", "NS", "NR"), prob, ...)
@@ -26,6 +29,8 @@ or the boundaries.}
objects do not contain any \code{NA} values currently, so this argument is
effectively ignored.}
+\item{\dots}{Additional arguments, ignored currently.}
+
\item{comp}{Character scalar. The component to calculate the quantile of.
\code{NI} is infected agents, \code{NS} is susceptibles, \code{NR} stands
for recovered.}
@@ -46,8 +51,6 @@ individual. Formally, this is the rate parameter of an exponential
distribution.}
\item{no.sim}{Integer scalar, the number simulation runs to perform.}
-
-\item{\dots}{Additional arguments, ignored currently.}
}
\value{
For \code{sir} the results are returned in an object of class
@@ -60,7 +63,7 @@ numeric vectors, with equal length: \describe{
time.}
\item{NR}{The number of recovered individuals in the population, over
time.}
-}
+}
Function \code{time_bins} returns a numeric vector, the middle or the
boundaries of the time bins, depending on the \code{middle} argument.
@@ -94,14 +97,11 @@ quantiles of the results, respectively, in bins calculated with
\code{time_bins}.
}
\examples{
+
g <- sample_gnm(100, 100)
sm <- sir(g, beta=5, gamma=1)
plot(sm)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}. Eric Kolaczyk
-(\url{http://math.bu.edu/people/kolaczyk/}) wrote the initial version in R.
-}
\references{
Bailey, Norman T. J. (1975). The mathematical theory of
infectious diseases and its applications (2nd ed.). London: Griffin.
@@ -109,5 +109,8 @@ infectious diseases and its applications (2nd ed.). London: Griffin.
\seealso{
\code{\link{plot.sir}} to conveniently plot the results
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}. Eric Kolaczyk
+(\url{http://math.bu.edu/people/kolaczyk/}) wrote the initial version in R.
+}
\keyword{graphs}
-
diff --git a/man/spectrum.Rd b/man/spectrum.Rd
index d29bc5a..1a9cebb 100644
--- a/man/spectrum.Rd
+++ b/man/spectrum.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{spectrum}
+\alias{spectrum}
\alias{graph.eigen}
\alias{igraph.eigen.default}
-\alias{spectrum}
\title{Eigenvalues and eigenvectors of the adjacency matrix of a graph}
\usage{
spectrum(graph, algorithm = c("arpack", "auto", "lapack", "comp_auto",
@@ -56,6 +56,7 @@ Note that ARPACK might be unstable for graphs with multiple components, e.g.
graphs with isolate vertices.
}
\examples{
+
## Small example graph, leading eigenvector by default
kite <- make_graph("Krackhardt_kite")
spectrum(kite)[c("values", "vectors")]
@@ -68,12 +69,12 @@ cor(eigen_centrality(kite)$vector, spectrum(kite)$vectors)
## Smallest eigenvalues
spectrum(kite, which=list(pos="SM", howmany=2))$values
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{as_adj}} to create a (sparse) adjacency matrix.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/split_join_distance.Rd b/man/split_join_distance.Rd
index 83edcf2..bc09d0e 100644
--- a/man/split_join_distance.Rd
+++ b/man/split_join_distance.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/community.R
\name{split_join_distance}
\alias{split_join_distance}
@@ -41,4 +41,3 @@ cluster experiments. Technical Report INS-R0012, National Research
Institute for Mathematics and Computer Science in the Netherlands,
Amsterdam, May 2000.
}
-
diff --git a/man/srand.Rd b/man/srand.Rd
index 76ddc08..1774803 100644
--- a/man/srand.Rd
+++ b/man/srand.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/other.R
\name{srand}
\alias{srand}
@@ -15,4 +15,3 @@ Deprecated function, used to set random seed of the C library's RNG
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
-
diff --git a/man/st_cuts.Rd b/man/st_cuts.Rd
index 4548231..1b93f5a 100644
--- a/man/st_cuts.Rd
+++ b/man/st_cuts.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{st_cuts}
-\alias{stCuts}
\alias{st_cuts}
+\alias{stCuts}
\title{List all (s,t)-cuts of a graph}
\usage{
st_cuts(graph, source, target)
@@ -33,6 +33,7 @@ removing these edges from \eqn{G} there is no directed path from \eqn{s} to
\eqn{t}.
}
\examples{
+
# A very simple graph
g <- graph_from_literal(a -+ b -+ c -+ d -+ e)
st_cuts(g, source="a", target="e")
@@ -42,9 +43,6 @@ g2 <- graph_from_literal(s --+ a:b, a:b --+ t,
a --+ 1:2:3, 1:2:3 --+ b)
st_cuts(g2, source="s", target="t")
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
JS Provan and DR Shier: A Paradigm for listing (s,t)-cuts in
graphs, \emph{Algorithmica} 15, 351--372, 1996.
@@ -52,5 +50,7 @@ graphs, \emph{Algorithmica} 15, 351--372, 1996.
\seealso{
\code{\link{st_min_cuts}} to list all minimum cuts.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/st_min_cuts.Rd b/man/st_min_cuts.Rd
index 0bb0a8d..2d09ac0 100644
--- a/man/st_min_cuts.Rd
+++ b/man/st_min_cuts.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{st_min_cuts}
-\alias{stMincuts}
\alias{st_min_cuts}
+\alias{stMincuts}
\title{List all minimum \eqn{(s,t)}-cuts of a graph}
\usage{
st_min_cuts(graph, source, target, capacity = NULL)
@@ -47,14 +47,12 @@ simply the number of edges.
An \eqn{(s,t)}-cut is minimum if it is of the smallest possible size.
}
\examples{
+
# A difficult graph, from the Provan-Shier paper
g <- graph_from_literal(s --+ a:b, a:b --+ t,
a --+ 1:2:3:4:5, 1:2:3:4:5 --+ b)
st_min_cuts(g, source="s", target="t")
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
JS Provan and DR Shier: A Paradigm for listing (s,t)-cuts in
graphs, \emph{Algorithmica} 15, 351--372, 1996.
@@ -62,5 +60,7 @@ graphs, \emph{Algorithmica} 15, 351--372, 1996.
\seealso{
\code{\link{st_cuts}}, \code{\link{min_separators}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/stochastic_matrix.Rd b/man/stochastic_matrix.Rd
index ea3b95d..d50720b 100644
--- a/man/stochastic_matrix.Rd
+++ b/man/stochastic_matrix.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/scg.R
\name{stochastic_matrix}
-\alias{get.stochastic}
\alias{stochastic_matrix}
+\alias{get.stochastic}
\title{Stochastic matrix of a graph}
\usage{
stochastic_matrix(graph, column.wise = FALSE,
@@ -34,9 +34,10 @@ where it is assumed that \eqn{D} is non-singular. Column stochastic
matrices are defined in a symmetric way.
}
\examples{
+
library(Matrix)
## g is a large sparse graph
-g <- barabasi.game(n = 10^5, power = 2, directed = FALSE)
+g <- sample_pa(n = 10^5, power = 2, directed = FALSE)
W <- stochastic_matrix(g, sparse=TRUE)
## a dense matrix here would probably not fit in the memory
@@ -44,12 +45,12 @@ class(W)
## may not be exactly 1, due to numerical errors
max(abs(rowSums(W))-1)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{as_adj}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/strength.Rd b/man/strength.Rd
index ce4f5ab..41a1745 100644
--- a/man/strength.Rd
+++ b/man/strength.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{strength}
-\alias{graph.strength}
\alias{strength}
+\alias{graph.strength}
\title{Strength or weighted vertex degree}
\usage{
strength(graph, vids = V(graph), mode = c("all", "out", "in", "total"),
@@ -31,6 +31,7 @@ A numeric vector giving the strength of the vertices.
Summing up the edge weights of the adjacent edges for each vertex.
}
\examples{
+
g <- make_star(10)
E(g)$weight <- seq(ecount(g))
strength(g)
@@ -41,9 +42,6 @@ strength(g, mode="in")
g <- make_ring(10)
strength(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
Alain Barrat, Marc Barthelemy, Romualdo Pastor-Satorras,
Alessandro Vespignani: The architecture of complex weighted networks, Proc.
@@ -52,5 +50,7 @@ Natl. Acad. Sci. USA 101, 3747 (2004)
\seealso{
\code{\link{degree}} for the unweighted version.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/sub-.igraph.Rd b/man/sub-.igraph.Rd
index cae9b93..3521425 100644
--- a/man/sub-.igraph.Rd
+++ b/man/sub-.igraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/indexing.R
\name{[.igraph}
\alias{[.igraph}
@@ -73,7 +73,7 @@ graph[c(1,3,5),]}
\item For weighted graphs, the \code{[} operator returns the edge
weights. For non-esistent edges zero weights are returned. Other
edge attributes can be queried as well, by giving the \code{attr}
- argument.
+ argument.
\item Querying edge ids instead of the existance of edges or edge
attributes. E.g. \preformatted{ graph[1, 2, edges=TRUE]}
returns the id of the edge between vertices 1 and 2, or zero if
@@ -90,7 +90,7 @@ graph[from=1:3, to=c(2,3,5)] <- TRUE}
have to be \sQuote{weight}: \preformatted{ graph[1, 2, attr="weight"]<- 5
graph[from=1:3, to=c(2,3,5)] <- c(1,-1,4)}
If an edge is already present in the network, then only its
- weigths or other attribute are updated. If the graph is already
+ weights or other attribute are updated. If the graph is already
weighted, then the \code{attr="weight"} setting is implicit, and
one does not need to give it explicitly.
\item Deleting edges. The replacement syntax allow the deletion of
@@ -115,16 +115,12 @@ so instead of a numeric vertex id a vertex can also be given to
\sQuote{\code{[}} and \sQuote{\code{[[}}.
}
\seealso{
-Other structural queries: \code{\link{[[.igraph}};
- \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{neighbors}};
+Other structural queries: \code{\link{[[.igraph}},
+ \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident_edges}}, \code{\link{incident}},
+ \code{\link{is_directed}}, \code{\link{neighbors}},
\code{\link{tail_of}}
}
-
diff --git a/man/sub-sub-.igraph.Rd b/man/sub-sub-.igraph.Rd
index 9800e6d..42d26c4 100644
--- a/man/sub-sub-.igraph.Rd
+++ b/man/sub-sub-.igraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/indexing.R
\name{[[.igraph}
\alias{[[.igraph}
@@ -71,16 +71,12 @@ Vertex names are also supported, so instead of a numeric vertex id a
vertex can also be given to \sQuote{\code{[}} and \sQuote{\code{[[}}.
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{neighbors}};
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident_edges}}, \code{\link{incident}},
+ \code{\link{is_directed}}, \code{\link{neighbors}},
\code{\link{tail_of}}
}
-
diff --git a/man/subcomponent.Rd b/man/subcomponent.Rd
index 68ab0fa..0fc3b32 100644
--- a/man/subcomponent.Rd
+++ b/man/subcomponent.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{subcomponent}
\alias{subcomponent}
@@ -29,16 +29,16 @@ vertices from which a given vertex is reachable via a directed path.
A breadh-first search is conducted starting from vertex \code{v}.
}
\examples{
+
g <- sample_gnp(100, 1/200)
subcomponent(g, 1, "in")
subcomponent(g, 1, "out")
subcomponent(g, 1, "all")
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{components}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/subgraph.Rd b/man/subgraph.Rd
index 8c42029..ee32a41 100644
--- a/man/subgraph.Rd
+++ b/man/subgraph.Rd
@@ -1,9 +1,11 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{subgraph}
+\alias{subgraph}
\alias{induced.subgraph}
+\alias{subgraph.edges}
+\alias{induced_subgraph}
\alias{induced_subgraph}
-\alias{subgraph}
\alias{subgraph.edges}
\title{Subgraph of a graph}
\usage{
@@ -47,7 +49,7 @@ vertices and all the edges among them.
\details{
\code{induced_subgraph} calculates the induced subgraph of a set of vertices
in a graph. This means that exactly the specified vertices and all the edges
-between then will be kept in the result graph.
+between them will be kept in the result graph.
\code{subgraph.edges} calculates the subgraph of a graph. For this function
one can specify the vertices and edges to keep. This function will be
@@ -58,12 +60,13 @@ The \code{subgraph} function does the same as \code{induced.graph} currently
deprecated and will be removed in the next major version of igraph.
}
\examples{
+
g <- make_ring(10)
g2 <- induced_subgraph(g, 1:7)
g3 <- subgraph.edges(g, 1:5, 1:5)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/subgraph_centrality.Rd b/man/subgraph_centrality.Rd
index cfa33d9..8575e50 100644
--- a/man/subgraph_centrality.Rd
+++ b/man/subgraph_centrality.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/centrality.R
\name{subgraph_centrality}
-\alias{subgraph.centrality}
\alias{subgraph_centrality}
+\alias{subgraph.centrality}
\title{Find subgraph centrality scores of network positions}
\usage{
subgraph_centrality(graph, diag = FALSE)
@@ -32,13 +32,11 @@ eigenvalues and eigenvectors of the adjacency matrix of the graph. This
effectively means that the measure can only be calculated for small graphs.
}
\examples{
+
g <- sample_pa(100, m=4, dir=FALSE)
sc <- subgraph_centrality(g)
cor(degree(g), sc)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com} based on the Matlab
-code by Ernesto Estrada
+
}
\references{
Ernesto Estrada, Juan A. Rodriguez-Velazquez: Subgraph
@@ -47,5 +45,8 @@ centrality in Complex Networks. \emph{Physical Review E} 71, 056103 (2005).
\seealso{
\code{\link{eigen_centrality}}, \code{\link{page_rank}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com} based on the Matlab
+code by Ernesto Estrada
+}
\keyword{graphs}
-
diff --git a/man/subgraph_isomorphic.Rd b/man/subgraph_isomorphic.Rd
index 921b860..1e73ce5 100644
--- a/man/subgraph_isomorphic.Rd
+++ b/man/subgraph_isomorphic.Rd
@@ -1,10 +1,10 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{subgraph_isomorphic}
-\alias{graph.subisomorphic.lad}
+\alias{subgraph_isomorphic}
\alias{graph.subisomorphic.vf2}
+\alias{graph.subisomorphic.lad}
\alias{is_subgraph_isomorphic_to}
-\alias{subgraph_isomorphic}
\title{Decide if a graph is subgraph isomorphic to another one}
\usage{
subgraph_isomorphic(pattern, target, method = c("auto", "lad", "vf2"), ...)
@@ -76,6 +76,7 @@ following extra arguments:
supply \code{NULL} for both of these arguments.}
}
}
+
\examples{
# A LAD example
pattern <- make_graph(~ 1:2:3:4:5,
@@ -92,9 +93,7 @@ subgraph_isomorphisms(pattern, target, domains = domains)
# Directed LAD example
pattern <- make_graph(~ 1:2:3, 1 -+ 2:3)
-uring <- make_ring(10)
dring <- make_ring(10, directed = TRUE)
-subgraph_isomorphic(pattern, uring)
subgraph_isomorphic(pattern, dring)
}
\references{
@@ -107,22 +106,10 @@ LP Cordella, P Foggia, C Sansone, and M Vento: An improved algorithm
}
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
\code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}};
- \code{\link{graph.get.subisomorphisms.vf2}},
- \code{\link{subgraph_isomorphisms}};
- \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}}
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphic}},
+ \code{\link{isomorphism_class}},
+ \code{\link{isomorphisms}},
+ \code{\link{subgraph_isomorphisms}}
}
-
diff --git a/man/subgraph_isomorphisms.Rd b/man/subgraph_isomorphisms.Rd
index 9ca4948..7de4a39 100644
--- a/man/subgraph_isomorphisms.Rd
+++ b/man/subgraph_isomorphisms.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/topology.R
\name{subgraph_isomorphisms}
-\alias{graph.get.subisomorphisms.vf2}
\alias{subgraph_isomorphisms}
+\alias{graph.get.subisomorphisms.vf2}
\title{All isomorphic mappings between a graph and subgraphs of another graph}
\usage{
subgraph_isomorphisms(pattern, target, method = c("lad", "vf2"), ...)
@@ -65,25 +65,13 @@ following extra arguments:
supply \code{NULL} for both of these arguments.}
}
}
+
\seealso{
Other graph isomorphism: \code{\link{count_isomorphisms}},
- \code{\link{graph.count.isomorphisms.vf2}};
\code{\link{count_subgraph_isomorphisms}},
- \code{\link{graph.count.subisomorphisms.vf2}};
- \code{\link{graph.get.isomorphisms.vf2}},
- \code{\link{isomorphisms}}; \code{\link{graph.isoclass}},
- \code{\link{graph.isoclass.subgraph}},
- \code{\link{isomorphism_class}};
- \code{\link{graph.isocreate}},
- \code{\link{graph_from_isomorphism_class}};
- \code{\link{graph.isomorphic}},
- \code{\link{graph.isomorphic.34}},
- \code{\link{graph.isomorphic.bliss}},
- \code{\link{graph.isomorphic.vf2}},
- \code{\link{is_isomorphic_to}}, \code{\link{isomorphic}};
- \code{\link{graph.subisomorphic.lad}},
- \code{\link{graph.subisomorphic.vf2}},
- \code{\link{is_subgraph_isomorphic_to}},
+ \code{\link{graph_from_isomorphism_class}},
+ \code{\link{isomorphic}},
+ \code{\link{isomorphism_class}},
+ \code{\link{isomorphisms}},
\code{\link{subgraph_isomorphic}}
}
-
diff --git a/man/tail_of.Rd b/man/tail_of.Rd
index 8c1063b..52bc596 100644
--- a/man/tail_of.Rd
+++ b/man/tail_of.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/basic.R
\name{tail_of}
\alias{tail_of}
@@ -20,15 +20,11 @@ For undirected graphs, head and tail is not defined. In this case
\code{head_of} returns the other end(s) of the edge(s).
}
\seealso{
-Other structural queries: \code{\link{[.igraph}};
- \code{\link{[[.igraph}}; \code{\link{adjacent_vertices}};
- \code{\link{are.connected}}, \code{\link{are_adjacent}};
- \code{\link{ecount}}, \code{\link{gsize}};
- \code{\link{ends}}, \code{\link{get.edge}},
- \code{\link{get.edges}}; \code{\link{get.edge.ids}};
- \code{\link{gorder}}, \code{\link{vcount}};
- \code{\link{head_of}}; \code{\link{incident_edges}};
- \code{\link{incident}}; \code{\link{is.directed}},
- \code{\link{is_directed}}; \code{\link{neighbors}}
+Other structural queries: \code{\link{[.igraph}},
+ \code{\link{[[.igraph}}, \code{\link{adjacent_vertices}},
+ \code{\link{are_adjacent}}, \code{\link{ends}},
+ \code{\link{get.edge.ids}}, \code{\link{gorder}},
+ \code{\link{gsize}}, \code{\link{head_of}},
+ \code{\link{incident_edges}}, \code{\link{incident}},
+ \code{\link{is_directed}}, \code{\link{neighbors}}
}
-
diff --git a/man/tkigraph.Rd b/man/tkigraph.Rd
index 57b8d2b..d5c3cd2 100644
--- a/man/tkigraph.Rd
+++ b/man/tkigraph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/socnet.R
\name{tkigraph}
\alias{tkigraph}
@@ -17,11 +17,10 @@ was written in Tcl/Tk, so it is cross platform.
\code{tkigraph} has its own online help system, please see that for the
details about how to use it.
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{tkplot}} for interactive plotting of graphs.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/tkplot.Rd b/man/tkplot.Rd
index 158b317..8e87888 100644
--- a/man/tkplot.Rd
+++ b/man/tkplot.Rd
@@ -1,27 +1,37 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/tkplot.R
\name{tkplot}
+\alias{tkplot}
+\alias{tkplot.close}
+\alias{tkplot.off}
+\alias{tkplot.fit.to.screen}
+\alias{tkplot.reshape}
+\alias{tkplot.export.postscript}
+\alias{tkplot.canvas}
+\alias{tkplot.getcoords}
+\alias{tkplot.setcoords}
+\alias{tkplot.center}
+\alias{tkplot.rotate}
\alias{tk_canvas}
\alias{tk_center}
\alias{tk_close}
-\alias{tk_coords}
+\alias{tk_postscript}
\alias{tk_fit}
+\alias{tk_coords}
\alias{tk_off}
-\alias{tk_postscript}
\alias{tk_reshape}
\alias{tk_rotate}
\alias{tk_set_coords}
-\alias{tkplot}
-\alias{tkplot.canvas}
-\alias{tkplot.center}
-\alias{tkplot.close}
-\alias{tkplot.export.postscript}
-\alias{tkplot.fit.to.screen}
-\alias{tkplot.getcoords}
-\alias{tkplot.off}
-\alias{tkplot.reshape}
-\alias{tkplot.rotate}
-\alias{tkplot.setcoords}
+\alias{tk_close}
+\alias{tk_off}
+\alias{tk_fit}
+\alias{tk_center}
+\alias{tk_reshape}
+\alias{tk_postscript}
+\alias{tk_coords}
+\alias{tk_set_coords}
+\alias{tk_rotate}
+\alias{tk_canvas}
\title{Interactive plotting of graphs}
\usage{
tkplot(graph, canvas.width = 450, canvas.height = 450, ...)
@@ -49,7 +59,10 @@ tk_canvas(tkp.id)
\arguments{
\item{graph}{The \code{graph} to plot.}
-\item{canvas.width,canvas.height}{The size of the tkplot drawing area.}
+\item{canvas.width, canvas.height}{The size of the tkplot drawing area.}
+
+\item{\dots}{Additional plotting parameters. See \link{igraph.plotting} for
+the complete list.}
\item{tkp.id}{The id of the tkplot window to close/reshape/etc.}
@@ -71,9 +84,6 @@ vertices, in absolute coordinates.}
\item{degree}{The degree to rotate the plot.}
\item{rad}{The degree to rotate the plot, in radian.}
-
-\item{\dots}{Additional plotting parameters. See \link{igraph.plotting} for
-the complete list.}
}
\value{
\code{tkplot} returns an integer, the id of the plot, this can be
@@ -156,6 +166,7 @@ vertex.
in degrees or in radians.
}
\examples{
+
g <- make_ring(10)
\dontrun{tkplot(g)}
@@ -188,12 +199,12 @@ tkcreate(canvas, "text", width/2, 25, text="My title",
justify="center", font=tcltk::tkfont.create(family="helvetica"
,size=20,weight="bold"))
}
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{plot.igraph}}, \code{\link{layout}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/topo_sort.Rd b/man/topo_sort.Rd
index a57febd..8a9cca1 100644
--- a/man/topo_sort.Rd
+++ b/man/topo_sort.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{topo_sort}
\alias{topo_sort}
@@ -17,8 +17,9 @@ For \dQuote{\code{in}}, it is quite the opposite: each node comes before all
nodes from which it receives edges. Nodes with no outgoing edges go first.}
}
\value{
-A numeric vector containing vertex ids in topologically sorted
-order.
+A vertex sequence (by default, but see the \code{return.vs.es}
+option of \code{\link{igraph_options}}) containing vertices in
+topologically sorted order.
}
\description{
A topological sorting of a directed acyclic graph is a linear ordering of
@@ -31,12 +32,13 @@ acyclic (it has at least one cycle), a partial topological sort is returned
and a warning is issued.
}
\examples{
+
g <- barabasi.game(100)
topo_sort(g)
+
}
\author{
Tamas Nepusz \email{ntamas at gmail.com} and Gabor Csardi
\email{csardi.gabor at gmail.com} for the R interface
}
\keyword{graphs}
-
diff --git a/man/transitivity.Rd b/man/transitivity.Rd
index d7c7399..b61682f 100644
--- a/man/transitivity.Rd
+++ b/man/transitivity.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{transitivity}
\alias{transitivity}
@@ -80,6 +80,7 @@ multiple and/or loop edges. If you want to calculate it for a directed
graph, call \code{\link{as.undirected}} with the \code{collapse} mode first.
}
\examples{
+
g <- make_ring(10)
transitivity(g)
g2 <- sample_gnp(1000, 10/1000)
@@ -99,9 +100,7 @@ t1 <- transitivity(gw2, type="local")
t2 <- transitivity(gw2, type="weighted")
all(is.na(t1) == is.na(t2))
all(na.omit(t1 == t2))
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Wasserman, S., and Faust, K. (1994). \emph{Social Network
@@ -111,5 +110,7 @@ Alain Barrat, Marc Barthelemy, Romualdo Pastor-Satorras, Alessandro
Vespignani: The architecture of complex weighted networks, Proc. Natl. Acad.
Sci. USA 101, 3747 (2004)
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/triad_census.Rd b/man/triad_census.Rd
index 287e287..47bebb2 100644
--- a/man/triad_census.Rd
+++ b/man/triad_census.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/motifs.R
\name{triad_census}
-\alias{triad.census}
\alias{triad_census}
+\alias{triad.census}
\title{Triad census, subgraphs with three vertices}
\usage{
triad_census(graph)
@@ -35,12 +35,10 @@ This functions uses the RANDESU motif finder algorithm to find and count the
subgraphs, see \code{\link{motifs}}.
}
\examples{
+
g <- sample_gnm(15, 45, directed = TRUE)
triad_census(g)
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\references{
See also Davis, J.A. and Leinhardt, S. (1972). The Structure
of Positive Interpersonal Relations in Small Groups. In J. Berger (Ed.),
@@ -51,5 +49,7 @@ Mifflin.
\code{\link{dyad_census}} for classifying binary relationships,
\code{\link{motifs}} for the underlying implementation.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/unfold_tree.Rd b/man/unfold_tree.Rd
index 2666fca..e887df2 100644
--- a/man/unfold_tree.Rd
+++ b/man/unfold_tree.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{unfold_tree}
-\alias{unfold.tree}
\alias{unfold_tree}
+\alias{unfold.tree}
\title{Convert a general graph into a forest}
\usage{
unfold_tree(graph, mode = c("all", "out", "in", "total"), roots)
@@ -35,14 +35,15 @@ The \code{roots} vector can be calculated by simply doing a topological sort
in all components of the graph, see the examples below.
}
\examples{
+
g <- make_tree(10) \%du\% make_tree(10)
V(g)$id <- seq_len(vcount(g))-1
roots <- sapply(decompose(g), function(x) {
V(x)$id[ topo_sort(x)[1]+1 ] })
tree <- unfold_tree(g, roots=roots)
+
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/union.Rd b/man/union.Rd
index ea69192..3e58f65 100644
--- a/man/union.Rd
+++ b/man/union.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{union}
\alias{union}
@@ -21,4 +21,3 @@ sequences. See
\code{\link{union.igraph}}, and
\code{\link{union.igraph.vs}}.
}
-
diff --git a/man/union.igraph.Rd b/man/union.igraph.Rd
index 0ece324..1901db6 100644
--- a/man/union.igraph.Rd
+++ b/man/union.igraph.Rd
@@ -1,21 +1,21 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{union.igraph}
-\alias{\%u\%}
-\alias{graph.union}
\alias{union.igraph}
+\alias{graph.union}
+\alias{\%u\%}
\title{Union of graphs}
\usage{
\method{union}{igraph}(..., byname = "auto")
}
\arguments{
+\item{\dots}{Graph objects or lists of graph objects.}
+
\item{byname}{A logical scalar, or the character scalar \code{auto}. Whether
to perform the operation based on symbolic vertex names. If it is
\code{auto}, that means \code{TRUE} if all graphs are named and \code{FALSE}
otherwise. A warning is generated if \code{auto} and some (but not all)
graphs are named.}
-
-\item{\dots}{Graph objects or lists of graph objects.}
}
\value{
A new graph object.
@@ -46,14 +46,14 @@ An error is generated if some input graphs are directed and others are
undirected.
}
\examples{
+
## Union of two social networks with overlapping sets of actors
net1 <- graph_from_literal(D-A:B:F:G, A-C-F-A, B-E-G-B, A-B, F-G,
H-F:G, H-I-J)
net2 <- graph_from_literal(D-A:F:Y, B-A-X-F-H-Z, F-Y)
-str(net1 \%u\% net2)
+print_all(net1 \%u\% net2)
}
\author{
Gabor Csardi \email{csardi.gabor at gmail.com}
}
\keyword{graphs}
-
diff --git a/man/union.igraph.es.Rd b/man/union.igraph.es.Rd
index 6ddebab..7a57c58 100644
--- a/man/union.igraph.es.Rd
+++ b/man/union.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{union.igraph.es}
\alias{union.igraph.es}
@@ -27,23 +27,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
union(E(g)[1:6], E(g)[5:9], E(g)['A|J'])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.vs}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.vs}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/union.igraph.vs.Rd b/man/union.igraph.vs.Rd
index 59c13d8..499c1de 100644
--- a/man/union.igraph.vs.Rd
+++ b/man/union.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{union.igraph.vs}
\alias{union.igraph.vs}
@@ -27,23 +27,18 @@ g <- make_(ring(10), with_vertex_(name = LETTERS[1:10]))
union(V(g)[1:6], V(g)[5:10])
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{unique.igraph.es}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{unique.igraph.es}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/unique.igraph.es.Rd b/man/unique.igraph.es.Rd
index ca9ae9d..10bc2e4 100644
--- a/man/unique.igraph.es.Rd
+++ b/man/unique.igraph.es.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{unique.igraph.es}
\alias{unique.igraph.es}
@@ -26,23 +26,18 @@ E(g)[1, 1:5, 1:10, 5:10]
E(g)[1, 1:5, 1:10, 5:10] \%>\% unique()
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
\code{\link{unique.igraph.vs}}
}
-
diff --git a/man/unique.igraph.vs.Rd b/man/unique.igraph.vs.Rd
index eb64562..387a730 100644
--- a/man/unique.igraph.vs.Rd
+++ b/man/unique.igraph.vs.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/iterators.R
\name{unique.igraph.vs}
\alias{unique.igraph.vs}
@@ -26,23 +26,18 @@ V(g)[1, 1:5, 1:10, 5:10]
V(g)[1, 1:5, 1:10, 5:10] \%>\% unique()
}
\seealso{
-Other vertex and edge sequence operations: \code{\link{[.igraph.es}},
- \code{\link{\%--\%}}, \code{\link{\%->\%}},
- \code{\link{\%<-\%}}, \code{\link{igraph-es-indexing}};
- \code{\link{[.igraph.vs}},
- \code{\link{igraph-vs-indexing}};
- \code{\link{[[.igraph.es}},
- \code{\link{igraph-es-indexing2}};
- \code{\link{[[.igraph.vs}},
- \code{\link{igraph-vs-indexing2}};
- \code{\link{c.igraph.es}}; \code{\link{c.igraph.vs}};
- \code{\link{difference.igraph.es}};
- \code{\link{difference.igraph.vs}};
- \code{\link{intersection.igraph.es}};
- \code{\link{intersection.igraph.vs}};
- \code{\link{rev.igraph.es}}; \code{\link{rev.igraph.vs}};
- \code{\link{union.igraph.es}};
- \code{\link{union.igraph.vs}};
+Other vertex and edge sequence operations: \code{\link{c.igraph.es}},
+ \code{\link{c.igraph.vs}},
+ \code{\link{difference.igraph.es}},
+ \code{\link{difference.igraph.vs}},
+ \code{\link{igraph-es-indexing2}},
+ \code{\link{igraph-es-indexing}},
+ \code{\link{igraph-vs-indexing2}},
+ \code{\link{igraph-vs-indexing}},
+ \code{\link{intersection.igraph.es}},
+ \code{\link{intersection.igraph.vs}},
+ \code{\link{rev.igraph.es}}, \code{\link{rev.igraph.vs}},
+ \code{\link{union.igraph.es}},
+ \code{\link{union.igraph.vs}},
\code{\link{unique.igraph.es}}
}
-
diff --git a/man/upgrade_graph.Rd b/man/upgrade_graph.Rd
index d625285..2a99aa6 100644
--- a/man/upgrade_graph.Rd
+++ b/man/upgrade_graph.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/versions.R
\name{upgrade_graph}
\alias{upgrade_graph}
@@ -29,4 +29,3 @@ to the current one.
graph_version to check the current data format version
or the version of a graph.
}
-
diff --git a/man/vertex.Rd b/man/vertex.Rd
index e6aa142..eac2cb2 100644
--- a/man/vertex.Rd
+++ b/man/vertex.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/operators.R
\name{vertex}
\alias{vertex}
@@ -23,9 +23,10 @@ vertices to/from graphs.
\details{
\code{vertices} is an alias for \code{vertex}.
+
When adding vertices via \code{+}, all unnamed arguments are interpreted
as vertex names of the new vertices. Named arguments are interpreted as
-vertex attributes for the new vertices.
+vertex attributes for the new vertices.
When deleting vertices via \code{-}, all arguments of \code{vertex} (or
\code{vertices}) are concatenated via \code{c()} and passed to
@@ -38,13 +39,9 @@ g
plot(g)
}
\seealso{
-Other functions for manipulating graph structure: \code{\link{+.igraph}};
- \code{\link{-.igraph}}, \code{\link{igraph-minus}};
- \code{\link{add.edges}}, \code{\link{add_edges}};
- \code{\link{add.vertices}}, \code{\link{add_vertices}};
- \code{\link{delete.edges}}, \code{\link{delete_edges}};
- \code{\link{delete.vertices}},
- \code{\link{delete_vertices}}; \code{\link{edge}},
- \code{\link{edges}}; \code{\link{path}}
+Other functions for manipulating graph structure: \code{\link{+.igraph}},
+ \code{\link{add_edges}}, \code{\link{add_vertices}},
+ \code{\link{delete_edges}},
+ \code{\link{delete_vertices}}, \code{\link{edge}},
+ \code{\link{igraph-minus}}, \code{\link{path}}
}
-
diff --git a/man/vertex_attr-set.Rd b/man/vertex_attr-set.Rd
index 82c955c..453dfa0 100644
--- a/man/vertex_attr-set.Rd
+++ b/man/vertex_attr-set.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{vertex_attr<-}
-\alias{vertex.attributes<-}
\alias{vertex_attr<-}
+\alias{vertex.attributes<-}
\title{Set one or more vertex attributes}
\usage{
vertex_attr(graph, name, index = V(graph)) <- value
@@ -35,45 +35,17 @@ g
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr_names}},
+ \code{\link{vertex_attr}}
}
-
diff --git a/man/vertex_attr.Rd b/man/vertex_attr.Rd
index 4698cae..afa92d9 100644
--- a/man/vertex_attr.Rd
+++ b/man/vertex_attr.Rd
@@ -1,9 +1,9 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{vertex_attr}
+\alias{vertex_attr}
\alias{get.vertex.attribute}
\alias{vertex.attributes}
-\alias{vertex_attr}
\title{Query vertex attributes of a graph}
\usage{
vertex_attr(graph, name, index = V(graph))
@@ -33,44 +33,17 @@ vertex_attr(g)
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{list.vertex.attributes}},
- \code{\link{vertex_attr_names}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}},
+ \code{\link{vertex_attr_names}}
}
-
diff --git a/man/vertex_attr_names.Rd b/man/vertex_attr_names.Rd
index f14ce0e..006dd3f 100644
--- a/man/vertex_attr_names.Rd
+++ b/man/vertex_attr_names.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/attributes.R
\name{vertex_attr_names}
-\alias{list.vertex.attributes}
\alias{vertex_attr_names}
+\alias{list.vertex.attributes}
\title{List names of vertex attributes}
\usage{
vertex_attr_names(graph)
@@ -24,45 +24,16 @@ vertex_attr_names(g)
plot(g)
}
\seealso{
-Other graph attributes: \code{\link{$.igraph.vs}},
- \code{\link{$<-.igraph.vs}}, \code{\link{V<-}},
- \code{\link{[<-.igraph.vs}},
- \code{\link{[[<-.igraph.vs}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}},
- \code{\link{igraph-vs-attributes}};
- \code{\link{$.igraph}}, \code{\link{$<-.igraph}},
- \code{\link{igraph-dollar}}, \code{\link{igraph-dollar}};
- \code{\link{attributes}}, \code{\link{graph_attr_names}},
- \code{\link{list.graph.attributes}};
- \code{\link{delete_edge_attr}},
- \code{\link{remove.edge.attribute}};
+Other graph attributes: \code{\link{delete_edge_attr}},
\code{\link{delete_graph_attr}},
- \code{\link{remove.graph.attribute}};
\code{\link{delete_vertex_attr}},
- \code{\link{remove.vertex.attribute}};
- \code{\link{edge.attributes<-}},
- \code{\link{edge_attr<-}}; \code{\link{edge.attributes}},
- \code{\link{edge_attr}},
- \code{\link{get.edge.attribute}};
- \code{\link{edge_attr_names}},
- \code{\link{list.edge.attributes}};
- \code{\link{get.graph.attribute}},
- \code{\link{graph.attributes}}, \code{\link{graph_attr}};
- \code{\link{get.vertex.attribute}},
- \code{\link{vertex.attributes}},
- \code{\link{vertex_attr}};
- \code{\link{graph.attributes<-}},
- \code{\link{graph_attr<-}};
- \code{\link{set.edge.attribute}},
- \code{\link{set_edge_attr}};
- \code{\link{set.graph.attribute}},
- \code{\link{set_graph_attr}};
- \code{\link{set.vertex.attribute}},
- \code{\link{set_vertex_attr}};
- \code{\link{vertex.attributes<-}},
- \code{\link{vertex_attr<-}}
+ \code{\link{edge_attr<-}}, \code{\link{edge_attr_names}},
+ \code{\link{edge_attr}}, \code{\link{graph_attr<-}},
+ \code{\link{graph_attr_names}}, \code{\link{graph_attr}},
+ \code{\link{igraph-dollar}},
+ \code{\link{igraph-vs-attributes}},
+ \code{\link{set_edge_attr}},
+ \code{\link{set_graph_attr}},
+ \code{\link{set_vertex_attr}},
+ \code{\link{vertex_attr<-}}, \code{\link{vertex_attr}}
}
-
diff --git a/man/vertex_connectivity.Rd b/man/vertex_connectivity.Rd
index af2b3d9..1428949 100644
--- a/man/vertex_connectivity.Rd
+++ b/man/vertex_connectivity.Rd
@@ -1,13 +1,13 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/flow.R
\name{vertex_connectivity}
-\alias{cohesion}
-\alias{cohesion.igraph}
-\alias{graph.cohesion}
+\alias{vertex_connectivity}
\alias{vertex.connectivity}
\alias{vertex.disjoint.paths}
-\alias{vertex_connectivity}
+\alias{cohesion}
\alias{vertex_disjoint_paths}
+\alias{graph.cohesion}
+\alias{cohesion.igraph}
\title{Vertex connectivity.}
\usage{
vertex_connectivity(graph, source = NULL, target = NULL, checks = TRUE)
@@ -15,7 +15,7 @@ vertex_connectivity(graph, source = NULL, target = NULL, checks = TRUE)
\method{cohesion}{igraph}(x, checks = TRUE, ...)
}
\arguments{
-\item{graph,x}{The input graph.}
+\item{graph, x}{The input graph.}
\item{source}{The id of the source vertex, for \code{vertex_connectivity} it
can be \code{NULL}, see details below.}
@@ -72,6 +72,7 @@ precisely \code{vertex_connectivity} is the most general, the other two are
included only for the ease of using more descriptive function names.
}
\examples{
+
g <- barabasi.game(100, m=1)
g <- delete_edges(g, E(g)[ 100 \%--\% 1 ])
g2 <- barabasi.game(100, m=5)
@@ -84,9 +85,7 @@ g <- sample_gnp(50, 5/50)
g <- as.directed(g)
g <- induced_subgraph(g, subcomponent(g, 1))
cohesion(g)
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
White, Douglas R and Frank Harary 2001. The Cohesiveness of
@@ -97,5 +96,7 @@ Blocks In Social Networks: Node Connectivity and Conditional Density.
\code{\link{max_flow}}, \code{\link{edge_connectivity}},
\code{\link{edge_disjoint_paths}}, \code{\link{adhesion}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/which_multiple.Rd b/man/which_multiple.Rd
index 07179c8..0a35fc7 100644
--- a/man/which_multiple.Rd
+++ b/man/which_multiple.Rd
@@ -1,14 +1,14 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{which_multiple}
-\alias{any_multiple}
-\alias{count.multiple}
-\alias{count_multiple}
+\alias{which_multiple}
\alias{has.multiple}
\alias{is.loop}
\alias{is.multiple}
+\alias{count.multiple}
+\alias{count_multiple}
+\alias{any_multiple}
\alias{which_loop}
-\alias{which_multiple}
\title{Find the multiple or loop edges in a graph}
\usage{
which_multiple(graph, eids = E(graph))
@@ -49,6 +49,7 @@ See the examples for getting rid of multiple edges while keeping their
original multiplicity as an edge attribute.
}
\examples{
+
# Loops
g <- graph( c(1,1,2,2,3,3,4,5) )
which_loop(g)
@@ -71,12 +72,12 @@ E(g)$weight <- count_multiple(g)
g <- simplify(g)
any(which_multiple(g))
E(g)$weight
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\seealso{
\code{\link{simplify}} to eliminate loop and multiple edges.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/which_mutual.Rd b/man/which_mutual.Rd
index 5ef0599..3e081ff 100644
--- a/man/which_mutual.Rd
+++ b/man/which_mutual.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/structural.properties.R
\name{which_mutual}
-\alias{is.mutual}
\alias{which_mutual}
+\alias{is.mutual}
\title{Find mutual edges in a directed graph}
\usage{
which_mutual(graph, es = E(graph))
@@ -30,18 +30,18 @@ considered to be mutual.
Undirected graphs contain only mutual edges by definition.
}
\examples{
+
g <- sample_gnm(10, 50, directed=TRUE)
reciprocity(g)
dyad_census(g)
which_mutual(g)
sum(which_mutual(g))/2 == dyad_census(g)$mut
}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
-}
\seealso{
\code{\link{reciprocity}}, \code{\link{dyad_census}} if you just
want some statistics about mutual edges.
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/man/with_edge_.Rd b/man/with_edge_.Rd
index 28a826d..facb773 100644
--- a/man/with_edge_.Rd
+++ b/man/with_edge_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{with_edge_}
\alias{with_edge_}
@@ -20,9 +20,8 @@ make_(ring(10),
plot()
}
\seealso{
-Other constructor modifiers: \code{\link{simplified}};
- \code{\link{with_graph_}}; \code{\link{with_vertex_}};
- \code{\link{without_attr}}; \code{\link{without_loops}};
+Other constructor modifiers: \code{\link{simplified}},
+ \code{\link{with_graph_}}, \code{\link{with_vertex_}},
+ \code{\link{without_attr}}, \code{\link{without_loops}},
\code{\link{without_multiples}}
}
-
diff --git a/man/with_graph_.Rd b/man/with_graph_.Rd
index f067fa9..e072ffc 100644
--- a/man/with_graph_.Rd
+++ b/man/with_graph_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{with_graph_}
\alias{with_graph_}
@@ -16,9 +16,8 @@ Constructor modifier to add graph attributes
make_(ring(10), with_graph_(name = "10-ring"))
}
\seealso{
-Other constructor modifiers: \code{\link{simplified}};
- \code{\link{with_edge_}}; \code{\link{with_vertex_}};
- \code{\link{without_attr}}; \code{\link{without_loops}};
+Other constructor modifiers: \code{\link{simplified}},
+ \code{\link{with_edge_}}, \code{\link{with_vertex_}},
+ \code{\link{without_attr}}, \code{\link{without_loops}},
\code{\link{without_multiples}}
}
-
diff --git a/man/with_igraph_opt.Rd b/man/with_igraph_opt.Rd
new file mode 100644
index 0000000..95ac1de
--- /dev/null
+++ b/man/with_igraph_opt.Rd
@@ -0,0 +1,29 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/par.R
+\name{with_igraph_opt}
+\alias{with_igraph_opt}
+\title{Run code with a temporary igraph options setting}
+\usage{
+with_igraph_opt(options, code)
+}
+\arguments{
+\item{options}{A named list of the options to change.}
+
+\item{code}{The code to run.}
+}
+\value{
+The result of the \code{code}.
+}
+\description{
+Run code with a temporary igraph options setting
+}
+\examples{
+with_igraph_opt(
+ list(sparsematrices = FALSE),
+ make_ring(10)[]
+)
+igraph_opt("sparsematrices")
+}
+\seealso{
+Other igraph options: \code{\link{igraph_options}}
+}
diff --git a/man/with_vertex_.Rd b/man/with_vertex_.Rd
index 540fd40..7ddc16c 100644
--- a/man/with_vertex_.Rd
+++ b/man/with_vertex_.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{with_vertex_}
\alias{with_vertex_}
@@ -21,9 +21,8 @@ make_(ring(10),
plot()
}
\seealso{
-Other constructor modifiers: \code{\link{simplified}};
- \code{\link{with_edge_}}; \code{\link{with_graph_}};
- \code{\link{without_attr}}; \code{\link{without_loops}};
+Other constructor modifiers: \code{\link{simplified}},
+ \code{\link{with_edge_}}, \code{\link{with_graph_}},
+ \code{\link{without_attr}}, \code{\link{without_loops}},
\code{\link{without_multiples}}
}
-
diff --git a/man/without_attr.Rd b/man/without_attr.Rd
index 10dbb48..81f99ab 100644
--- a/man/without_attr.Rd
+++ b/man/without_attr.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{without_attr}
\alias{without_attr}
@@ -17,9 +17,8 @@ g2 <- make_(ring(10), without_attr())
g2
}
\seealso{
-Other constructor modifiers: \code{\link{simplified}};
- \code{\link{with_edge_}}; \code{\link{with_graph_}};
- \code{\link{with_vertex_}}; \code{\link{without_loops}};
+Other constructor modifiers: \code{\link{simplified}},
+ \code{\link{with_edge_}}, \code{\link{with_graph_}},
+ \code{\link{with_vertex_}}, \code{\link{without_loops}},
\code{\link{without_multiples}}
}
-
diff --git a/man/without_loops.Rd b/man/without_loops.Rd
index 034bfde..17b894b 100644
--- a/man/without_loops.Rd
+++ b/man/without_loops.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{without_loops}
\alias{without_loops}
@@ -15,9 +15,8 @@ make_(full_graph(5, loops = TRUE))
make_(full_graph(5, loops = TRUE), without_loops())
}
\seealso{
-Other constructor modifiers: \code{\link{simplified}};
- \code{\link{with_edge_}}; \code{\link{with_graph_}};
- \code{\link{with_vertex_}}; \code{\link{without_attr}};
+Other constructor modifiers: \code{\link{simplified}},
+ \code{\link{with_edge_}}, \code{\link{with_graph_}},
+ \code{\link{with_vertex_}}, \code{\link{without_attr}},
\code{\link{without_multiples}}
}
-
diff --git a/man/without_multiples.Rd b/man/without_multiples.Rd
index 56ae812..496dc03 100644
--- a/man/without_multiples.Rd
+++ b/man/without_multiples.Rd
@@ -1,4 +1,4 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make.R
\name{without_multiples}
\alias{without_multiples}
@@ -14,9 +14,8 @@ sample_(pa(10, m = 3, algorithm = "bag"))
sample_(pa(10, m = 3, algorithm = "bag"), without_multiples())
}
\seealso{
-Other constructor modifiers: \code{\link{simplified}};
- \code{\link{with_edge_}}; \code{\link{with_graph_}};
- \code{\link{with_vertex_}}; \code{\link{without_attr}};
+Other constructor modifiers: \code{\link{simplified}},
+ \code{\link{with_edge_}}, \code{\link{with_graph_}},
+ \code{\link{with_vertex_}}, \code{\link{without_attr}},
\code{\link{without_loops}}
}
-
diff --git a/man/write_graph.Rd b/man/write_graph.Rd
index 44e8cb8..f6cff15 100644
--- a/man/write_graph.Rd
+++ b/man/write_graph.Rd
@@ -1,8 +1,8 @@
-% Generated by roxygen2 (4.1.1): do not edit by hand
+% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/foreign.R
\name{write_graph}
-\alias{write.graph}
\alias{write_graph}
+\alias{write.graph}
\title{Writing the graph to a file in some format}
\usage{
write_graph(graph, file, format = c("edgelist", "pajek", "ncol", "lgl",
@@ -34,12 +34,12 @@ with one edge in a line, the two vertex ids separated by a space character.
The file is sorted by the first and the second column. This format has no
additional arguments.
}
+
\examples{
+
g <- make_ring(10)
\dontrun{write_graph(g, "/tmp/g.txt", "edgelist")}
-}
-\author{
-Gabor Csardi \email{csardi.gabor at gmail.com}
+
}
\references{
Adai AT, Date SV, Wieland S, Marcotte EM. LGL: creating a map of
@@ -49,5 +49,7 @@ networks. \emph{J Mol Biol.} 2004 Jun 25;340(1):179-90.
\seealso{
\code{\link{read_graph}}
}
+\author{
+Gabor Csardi \email{csardi.gabor at gmail.com}
+}
\keyword{graphs}
-
diff --git a/src/CHOLMOD/Include/cholmod_blas.h b/src/CHOLMOD/Include/cholmod_blas.h
index 1b0b56e..83e013f 100644
--- a/src/CHOLMOD/Include/cholmod_blas.h
+++ b/src/CHOLMOD/Include/cholmod_blas.h
@@ -52,7 +52,7 @@
#define CHOLMOD_CYGWIN
#else
#define CHOLMOD_WINDOWS
-#define BLAS_NO_UNDERSCORE
+//#define BLAS_NO_UNDERSCORE
#endif
#define CHOLMOD_ARCHITECTURE "Microsoft Windows"
diff --git a/src/DensityGrid.cpp b/src/DensityGrid.cpp
index af6022c..504b537 100644
--- a/src/DensityGrid.cpp
+++ b/src/DensityGrid.cpp
@@ -84,6 +84,7 @@ void DensityGrid::Init()
#else
igraph_error("DrL is out of memory", __FILE__, __LINE__,
IGRAPH_ENOMEM);
+ return;
#endif
}
@@ -185,6 +186,19 @@ void DensityGrid::Subtract(Node &N)
y_grid -= RADIUS;
diam = 2*RADIUS;
+ // check to see that we are inside grid
+ if ( (x_grid >= GRID_SIZE) || (x_grid < 0) ||
+ (y_grid >= GRID_SIZE) || (y_grid < 0) )
+ {
+ #ifdef MUSE_MPI
+ MPI_Abort ( MPI_COMM_WORLD, 1 );
+ #else
+ igraph_error("Exceeded density grid in DrL", __FILE__,
+ __LINE__, IGRAPH_EDRL);
+ return;
+ #endif
+ }
+
/* Subtract density values */
den_ptr = &Density[y_grid][x_grid];
fall_ptr = &fall_off[0][0];
@@ -221,13 +235,12 @@ void DensityGrid::Add(Node &N)
if ( (x_grid >= GRID_SIZE) || (x_grid < 0) ||
(y_grid >= GRID_SIZE) || (y_grid < 0) )
{
- // cout << endl << "Error: Exceeded density grid with x_grid = " << x_grid
- // << " and y_grid = " << y_grid << ". Program stopped." << endl;
#ifdef MUSE_MPI
MPI_Abort ( MPI_COMM_WORLD, 1 );
#else
igraph_error("Exceeded density grid in DrL", __FILE__,
__LINE__, IGRAPH_EDRL);
+ return;
#endif
}
diff --git a/src/DensityGrid_3d.cpp b/src/DensityGrid_3d.cpp
index 125c375..103b399 100644
--- a/src/DensityGrid_3d.cpp
+++ b/src/DensityGrid_3d.cpp
@@ -84,6 +84,7 @@ void DensityGrid::Init()
#else
igraph_error("DrL is out of memory", __FILE__, __LINE__,
IGRAPH_ENOMEM);
+ return;
#endif
}
@@ -197,6 +198,20 @@ void DensityGrid::Subtract(Node &N)
z_grid -= RADIUS;
diam = 2*RADIUS;
+ // check to see that we are inside grid
+ if ( (x_grid >= GRID_SIZE) || (x_grid < 0) ||
+ (y_grid >= GRID_SIZE) || (y_grid < 0) ||
+ (z_grid >= GRID_SIZE) || (z_grid < 0) )
+ {
+ #ifdef MUSE_MPI
+ MPI_Abort ( MPI_COMM_WORLD, 1 );
+ #else
+ igraph_error("Exceeded density grid in DrL", __FILE__,
+ __LINE__, IGRAPH_EDRL);
+ return;
+ #endif
+ }
+
/* Subtract density values */
den_ptr = &Density[z_grid][y_grid][x_grid];
fall_ptr = &fall_off[0][0][0];
@@ -238,13 +253,12 @@ void DensityGrid::Add(Node &N)
(y_grid >= GRID_SIZE) || (y_grid < 0) ||
(z_grid >= GRID_SIZE) || (z_grid < 0) )
{
- // cout << endl << "Error: Exceeded density grid with x_grid = " << x_grid
- // << " and y_grid = " << y_grid << ". Program stopped." << endl;
#ifdef MUSE_MPI
MPI_Abort ( MPI_COMM_WORLD, 1 );
#else
igraph_error("Exceeded density grid in DrL", __FILE__,
__LINE__, IGRAPH_EDRL);
+ return;
#endif
}
diff --git a/src/Makevars.in b/src/Makevars.in
index eade686..1257155 100644
--- a/src/Makevars.in
+++ b/src/Makevars.in
@@ -11,4 +11,4 @@ PKG_LIBS=@XML2_LIBS@ @GMP_LIBS@ @GLPK_LIBS@ $(FLIBS) $(LAPACK_LIBS) $(BLAS_LIBS)
all: $(SHLIB)
-OBJECTS=AMD/Source/amd.o AMD/Source/amd_1.o AMD/Source/amd_2.o AMD/Source/amd_aat.o AMD/Source/amd_control.o AMD/Source/amd_defaults.o AMD/Source/amd_dump.o AMD/Source/amd_global.o AMD/Source/amd_info.o AMD/Source/amd_order.o AMD/Source/amd_post_tree.o AMD/Source/amd_postorder.o AMD/Source/amd_preprocess.o AMD/Source/amd_valid.o AMD/Source/amdbar.o CHOLMOD/Check/cholmod_check.o CHOLMOD/Check/cholmod_read.o CHOLMOD/Check/cholmod_write.o CHOLMOD/Cholesky/cholmod_amd.o CHOLMOD/Cholesky/chol [...]
+OBJECTS=AMD/Source/amd.o AMD/Source/amd_1.o AMD/Source/amd_2.o AMD/Source/amd_aat.o AMD/Source/amd_control.o AMD/Source/amd_defaults.o AMD/Source/amd_dump.o AMD/Source/amd_global.o AMD/Source/amd_info.o AMD/Source/amd_order.o AMD/Source/amd_post_tree.o AMD/Source/amd_postorder.o AMD/Source/amd_preprocess.o AMD/Source/amd_valid.o AMD/Source/amdbar.o CHOLMOD/Check/cholmod_check.o CHOLMOD/Check/cholmod_read.o CHOLMOD/Check/cholmod_write.o CHOLMOD/Cholesky/cholmod_amd.o CHOLMOD/Cholesky/chol [...]
diff --git a/src/Makevars.win b/src/Makevars.win
index 13f49b7..3adec5f 100644
--- a/src/Makevars.win
+++ b/src/Makevars.win
@@ -1,7 +1,7 @@
-PKG_CPPFLAGS= -I${LIB_XML}/include/libxml2 -I${LIB_XML}/include -DLIBXML_STATIC -DUSING_R -DHAVE_FMEMOPEN=0 -DHAVE_OPEN_MEMSTREAM=0 -DHAVE_RINTF -DWin32 -DHAVE_LIBXML -Wall -DPACKAGE_VERSION=\"1.0.1\" -DHAVE_FMIN=1 -DHAVE_LOG2=1 -DHAVE_SNPRINTF -Ics -Iglpk -DHAVE_GLPK=1 -Iplfit -Iprpack -DIGRAPH_THREAD_LOCAL=/**/ -DPRPACK_IGRAPH_SUPPORT -I. -Iinclude -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -I$(LIB_GMP)/include
+PKG_CPPFLAGS= -I${LIB_XML}/include/libxml2 -I${LIB_XML}/include -DLIBXML_STATIC -DUSING_R -DHAVE_FMEMOPEN=0 -DHAVE_OPEN_MEMSTREAM=0 -DHAVE_RINTF -DWin32 -DHAVE_LIBXML -Wall -DPACKAGE_VERSION=\"1.1.1\" -DHAVE_FMIN=1 -DHAVE_LOG2=1 -DHAVE_SNPRINTF -Ics -Iglpk -DHAVE_GLPK=1 -Iplfit -Iprpack -DIGRAPH_THREAD_LOCAL=/**/ -DPRPACK_IGRAPH_SUPPORT -I. -Iinclude -ICHOLMOD/Include -IAMD/Include -ICOLAMD/Include -ISuiteSparse_config -DNDEBUG -DNPARTITION -DNTIMER -DNCAMD -DNPRINT -I$(LIB_GMP)/include
-PKG_CFLAGS = -DINTERNAL_ARPACK -I. -I$(LIB_GMP)/include
+PKG_CFLAGS = -DINTERNAL_ARPACK -I. -I$(LIB_GMP)/include -DHAVE_GFORTRAN
PKG_LIBS = -L${LIB_XML}/lib -lxml2 -liconv -lz -lws2_32 -lgmp -L$(LIB_GMP)/lib $(BLAS_LIBS) $(LAPACK_LIBS)
-OBJECTS=AMD/Source/amd.o AMD/Source/amd_1.o AMD/Source/amd_2.o AMD/Source/amd_aat.o AMD/Source/amd_control.o AMD/Source/amd_defaults.o AMD/Source/amd_dump.o AMD/Source/amd_global.o AMD/Source/amd_info.o AMD/Source/amd_order.o AMD/Source/amd_post_tree.o AMD/Source/amd_postorder.o AMD/Source/amd_preprocess.o AMD/Source/amd_valid.o AMD/Source/amdbar.o CHOLMOD/Check/cholmod_check.o CHOLMOD/Check/cholmod_read.o CHOLMOD/Check/cholmod_write.o CHOLMOD/Cholesky/cholmod_amd.o CHOLMOD/Cholesky/chol [...]
+OBJECTS=AMD/Source/amd.o AMD/Source/amd_1.o AMD/Source/amd_2.o AMD/Source/amd_aat.o AMD/Source/amd_control.o AMD/Source/amd_defaults.o AMD/Source/amd_dump.o AMD/Source/amd_global.o AMD/Source/amd_info.o AMD/Source/amd_order.o AMD/Source/amd_post_tree.o AMD/Source/amd_postorder.o AMD/Source/amd_preprocess.o AMD/Source/amd_valid.o AMD/Source/amdbar.o CHOLMOD/Check/cholmod_check.o CHOLMOD/Check/cholmod_read.o CHOLMOD/Check/cholmod_write.o CHOLMOD/Cholesky/cholmod_amd.o CHOLMOD/Cholesky/chol [...]
diff --git a/src/adjlist.c b/src/adjlist.c
index 9703b27..938ac49 100644
--- a/src/adjlist.c
+++ b/src/adjlist.c
@@ -391,6 +391,52 @@ int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile) {
return 0;
}
+#define ADJLIST_CANON_EDGE(from, to, directed) \
+ do { \
+ igraph_integer_t temp; \
+ if((!directed) && from < to) { \
+ temp = to; \
+ to = from; \
+ from = temp; \
+ } \
+ } while(0);
+
+igraph_bool_t igraph_adjlist_has_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t to, igraph_bool_t directed) {
+ igraph_vector_int_t* fromvec;
+ ADJLIST_CANON_EDGE(from, to, directed);
+ fromvec = igraph_adjlist_get(al, from);
+ return igraph_vector_int_binsearch2(fromvec, to);
+
+}
+
+int igraph_adjlist_replace_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t oldto, igraph_integer_t newto, igraph_bool_t directed) {
+ igraph_vector_int_t *oldfromvec, *newfromvec;
+ int err1, err2;
+ long int oldpos, newpos;
+ igraph_integer_t oldfrom = from, newfrom = from;
+ ADJLIST_CANON_EDGE(oldfrom, oldto, directed);
+ ADJLIST_CANON_EDGE(newfrom, newto, directed);
+
+ oldfromvec = igraph_adjlist_get(al, oldfrom);
+ newfromvec = igraph_adjlist_get(al, newfrom);
+
+
+ err1 = igraph_vector_int_binsearch(oldfromvec, oldto, &oldpos);
+ err2 = igraph_vector_int_binsearch(newfromvec, newto, &newpos);
+
+ /* oldfrom -> oldto should exist; newfrom -> newto should not. */
+ if((!err1) || err2)
+ return 1;
+
+ igraph_vector_int_remove(oldfromvec, oldpos);
+ if(oldfromvec == newfromvec && oldpos < newpos)
+ --newpos;
+ IGRAPH_CHECK(igraph_vector_int_insert(newfromvec, newpos, newto));
+
+ return 0;
+
+}
+
int igraph_adjedgelist_remove_duplicate(const igraph_t *graph,
igraph_inclist_t *al) {
IGRAPH_WARNING("igraph_adjedgelist_remove_duplicate() is deprecated, use "
diff --git a/src/atlas-edges.h b/src/atlas-edges.h
index 4f6ae55..2db89bb 100644
--- a/src/atlas-edges.h
+++ b/src/atlas-edges.h
@@ -33,6 +33,8 @@
__BEGIN_DECLS
+#include "igraph_types.h"
+
const igraph_real_t igraph_i_atlas_edges[]={
0,0,
1,0,
diff --git a/src/attributes.c b/src/attributes.c
index 50b40eb..29b5d8e 100644
--- a/src/attributes.c
+++ b/src/attributes.c
@@ -300,7 +300,7 @@ void igraph_attribute_combination_destroy(igraph_attribute_combination_t *comb)
int igraph_attribute_combination_add(igraph_attribute_combination_t *comb,
const char *name,
igraph_attribute_combination_type_t type,
- void *func) {
+ igraph_function_pointer_t func) {
long int i, n=igraph_vector_ptr_size(&comb->list);
/* Search, in case it is already there */
@@ -368,7 +368,7 @@ int igraph_attribute_combination_remove(igraph_attribute_combination_t *comb,
int igraph_attribute_combination_query(const igraph_attribute_combination_t *comb,
const char *name,
igraph_attribute_combination_type_t *type,
- void **func) {
+ igraph_function_pointer_t *func) {
long int i, def=-1, len=igraph_vector_ptr_size(&comb->list);
for (i=0; i<len; i++) {
@@ -406,7 +406,7 @@ int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...) {
va_start(ap, comb);
while (1) {
- void *func=0;
+ igraph_function_pointer_t func=0;
igraph_attribute_combination_type_t type;
const char *name;
@@ -416,7 +416,11 @@ int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...) {
type=(igraph_attribute_combination_type_t)va_arg(ap, int);
if (type == IGRAPH_ATTRIBUTE_COMBINE_FUNCTION) {
- func=va_arg(ap, void*);
+#if defined(__GNUC__)
+ func=va_arg(ap, void (*)(void));
+#else
+ func=va_arg(ap, void*);
+#endif
}
if (strlen(name)==0) { name=0; }
diff --git a/src/bignum.h b/src/bignum.h
index 7361388..050f4c5 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -49,7 +49,12 @@
#endif
/* up to 512 limbs (512 * 32 = 16384 bits) numbers */
-#define BN_MAXSIZE 512
+/* BN_MAXSIZE used to be 512 here, allowing us to go up to 512*32 = 16384 bits.
+ * However, this has caused compilation problems with clang 7.3 (unless
+ * compiling with -O2 -g). Since it is unlikely that we'll need that many bits,
+ * I have changed this to 128, which still yields 4096 bits of precision but
+ * does not cause problems with clang -- TN, 2016-04-18 */
+#define BN_MAXSIZE 128
#define LIMBBITS 32
#define LIMBMASK 0xfffffffful
#define HALFMASK 0x0000fffful
diff --git a/src/bipartite.c b/src/bipartite.c
index 182559e..5568b23 100644
--- a/src/bipartite.c
+++ b/src/bipartite.c
@@ -980,6 +980,9 @@ int igraph_bipartite_game_gnm(igraph_t *graph, igraph_vector_bool_t *types,
}
if (m == 0 || n1 * n2 == 0) {
+ if (m > 0) {
+ IGRAPH_ERROR("Invalid number (too large) of edges", IGRAPH_EINVAL);
+ }
IGRAPH_CHECK(retval=igraph_empty(graph, n1 + n2, directed));
} else {
diff --git a/src/bliss.cc b/src/bliss.cc
index 6eb29cc..cbbf668 100644
--- a/src/bliss.cc
+++ b/src/bliss.cc
@@ -17,19 +17,111 @@
/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-#include "bliss_timer.hh"
-#include "bliss_graph.hh"
-#include "bliss_kqueue.hh"
-#include "bliss_utils.hh"
+#include "bliss/graph.hh"
#include "igraph_types.h"
#include "igraph_topology.h"
-#include <string.h>
+#include "igraph_datatype.h"
+#include "igraph_interface.h"
-using namespace igraph;
+
+using namespace bliss;
using namespace std;
+
+namespace { // unnamed namespace
+
+inline AbstractGraph *bliss_from_igraph(const igraph_t *graph) {
+ unsigned int nof_vertices= (unsigned int)igraph_vcount(graph);
+ unsigned int nof_edges= (unsigned int)igraph_ecount(graph);
+
+ AbstractGraph *g;
+
+ if (igraph_is_directed(graph))
+ g = new Digraph(nof_vertices);
+ else
+ g = new Graph(nof_vertices);
+
+ g->set_verbose_level(0);
+
+ for (unsigned int i=0; i<nof_edges; i++) {
+ g->add_edge((unsigned int)IGRAPH_FROM(graph, i), (unsigned int)IGRAPH_TO(graph, i));
+ }
+ return g;
+}
+
+
+void bliss_free_graph(AbstractGraph *g) { delete g; }
+
+
+inline int bliss_set_sh(AbstractGraph *g, igraph_bliss_sh_t sh, bool directed) {
+ if (directed) {
+ Digraph::SplittingHeuristic gsh = Digraph::shs_fsm;
+ switch (sh) {
+ case IGRAPH_BLISS_F: gsh = Digraph::shs_f; break;
+ case IGRAPH_BLISS_FL: gsh = Digraph::shs_fl; break;
+ case IGRAPH_BLISS_FS: gsh = Digraph::shs_fs; break;
+ case IGRAPH_BLISS_FM: gsh = Digraph::shs_fm; break;
+ case IGRAPH_BLISS_FLM: gsh = Digraph::shs_flm; break;
+ case IGRAPH_BLISS_FSM: gsh = Digraph::shs_fsm; break;
+ default: IGRAPH_ERROR("Invalid splitting heuristic", IGRAPH_EINVAL);
+ }
+ static_cast<Digraph *>(g)->set_splitting_heuristic(gsh);
+ } else {
+ Graph::SplittingHeuristic gsh = Graph::shs_fsm;
+ switch (sh) {
+ case IGRAPH_BLISS_F: gsh = Graph::shs_f; break;
+ case IGRAPH_BLISS_FL: gsh = Graph::shs_fl; break;
+ case IGRAPH_BLISS_FS: gsh = Graph::shs_fs; break;
+ case IGRAPH_BLISS_FM: gsh = Graph::shs_fm; break;
+ case IGRAPH_BLISS_FLM: gsh = Graph::shs_flm; break;
+ case IGRAPH_BLISS_FSM: gsh = Graph::shs_fsm; break;
+ default: IGRAPH_ERROR("Invalid splitting heuristic", IGRAPH_EINVAL);
+ }
+ static_cast<Graph *>(g)->set_splitting_heuristic(gsh);
+ }
+ return IGRAPH_SUCCESS;
+}
+
+
+inline int bliss_set_colors(AbstractGraph *g, const igraph_vector_int_t *colors) {
+ if (colors == NULL)
+ return IGRAPH_SUCCESS;
+ const int n = g->get_nof_vertices();
+ if (n != igraph_vector_int_size(colors))
+ IGRAPH_ERROR("Invalid vertex color vector length", IGRAPH_EINVAL);
+ for (int i=0; i < n; ++i)
+ g->change_color(i, VECTOR(*colors)[i]);
+ return IGRAPH_SUCCESS;
+}
+
+
+inline void bliss_info_to_igraph(igraph_bliss_info_t *info, const Stats &stats) {
+ if (info) {
+ info->max_level = stats.get_max_level();
+ info->nof_nodes = stats.get_nof_nodes();
+ info->nof_leaf_nodes = stats.get_nof_leaf_nodes();
+ info->nof_bad_nodes = stats.get_nof_bad_nodes();
+ info->nof_canupdates = stats.get_nof_canupdates();
+ info->nof_generators = stats.get_nof_generators();
+ stats.group_size.tostring(&info->group_size);
+ }
+}
+
+
+// this is the callback function used with AbstractGraph::find_automorphisms()
+// it collects the group generators into a pointer vector
+void collect_generators(void *generators, unsigned int n, const unsigned int *aut) {
+ igraph_vector_ptr_t *gen = static_cast<igraph_vector_ptr_t *>(generators);
+ igraph_vector_t *newvector = igraph_Calloc(1, igraph_vector_t);
+ igraph_vector_init(newvector, n);
+ copy(aut, aut+n, newvector->stor_begin); // takes care of unsigned int -> double conversion
+ igraph_vector_ptr_push_back(gen, newvector);
+}
+
+} // end unnamed namespace
+
/**
* \function igraph_canonical_permutation
* Canonical permutation using BLISS
@@ -37,13 +129,15 @@ using namespace std;
* This function computes the canonical permutation which transforms
* the graph into a canonical form by using the BLISS algorithm.
*
- * \param graph The input graph, it is treated as undirected and the
- * multiple edges are ignored.
+ * \param graph The input graph. Multiple edges between the same nodes
+ * are not supported and will cause an incorrect result to be returned.
+ * \param colors An optional vertex color vector for the graph. Supply a
+ * null pointer is the graph is not colored.
* \param labeling Pointer to a vector, the result is stored here. The
* permutation takes vertex 0 to the first element of the vector,
* vertex 1 to the second, etc. The vector will be resized as
* needed.
- * \param sh The split heuristics to be used in BLISS. See \ref
+ * \param sh The splitting heuristics to be used in BLISS. See \ref
* igraph_bliss_sh_t.
* \param info If not \c NULL then information on BLISS internals is
* stored here. See \ref igraph_bliss_info_t.
@@ -51,40 +145,27 @@ using namespace std;
*
* Time complexity: exponential, in practice it is fast for many graphs.
*/
-int igraph_canonical_permutation(const igraph_t *graph, igraph_vector_t *labeling,
- igraph_bliss_sh_t sh, igraph_bliss_info_t *info) {
- Graph *g = Graph::from_igraph(graph);
- Stats stats;
+int igraph_canonical_permutation(const igraph_t *graph, const igraph_vector_int_t *colors,
+ igraph_vector_t *labeling, igraph_bliss_sh_t sh, igraph_bliss_info_t *info) {
+ AbstractGraph *g = bliss_from_igraph(graph);
+ IGRAPH_FINALLY(bliss_free_graph, g);
const unsigned int N=g->get_nof_vertices();
- unsigned int gsh=Graph::sh_flm;
-
- switch (sh) {
- case IGRAPH_BLISS_F: gsh= Graph::sh_f; break;
- case IGRAPH_BLISS_FL: gsh= Graph::sh_fl; break;
- case IGRAPH_BLISS_FS: gsh= Graph::sh_fs; break;
- case IGRAPH_BLISS_FM: gsh= Graph::sh_fm; break;
- case IGRAPH_BLISS_FLM: gsh= Graph::sh_flm; break;
- case IGRAPH_BLISS_FSM: gsh= Graph::sh_fsm; break;
- }
- g->set_splitting_heuristics(gsh);
- const unsigned int *cl = g->canonical_form(stats);
+ IGRAPH_CHECK(bliss_set_sh(g, sh, igraph_is_directed(graph)));
+ IGRAPH_CHECK(bliss_set_colors(g, colors));
+
+ Stats stats;
+ const unsigned int *cl = g->canonical_form(stats, NULL, NULL);
IGRAPH_CHECK(igraph_vector_resize(labeling, N));
for (unsigned int i=0; i<N; i++) {
VECTOR(*labeling)[i] = cl[i];
}
- delete g;
- if (info) {
- info->nof_nodes = stats.nof_nodes;
- info->nof_leaf_nodes = stats.nof_leaf_nodes;
- info->nof_bad_nodes = stats.nof_bad_nodes;
- info->nof_canupdates = stats.nof_canupdates;
- info->max_level = stats.max_level;
- stats.group_size.tostring(&info->group_size);
- }
+ bliss_info_to_igraph(info, stats);
- return 0;
+ delete g;
+ IGRAPH_FINALLY_CLEAN(1);
+ return IGRAPH_SUCCESS;
}
/**
@@ -98,9 +179,11 @@ int igraph_canonical_permutation(const igraph_t *graph, igraph_vector_t *labelin
* this number is exact, otherwise a <type>long double</type> is used
* and it is only approximate. See also \ref igraph_bliss_info_t.
*
- * \param graph The input graph, it is treated as undirected and the
- * multiple edges are ignored.
- * \param sh The split heuristics to be used in BLISS. See \ref
+ * \param graph The input graph. Multiple edges between the same nodes
+ * are not supported and will cause an incorrect result to be returned.
+ * \param colors An optional vertex color vector for the graph. Supply a
+ * null pointer is the graph is not colored.
+ * \param sh The splitting heuristics to be used in BLISS. See \ref
* igraph_bliss_sh_t.
* \param info The result is stored here, in particular in the \c
* group_size tag of \p info.
@@ -108,210 +191,68 @@ int igraph_canonical_permutation(const igraph_t *graph, igraph_vector_t *labelin
*
* Time complexity: exponential, in practice it is fast for many graphs.
*/
-int igraph_automorphisms(const igraph_t *graph,
- igraph_bliss_sh_t sh, igraph_bliss_info_t *info) {
-
- Graph *g = Graph::from_igraph(graph);
- Stats stats;
- unsigned int gsh=Graph::sh_flm;
-
- switch (sh) {
- case IGRAPH_BLISS_F: gsh= Graph::sh_f; break;
- case IGRAPH_BLISS_FL: gsh= Graph::sh_fl; break;
- case IGRAPH_BLISS_FS: gsh= Graph::sh_fs; break;
- case IGRAPH_BLISS_FM: gsh= Graph::sh_fm; break;
- case IGRAPH_BLISS_FLM: gsh= Graph::sh_flm; break;
- case IGRAPH_BLISS_FSM: gsh= Graph::sh_fsm; break;
- }
+int igraph_automorphisms(const igraph_t *graph, const igraph_vector_int_t *colors,
+ igraph_bliss_sh_t sh, igraph_bliss_info_t *info)
+{
+ AbstractGraph *g = bliss_from_igraph(graph);
+ IGRAPH_FINALLY(bliss_free_graph, g);
- g->set_splitting_heuristics(gsh);
- g->find_automorphisms(stats);
+ IGRAPH_CHECK(bliss_set_sh(g, sh, igraph_is_directed(graph)));
+ IGRAPH_CHECK(bliss_set_colors(g, colors));
- if (info) {
- info->nof_nodes = stats.nof_nodes;
- info->nof_leaf_nodes = stats.nof_leaf_nodes;
- info->nof_bad_nodes = stats.nof_bad_nodes;
- info->nof_canupdates = stats.nof_canupdates;
- info->max_level = stats.max_level;
- stats.group_size.tostring(&info->group_size);
- }
- delete g;
+ Stats stats;
+ g->find_automorphisms(stats, NULL, NULL);
- return 0;
-}
+ bliss_info_to_igraph(info, stats);
-bool bliss_verbose = false;
-// FILE *bliss_verbstr = stdout;
-
-namespace igraph {
+ delete g;
+ IGRAPH_FINALLY_CLEAN(1);
+ return IGRAPH_SUCCESS;
+}
-typedef enum {FORMAT_BIN = 0, FORMAT_ADJ} Format;
-// static Format input_format;
+/**
+ * \function igraph_automorphism_group
+ * Automorphism group generators using BLISS
+ *
+ * The generators of the automorphism group of a graph are computed
+ * using BLISS. The generator set may not be minimal and may depend on
+ * the splitting heuristics.
+ *
+ * \param graph The input graph. Multiple edges between the same nodes
+ * are not supported and will cause an incorrect result to be returned.
+ * \param colors An optional vertex color vector for the graph. Supply a
+ * null pointer is the graph is not colored.
+ * \param generators Must be an initialized pointer vector. It will
+ * contain pointers to \ref igraph_vector_t objects
+ * representing generators of the automorphism group.
+ * \param sh The splitting heuristics to be used in BLISS. See \ref
+ * igraph_bliss_sh_t.
+ * \param info If not \c NULL then information on BLISS internals is
+ * stored here. See \ref igraph_bliss_info_t.
+ * \return Error code.
+ *
+ * Time complexity: exponential, in practice it is fast for many graphs.
+ */
+int igraph_automorphism_group(
+ const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_ptr_t *generators,
+ igraph_bliss_sh_t sh, igraph_bliss_info_t *info)
+{
+ AbstractGraph *g = bliss_from_igraph(graph);
+ IGRAPH_FINALLY(bliss_free_graph, g);
-// static char *infilename = 0;
+ IGRAPH_CHECK(bliss_set_sh(g, sh, igraph_is_directed(graph)));
+ IGRAPH_CHECK(bliss_set_colors(g, colors));
-// static bool opt_canonize = false;
-// static char *opt_output_can_file = 0;
-// static unsigned int sh = Graph::sh_fm;
+ Stats stats;
+ igraph_vector_ptr_resize(generators, 0);
+ g->find_automorphisms(stats, collect_generators, generators);
-// static void usage(FILE *fp, char *argv0)
-// {
-// char *program_name;
-
-// program_name = strrchr(argv0, '/');
-
-// if(program_name) program_name++;
-// else program_name = argv0;
-
-// if(!*program_name) program_name = "bliss";
-// fprintf(fp, "bliss, version 0.35, compiled " __DATE__ "\n");
-// fprintf(fp, "Copyright 2003-2006 Tommi Junttila\n");
-// fprintf(fp,
-// "%s [<graph file>]\n"
-// "\n"
-// " -can compute canonical form\n"
-// " -ocan=f compute canonical form and output it in file f\n"
-// //" -v switch verbose mode on\n"
-// " -sh=x select splitting heuristics, where x is\n"
-// " f first non-singleton cell\n"
-// " fl first largest non-singleton cell\n"
-// " fs first smallest non-singleton cell\n"
-// " fm first maximally non-trivially connected non-singleton cell [default]\n"
-// " flm first largest maximally non-trivially connected non-singleton cell\n"
-// " fsm first smallest maximally non-trivially connected non-singleton cell\n"
-// ,program_name);
-// }
-
-
-// static void parse_options(int argc, char ** argv)
-// {
-// for(int i = 1; i < argc; i++)
-// {
-// //if(strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "-verbose") == 0)
-// //bliss_verbose = true;
-// /*
-// if(strcmp(argv[i], "-bin") == 0)
-// input_format = FORMAT_BIN;
-// else if(strcmp(argv[i], "-adj") == 0)
-// input_format = FORMAT_ADJ;
-// */
-// if(strcmp(argv[i], "-can") == 0)
-// opt_canonize = true;
-// else if((strncmp(argv[i], "-ocan=", 6) == 0) && (strlen(argv[i]) > 6))
-// {
-// opt_canonize = true;
-// opt_output_can_file = argv[i]+6;
-// }
-// else if(strcmp(argv[i], "-sh=f") == 0)
-// sh = Graph::sh_f;
-// else if(strcmp(argv[i], "-sh=fs") == 0)
-// sh = Graph::sh_fs;
-// else if(strcmp(argv[i], "-sh=fl") == 0)
-// sh = Graph::sh_fl;
-// else if(strcmp(argv[i], "-sh=fm") == 0)
-// sh = Graph::sh_fm;
-// else if(strcmp(argv[i], "-sh=fsm") == 0)
-// sh = Graph::sh_fsm;
-// else if(strcmp(argv[i], "-sh=flm") == 0)
-// sh = Graph::sh_flm;
-// else if(argv[i][0] == '-') {
-// fprintf(stderr, "unknown command line argument `%s'\n", argv[i]);
-// usage(stderr, argv[0]);
-// exit(1);
-// }
-// else {
-// if(infilename) {
-// fprintf(stderr, "too many file arguments\n");
-// usage(stderr, argv[0]);
-// exit(1);
-// }
-// else {
-// infilename = argv[i];
-// }
-// }
-// }
-// }
+ bliss_info_to_igraph(info, stats);
+ delete g;
+ IGRAPH_FINALLY_CLEAN(1);
+ return IGRAPH_SUCCESS;
}
-// using namespace igraph;
-
-// int main(int argc, char **argv)
-// {
-// Timer t;
-// t.start();
-
-// parse_options(argc, argv);
-// Graph *g = 0;
-
-// FILE *infile = stdin;
-// if(infilename) {
-// if(input_format == FORMAT_BIN)
-// infile = fopen(infilename, "rb");
-// else
-// infile = fopen(infilename, "r");
-// if(!infile) {
-// fprintf(stderr, "cannot not open `%s' for input\n", infilename);
-// exit(1); }
-// }
-
-// g = Graph::read_dimacs(infile);
-
-// if(infile != stdin)
-// fclose(infile);
-
-// if(!g)
-// return 0;
-
-// fprintf(stdout, "Graph read in %.2fs\n", t.get_intermediate());
-
-// #ifdef DEBUG_PRINT_DOT
-// g->to_dot("debug_graph.dot");
-// #endif
-
-// Stats stats;
-
-// g->set_splitting_heuristics(sh);
-
-// if(opt_canonize)
-// {
-// const unsigned int *cl = g->canonical_form(stats);
-// //fprintf(stdout, "Canonical labeling: ");
-// //print_permutation(stdout, g->get_nof_vertices(), cl);
-// //fprintf(stdout, "\n");
-// if(opt_output_can_file)
-// {
-// Graph *cf = g->permute(cl);
-// FILE *fp = fopen(opt_output_can_file, "w");
-// if(!fp)
-// {
-// fprintf(stderr, "Can not open '%s' for outputting the canonical form", opt_output_can_file);
-// exit(1);
-// }
-// cf->print_dimacs(fp);
-// fclose(fp);
-// delete cf;
-// }
-// }
-// else
-// {
-// g->find_automorphisms(stats);
-// }
-
-// printf("Nodes:\t\t%lu\n", stats.nof_nodes);
-// printf("Leaf nodes:\t%lu\n", stats.nof_leaf_nodes);
-// printf("Bad nodes:\t%lu\n", stats.nof_bad_nodes);
-// printf("Canrep updates:\t%lu\n", stats.nof_canupdates);
-// printf("Generators:\t%lu\n", stats.nof_generators);
-// printf("Max level:\t%lu\n", stats.max_level);
-// printf("|Aut|:\t\t"); stats.group_size.print(stdout); printf("\n");
-
-// t.stop();
-// printf("Total time:\t%.2fs\n", t.get_duration());
-
-// delete g;
-
-// return 0;
-// }
diff --git a/src/bliss/bignum.hh b/src/bliss/bignum.hh
new file mode 100644
index 0000000..ff8250c
--- /dev/null
+++ b/src/bliss/bignum.hh
@@ -0,0 +1,133 @@
+#ifndef BLISS_BIGNUM_HH
+#define BLISS_BIGNUM_HH
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <cstdlib>
+#include <cstdio>
+#include <cmath>
+#include <cstring>
+#include <sstream>
+#include "defs.hh"
+
+#include "igraph_memory.h"
+#include "igraph_error.h"
+
+#if defined(BLISS_USE_GMP)
+#include <gmp.h>
+#endif
+
+namespace bliss {
+
+/**
+ * \brief A very simple class for big integers (or approximation of them).
+ *
+ * If the compile time flag BLISS_USE_GMP is set,
+ * then the GNU Multiple Precision Arithmetic library (GMP) is used to
+ * obtain arbitrary precision, otherwise "long double" is used to
+ * approximate big integers.
+ */
+
+#if defined(BLISS_USE_GMP)
+
+class BigNum
+{
+ mpz_t v;
+public:
+ /**
+ * Create a new big number and set it to zero.
+ */
+ BigNum() {mpz_init(v); }
+
+ /**
+ * Destroy the number.
+ */
+ ~BigNum() {mpz_clear(v); }
+
+ /**
+ * Set the number to \a n.
+ */
+ void assign(const int n) {mpz_set_si(v, n); }
+
+ /**
+ * Multiply the number with \a n.
+ */
+ void multiply(const int n) {mpz_mul_si(v, v, n); }
+
+ /**
+ * Print the number in the file stream \a fp.
+ */
+ size_t print(FILE* const fp) const {return mpz_out_str(fp, 10, v); }
+
+ int tostring(char **str) const {
+ *str=igraph_Calloc(mpz_sizeinbase(v, 10)+2, char);
+ if (! *str) {
+ IGRAPH_ERROR("Cannot convert big number to string", IGRAPH_ENOMEM);
+ }
+ mpz_get_str(*str, 10, v);
+ return 0;
+ }
+
+};
+
+#else
+
+class BigNum
+{
+ long double v;
+public:
+ /**
+ * Create a new big number and set it to zero.
+ */
+ BigNum(): v(0.0) {}
+
+ /**
+ * Set the number to \a n.
+ */
+ void assign(const int n) {v = (long double)n; }
+
+ /**
+ * Multiply the number with \a n.
+ */
+ void multiply(const int n) {v *= (long double)n; }
+
+ /**
+ * Print the number in the file stream \a fp.
+ */
+ size_t print(FILE* const fp) const {return fprintf(fp, "%Lg", v); }
+
+ int tostring(char **str) const {
+ int size=static_cast<int>( (std::log(std::abs(v))/std::log(10.0))+4 );
+ *str=igraph_Calloc(size, char );
+ if (! *str) {
+ IGRAPH_ERROR("Cannot convert big number to string", IGRAPH_ENOMEM);
+ }
+ std::stringstream ss;
+ ss << v;
+ strncpy(*str, ss.str().c_str(), size);
+ return 0;
+ }
+};
+
+#endif
+
+} //namespace bliss
+
+#endif
diff --git a/src/bliss/bliss_heap.cc b/src/bliss/bliss_heap.cc
new file mode 100644
index 0000000..e5ce6d4
--- /dev/null
+++ b/src/bliss/bliss_heap.cc
@@ -0,0 +1,99 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
+#include "defs.hh"
+#include "heap.hh"
+
+/* use 'and' instead of '&&' */
+#if _MSC_VER
+#include <ciso646>
+#endif
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+Heap::~Heap()
+{
+ if(array)
+ {
+ free(array);
+ array = 0;
+ n = 0;
+ N = 0;
+ }
+}
+
+void Heap::upheap(unsigned int index)
+{
+ const unsigned int v = array[index];
+ array[0] = 0;
+ while(array[index/2] > v)
+ {
+ array[index] = array[index/2];
+ index = index/2;
+ }
+ array[index] = v;
+}
+
+void Heap::downheap(unsigned int index)
+{
+ const unsigned int v = array[index];
+ const unsigned int lim = n/2;
+ while(index <= lim)
+ {
+ unsigned int new_index = index + index;
+ if((new_index < n) and (array[new_index] > array[new_index+1]))
+ new_index++;
+ if(v <= array[new_index])
+ break;
+ array[index] = array[new_index];
+ index = new_index;
+ }
+ array[index] = v;
+}
+
+void Heap::init(const unsigned int size)
+{
+ if(size > N)
+ {
+ if(array)
+ free(array);
+ array = (unsigned int*)malloc((size + 1) * sizeof(unsigned int));
+ N = size;
+ }
+ n = 0;
+}
+
+void Heap::insert(const unsigned int v)
+{
+ array[++n] = v;
+ upheap(n);
+}
+
+unsigned int Heap::remove()
+{
+ const unsigned int v = array[1];
+ array[1] = array[n--];
+ downheap(1);
+ return v;
+}
+
+} // namespace bliss
diff --git a/src/bliss/defs.cc b/src/bliss/defs.cc
new file mode 100644
index 0000000..e154944
--- /dev/null
+++ b/src/bliss/defs.cc
@@ -0,0 +1,42 @@
+#include <cstdlib>
+#include <cstdio>
+#include "defs.hh"
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+#ifndef USING_R
+
+void
+fatal_error(const char* fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ fprintf(stderr,"Bliss fatal error: ");
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, "\nAborting!\n");
+ va_end(ap);
+ exit(1);
+}
+
+#endif
+
+}
diff --git a/src/bliss/defs.hh b/src/bliss/defs.hh
new file mode 100644
index 0000000..37f1404
--- /dev/null
+++ b/src/bliss/defs.hh
@@ -0,0 +1,128 @@
+#ifndef BLISS_DEFS_HH
+#define BLISS_DEFS_HH
+
+#include <cassert>
+#include <cstdarg>
+
+#include "config.h"
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#if HAVE_GMP == 1
+# define BLISS_USE_GMP
+#endif
+
+#ifdef USING_R
+#include <R.h>
+#define fatal_error(...) (error(__VA_ARGS__))
+#endif
+
+namespace bliss {
+
+/**
+ * The version number of bliss.
+ */
+static const char * const version = "0.73";
+
+/*
+ * If a fatal error (out of memory, internal error) is encountered,
+ * this function is called.
+ * There should not be a return from this function but exit or
+ * a jump to code that deallocates the AbstractGraph instance that called this.
+ */
+#ifndef USING_R
+void fatal_error(const char* fmt, ...);
+#endif
+
+
+#if defined(BLISS_DEBUG)
+#define BLISS_CONSISTENCY_CHECKS
+#define BLISS_EXPENSIVE_CONSISTENCY_CHECKS
+#endif
+
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+/* Force a check that the found automorphisms are valid */
+#define BLISS_VERIFY_AUTOMORPHISMS
+#endif
+
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+/* Force a check that the generated partitions are equitable */
+#define BLISS_VERIFY_EQUITABLEDNESS
+#endif
+
+} // namespace bliss
+
+
+
+/*! \mainpage Bliss
+ *
+ * \section intro_sec Introduction
+ *
+ * This is the source code documentation of bliss,
+ * produced by running <A href="http://www.doxygen.org">doxygen</A> in
+ * the source directory.
+ * The algorithms and data structures used in bliss are documented in
+ * the papers found at the
+ * <A href="http://www.tcs.hut.fi/Software/bliss">bliss web site</A>.
+ *
+ *
+ * \section compile_sec Compiling
+ *
+ * Compiling bliss in Linux should be easy, just execute
+ * \code
+ * make
+ * \endcode
+ * in the bliss source directory.
+ * This will produce the executable program \c bliss as well as
+ * the library file \c libbliss.a that can be linked in other programs.
+ * If you have the <A href="http://gmplib.org/">GNU Multiple Precision
+ * Arithmetic Library</A> (GMP) installed in your machine, you can also use
+ * \code
+ * make gmp
+ * \endcode
+ * to enable exact computation of automorphism group sizes.
+ *
+ * When linking the bliss library \c libbliss.a in other programs,
+ * remember to include the standard c++ library
+ * (and the GMP library if you compiled bliss to include it).
+ * For instance,
+ * \code gcc -o test test.c -lstdc++ -lgmp -lbliss\endcode
+ *
+ * \section cppapi_sec The C++ language API
+ *
+ * The C++ language API is the main API to bliss;
+ * all other APIs are just more or less complete variants of it.
+ * The C++ API consists basically of the public methods in
+ * the classes bliss::AbstractGraph, bliss::Graph, and bliss::Digraph.
+ * For an example of its use,
+ * see the \ref executable "source of the bliss executable".
+ *
+ *
+ * \section capi_sec The C language API
+ *
+ * The C language API is given in the file bliss_C.h.
+ * It is currently more restricted than the C++ API so
+ * consider using the C++ API whenever possible.
+ */
+
+
+#endif
diff --git a/src/bliss/graph.cc b/src/bliss/graph.cc
new file mode 100644
index 0000000..425fceb
--- /dev/null
+++ b/src/bliss/graph.cc
@@ -0,0 +1,5606 @@
+#include <cstdio>
+#include <cassert>
+#include <climits>
+#include <set>
+#include <list>
+#include <algorithm>
+
+#include "defs.hh"
+#include "graph.hh"
+#include "partition.hh"
+#include "utils.hh"
+
+/* use 'and' instead of '&&' */
+#if _MSC_VER
+#include <ciso646>
+#endif
+
+#ifdef USING_R
+#undef stdout
+#define stdout NULL
+#endif
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+
+namespace bliss {
+
+#define _INTERNAL_ERROR() fatal_error("%s:%d: internal error",__FILE__,__LINE__)
+#define _OUT_OF_MEMORY() fatal_error("%s:%d: out of memory",__FILE__,__LINE__)
+
+/*-------------------------------------------------------------------------
+ *
+ * Constructor and destructor routines for the abstract graph class
+ *
+ *-------------------------------------------------------------------------*/
+
+
+AbstractGraph::AbstractGraph()
+{
+ /* Initialize stuff */
+ first_path_labeling = 0;
+ first_path_labeling_inv = 0;
+ best_path_labeling = 0;
+ best_path_labeling_inv = 0;
+ first_path_automorphism = 0;
+ best_path_automorphism = 0;
+ in_search = false;
+
+ /* Default value for using "long prune" */
+ opt_use_long_prune = true;
+ /* Default value for using failure recording */
+ opt_use_failure_recording = true;
+ /* Default value for using component recursion */
+ opt_use_comprec = true;
+
+
+ verbose_level = 0;
+ verbstr = stdout;
+
+ report_hook = 0;
+ report_user_param = 0;
+}
+
+
+AbstractGraph::~AbstractGraph()
+{
+ if(first_path_labeling) {
+ free(first_path_labeling); first_path_labeling = 0; }
+ if(first_path_labeling_inv) {
+ free(first_path_labeling_inv); first_path_labeling_inv = 0; }
+ if(best_path_labeling) {
+ free(best_path_labeling); best_path_labeling = 0; }
+ if(best_path_labeling_inv) {
+ free(best_path_labeling_inv); best_path_labeling_inv = 0; }
+ if(first_path_automorphism) {
+ free(first_path_automorphism); first_path_automorphism = 0; }
+ if(best_path_automorphism) {
+ free(best_path_automorphism); best_path_automorphism = 0; }
+
+ report_hook = 0;
+ report_user_param = 0;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Verbose output management routines
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+AbstractGraph::set_verbose_level(const unsigned int level)
+{
+ verbose_level = level;
+}
+
+void
+AbstractGraph::set_verbose_file(FILE* const fp)
+{
+ verbstr = fp;
+}
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Routines for refinement to equitable partition
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+AbstractGraph::refine_to_equitable()
+{
+
+ /* Start refinement from all cells -> push 'em all in the splitting queue */
+ for(Partition::Cell* cell = p.first_cell; cell; cell = cell->next)
+ p.splitting_queue_add(cell);
+
+ do_refine_to_equitable();
+
+}
+
+void
+AbstractGraph::refine_to_equitable(Partition::Cell* const unit_cell)
+{
+
+ p.splitting_queue_add(unit_cell);
+
+ do_refine_to_equitable();
+}
+
+
+
+void
+AbstractGraph::refine_to_equitable(Partition::Cell* const unit_cell1,
+ Partition::Cell* const unit_cell2)
+{
+
+ p.splitting_queue_add(unit_cell1);
+ p.splitting_queue_add(unit_cell2);
+
+ do_refine_to_equitable();
+}
+
+
+
+bool
+AbstractGraph::do_refine_to_equitable()
+{
+
+ eqref_hash.reset();
+
+ while(!p.splitting_queue_is_empty())
+ {
+ Partition::Cell* const cell = p.splitting_queue_pop();
+
+ if(cell->is_unit())
+ {
+ if(in_search) {
+ const unsigned int index = cell->first;
+ if(first_path_automorphism)
+ {
+ /* Build the (potential) automorphism on-the-fly */
+ first_path_automorphism[first_path_labeling_inv[index]] =
+ p.elements[index];
+ }
+ if(best_path_automorphism)
+ {
+ /* Build the (potential) automorphism on-the-fly */
+ best_path_automorphism[best_path_labeling_inv[index]] =
+ p.elements[index];
+ }
+ }
+ const bool worse = split_neighbourhood_of_unit_cell(cell);
+ if(in_search and worse)
+ goto worse_exit;
+ }
+ else
+ {
+ const bool worse = split_neighbourhood_of_cell(cell);
+ if(in_search and worse)
+ goto worse_exit;
+ }
+ }
+
+ return true;
+
+ worse_exit:
+ /* Clear splitting_queue */
+ p.splitting_queue_clear();
+ return false;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Routines for handling the canonical labeling
+ *
+ *-------------------------------------------------------------------------*/
+
+/** \internal
+ * Assign the labeling induced by the current partition 'this.p' to
+ * \a labeling.
+ * That is, if the partition is [[2,0],[1]],
+ * then \a labeling will map 0 to 1, 1 to 2, and 2 to 0.
+ */
+void
+AbstractGraph::update_labeling(unsigned int* const labeling)
+{
+ const unsigned int N = get_nof_vertices();
+ unsigned int* ep = p.elements;
+ for(unsigned int i = 0; i < N; i++, ep++)
+ labeling[*ep] = i;
+}
+
+/** \internal
+ * The same as update_labeling() except that the inverse of the labeling
+ * is also produced and assigned to \a labeling_inv.
+ */
+void
+AbstractGraph::update_labeling_and_its_inverse(unsigned int* const labeling,
+ unsigned int* const labeling_inv)
+{
+ const unsigned int N = get_nof_vertices();
+ unsigned int* ep = p.elements;
+ unsigned int* clip = labeling_inv;
+
+ for(unsigned int i = 0; i < N; ) {
+ labeling[*ep] = i;
+ i++;
+ *clip = *ep;
+ ep++;
+ clip++;
+ }
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Routines for handling automorphisms
+ *
+ *-------------------------------------------------------------------------*/
+
+
+/** \internal
+ * Reset the permutation \a perm to the identity permutation.
+ */
+void
+AbstractGraph::reset_permutation(unsigned int* perm)
+{
+ const unsigned int N = get_nof_vertices();
+ for(unsigned int i = 0; i < N; i++, perm++)
+ *perm = i;
+}
+
+bool
+AbstractGraph::is_automorphism(unsigned int* const perm)
+{
+ _INTERNAL_ERROR();
+ return false;
+}
+
+bool
+AbstractGraph::is_automorphism(const std::vector<unsigned int>& perm) const
+{
+ _INTERNAL_ERROR();
+ return false;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Certificate building
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+AbstractGraph::cert_add(const unsigned int v1,
+ const unsigned int v2,
+ const unsigned int v3)
+{
+ if(refine_compare_certificate)
+ {
+ if(refine_equal_to_first)
+ {
+ /* So far equivalent to the first path... */
+ unsigned int index = certificate_current_path.size();
+ if(index >= refine_first_path_subcertificate_end)
+ {
+ refine_equal_to_first = false;
+ }
+ else if(certificate_first_path[index] != v1)
+ {
+ refine_equal_to_first = false;
+ }
+ else if(certificate_first_path[++index] != v2)
+ {
+ refine_equal_to_first = false;
+ }
+ else if(certificate_first_path[++index] != v3)
+ {
+ refine_equal_to_first = false;
+ }
+ if(opt_use_failure_recording and !refine_equal_to_first)
+ {
+ /* We just became different from the first path,
+ * remember the deviation point tree-specific invariant
+ * for the use of failure recording */
+ UintSeqHash h;
+ h.update(v1);
+ h.update(v2);
+ h.update(v3);
+ h.update(index);
+ h.update(eqref_hash.get_value());
+ failure_recording_fp_deviation = h.get_value();
+ }
+ }
+ if(refine_cmp_to_best == 0)
+ {
+ /* So far equivalent to the current best path... */
+ unsigned int index = certificate_current_path.size();
+ if(index >= refine_best_path_subcertificate_end)
+ {
+ refine_cmp_to_best = 1;
+ }
+ else if(v1 > certificate_best_path[index])
+ {
+ refine_cmp_to_best = 1;
+ }
+ else if(v1 < certificate_best_path[index])
+ {
+ refine_cmp_to_best = -1;
+ }
+ else if(v2 > certificate_best_path[++index])
+ {
+ refine_cmp_to_best = 1;
+ }
+ else if(v2 < certificate_best_path[index])
+ {
+ refine_cmp_to_best = -1;
+ }
+ else if(v3 > certificate_best_path[++index])
+ {
+ refine_cmp_to_best = 1;
+ }
+ else if(v3 < certificate_best_path[index])
+ {
+ refine_cmp_to_best = -1;
+ }
+ }
+ if((refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ return;
+ }
+ /* Update the current path certificate */
+ certificate_current_path.push_back(v1);
+ certificate_current_path.push_back(v2);
+ certificate_current_path.push_back(v3);
+}
+
+
+void
+AbstractGraph::cert_add_redundant(const unsigned int v1,
+ const unsigned int v2,
+ const unsigned int v3)
+{
+ return cert_add(v1, v2, v3);
+}
+
+
+
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Long prune code
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+AbstractGraph::long_prune_init()
+{
+ const unsigned int N = get_nof_vertices();
+ long_prune_temp.clear();
+ long_prune_temp.resize(N);
+ /* Of how many automorphisms we can store information in
+ the predefined, fixed amount of memory? */
+ const unsigned int nof_fitting_in_max_mem =
+ (long_prune_options_max_mem * 1024 * 1024) / (((N * 2) / 8)+1);
+ long_prune_max_stored_autss = long_prune_options_max_stored_auts;
+ /* Had some problems with g++ in using (a<b)?a:b when constants involved,
+ so had to make this in a stupid way... */
+ if(nof_fitting_in_max_mem < long_prune_options_max_stored_auts)
+ long_prune_max_stored_autss = nof_fitting_in_max_mem;
+
+ long_prune_deallocate();
+ long_prune_fixed.resize(N, 0);
+ long_prune_mcrs.resize(N, 0);
+ long_prune_begin = 0;
+ long_prune_end = 0;
+}
+
+void
+AbstractGraph::long_prune_deallocate()
+{
+ while(!long_prune_fixed.empty())
+ {
+ delete long_prune_fixed.back();
+ long_prune_fixed.pop_back();
+ }
+ while(!long_prune_mcrs.empty())
+ {
+ delete long_prune_mcrs.back();
+ long_prune_mcrs.pop_back();
+ }
+}
+
+void
+AbstractGraph::long_prune_swap(const unsigned int i, const unsigned int j)
+{
+ const unsigned int real_i = i % long_prune_max_stored_autss;
+ const unsigned int real_j = j % long_prune_max_stored_autss;
+ std::vector<bool>* tmp = long_prune_fixed[real_i];
+ long_prune_fixed[real_i] = long_prune_fixed[real_j];
+ long_prune_fixed[real_j] = tmp;
+ tmp = long_prune_mcrs[real_i];
+ long_prune_mcrs[real_i] = long_prune_mcrs[real_j];
+ long_prune_mcrs[real_j] = tmp;
+}
+
+std::vector<bool>&
+AbstractGraph::long_prune_allocget_fixed(const unsigned int index)
+{
+ const unsigned int i = index % long_prune_max_stored_autss;
+ if(!long_prune_fixed[i])
+ long_prune_fixed[i] = new std::vector<bool>(get_nof_vertices());
+ return *long_prune_fixed[i];
+}
+
+std::vector<bool>&
+AbstractGraph::long_prune_get_fixed(const unsigned int index)
+{
+ return *long_prune_fixed[index % long_prune_max_stored_autss];
+}
+
+std::vector<bool>&
+AbstractGraph::long_prune_allocget_mcrs(const unsigned int index)
+{
+ const unsigned int i = index % long_prune_max_stored_autss;
+ if(!long_prune_mcrs[i])
+ long_prune_mcrs[i] = new std::vector<bool>(get_nof_vertices());
+ return *long_prune_mcrs[i];
+}
+
+std::vector<bool>&
+AbstractGraph::long_prune_get_mcrs(const unsigned int index)
+{
+ return *long_prune_mcrs[index % long_prune_max_stored_autss];
+}
+
+void
+AbstractGraph::long_prune_add_automorphism(const unsigned int* aut)
+{
+ if(long_prune_max_stored_autss == 0)
+ return;
+
+ const unsigned int N = get_nof_vertices();
+
+
+ /* If the buffer of stored auts is full, remove the oldest aut */
+ if(long_prune_end - long_prune_begin == long_prune_max_stored_autss)
+ {
+ long_prune_begin++;
+ }
+ long_prune_end++;
+ std::vector<bool>& fixed = long_prune_allocget_fixed(long_prune_end-1);
+ std::vector<bool>& mcrs = long_prune_allocget_mcrs(long_prune_end-1);
+ /* Mark nodes that are (i) fixed or (ii) minimal orbit representatives
+ * under the automorphism 'aut' */
+ for(unsigned int i = 0; i < N; i++)
+ {
+ fixed[i] = (aut[i] == i);
+ if(long_prune_temp[i] == false)
+ {
+ mcrs[i] = true;
+ unsigned int j = aut[i];
+ while(j != i)
+ {
+ long_prune_temp[j] = true;
+ j = aut[j];
+ }
+ }
+ else
+ {
+ mcrs[i] = false;
+ }
+ /* Clear the temp array on-the-fly... */
+ long_prune_temp[i] = false;
+ }
+
+
+}
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Routines for handling orbit information
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+AbstractGraph::update_orbit_information(Orbit& o, const unsigned int* perm)
+{
+ const unsigned int N = get_nof_vertices();
+ for(unsigned int i = 0; i < N; i++)
+ if(perm[i] != i)
+ o.merge_orbits(i, perm[i]);
+}
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * The actual backtracking search
+ *
+ *-------------------------------------------------------------------------*/
+
+class TreeNode
+{
+ //friend class AbstractGraph;
+public:
+ unsigned int split_cell_first;
+
+ int split_element;
+ static const int SPLIT_START = -1;
+ static const int SPLIT_END = -2;
+
+ Partition::BacktrackPoint partition_bt_point;
+
+ unsigned int certificate_index;
+
+ static const char NO = -1;
+ static const char MAYBE = 0;
+ static const char YES = 1;
+
+ /* First path stuff */
+ bool fp_on;
+ bool fp_cert_equal;
+ char fp_extendable;
+
+ /* Best path stuff */
+ bool in_best_path;
+ int cmp_to_best_path;
+
+ unsigned int failure_recording_ival;
+
+ /* Component recursion related data */
+ unsigned int cr_cep_stack_size;
+ unsigned int cr_cep_index;
+ unsigned int cr_level;
+
+ bool needs_long_prune;
+ unsigned int long_prune_begin;
+ std::set<unsigned int, std::less<unsigned int> > long_prune_redundant;
+
+ UintSeqHash eqref_hash;
+ unsigned int subcertificate_length;
+};
+
+
+
+
+typedef struct {
+ unsigned int splitting_element;
+ unsigned int certificate_index;
+ unsigned int subcertificate_length;
+ UintSeqHash eqref_hash;
+} PathInfo;
+
+
+void
+AbstractGraph::search(const bool canonical, Stats& stats)
+{
+ const unsigned int N = get_nof_vertices();
+
+ unsigned int all_same_level = UINT_MAX;
+
+ p.graph = this;
+
+ /*
+ * Must be done!
+ */
+ remove_duplicate_edges();
+
+ /*
+ * Reset search statistics
+ */
+ stats.reset();
+ stats.nof_nodes = 1;
+ stats.nof_leaf_nodes = 1;
+
+ /* Free old first path data structures */
+ if(first_path_labeling) {
+ free(first_path_labeling); first_path_labeling = 0; }
+ if(first_path_labeling_inv) {
+ free(first_path_labeling_inv); first_path_labeling_inv = 0; }
+ if(first_path_automorphism) {
+ free(first_path_automorphism); first_path_automorphism = 0; }
+
+ /* Free old best path data structures */
+ if(best_path_labeling) {
+ free(best_path_labeling); best_path_labeling = 0; }
+ if(best_path_labeling_inv) {
+ free(best_path_labeling_inv); best_path_labeling_inv = 0; }
+ if(best_path_automorphism) {
+ free(best_path_automorphism); best_path_automorphism = 0; }
+
+ if(N == 0)
+ {
+ /* Nothing to do, return... */
+ return;
+ }
+
+ /* Initialize the partition ... */
+ p.init(N);
+ /* ... and the component recursion data structures in the partition */
+ if(opt_use_comprec)
+ p.cr_init();
+
+ neighbour_heap.init(N);
+
+ in_search = false;
+ /* Do not compute certificate when building the initial partition */
+ refine_compare_certificate = false;
+ /* The 'eqref_hash' hash value is not computed when building
+ * the initial partition as it is not used for anything at the moment.
+ * This saves some cycles. */
+ compute_eqref_hash = false;
+
+ make_initial_equitable_partition();
+
+ /*
+ * Allocate space for the "first path" and "best path" labelings
+ */
+ if(first_path_labeling) free(first_path_labeling);
+ first_path_labeling = (unsigned int*)calloc(N, sizeof(unsigned int));
+ if(!first_path_labeling) _OUT_OF_MEMORY();
+ if(best_path_labeling) free(best_path_labeling);
+ best_path_labeling = (unsigned int*)calloc(N, sizeof(unsigned int));
+ if(!best_path_labeling) _OUT_OF_MEMORY();
+
+ /*
+ * Is the initial partition discrete?
+ */
+ if(p.is_discrete())
+ {
+ /* Make the best path labeling i.e. the canonical labeling */
+ update_labeling(best_path_labeling);
+ /* Update statistics */
+ stats.nof_leaf_nodes = 1;
+ return;
+ }
+
+ /*
+ * Allocate the inverses of the "first path" and "best path" labelings
+ */
+ if(first_path_labeling_inv) free(first_path_labeling_inv);
+ first_path_labeling_inv = (unsigned int*)calloc(N, sizeof(unsigned int));
+ if(!first_path_labeling_inv) _OUT_OF_MEMORY();
+ if(best_path_labeling_inv) free(best_path_labeling_inv);
+ best_path_labeling_inv = (unsigned int*)calloc(N, sizeof(unsigned int));
+ if(!best_path_labeling_inv) _OUT_OF_MEMORY();
+
+ /*
+ * Allocate space for the automorphisms
+ */
+ if(first_path_automorphism) free(first_path_automorphism);
+ first_path_automorphism = (unsigned int*)malloc(N * sizeof(unsigned int));
+ if(!first_path_automorphism) _OUT_OF_MEMORY();
+ if(best_path_automorphism) free(best_path_automorphism);
+ best_path_automorphism = (unsigned int*)malloc(N * sizeof(unsigned int));
+ if(!best_path_automorphism) _OUT_OF_MEMORY();
+
+ /*
+ * Initialize orbit information so that all vertices are in their own orbits
+ */
+ first_path_orbits.init(N);
+ best_path_orbits.init(N);
+
+ /*
+ * Initialize certificate memory
+ */
+ initialize_certificate();
+
+ std::vector<TreeNode> search_stack;
+ std::vector<PathInfo> first_path_info;
+ std::vector<PathInfo> best_path_info;
+
+ search_stack.clear();
+
+ /* Initialize "long prune" data structures */
+ if(opt_use_long_prune)
+ long_prune_init();
+
+ /*
+ * Initialize failure recording data structures
+ */
+ typedef std::set<unsigned int, std::less<unsigned int> > FailureRecordingSet;
+ std::vector<FailureRecordingSet> failure_recording_hashes;
+
+ /*
+ * Initialize component recursion data structures
+ */
+ cr_cep_stack.clear();
+ unsigned int cr_cep_index = 0;
+ {
+ /* Inset a sentinel "component end point" */
+ CR_CEP sentinel;
+ sentinel.creation_level = 0;
+ sentinel.discrete_cell_limit = get_nof_vertices();
+ sentinel.next_cr_level = 0;
+ sentinel.next_cep_index = 0;
+ sentinel.first_checked = false;
+ sentinel.best_checked = false;
+ cr_cep_index = 0;
+ cr_cep_stack.push_back(sentinel);
+ }
+ cr_level = 0;
+ if(opt_use_comprec and
+ nucr_find_first_component(cr_level) == true and
+ p.nof_discrete_cells() + cr_component_elements <
+ cr_cep_stack[cr_cep_index].discrete_cell_limit)
+ {
+ cr_level = p.cr_split_level(0, cr_component);
+ CR_CEP cep;
+ cep.creation_level = 0;
+ cep.discrete_cell_limit = p.nof_discrete_cells() + cr_component_elements;
+ cep.next_cr_level = 0;
+ cep.next_cep_index = cr_cep_index;
+ cep.first_checked = false;
+ cep.best_checked = false;
+ cr_cep_index = cr_cep_stack.size();
+ cr_cep_stack.push_back(cep);
+ }
+
+ /*
+ * Build the root node of the search tree
+ */
+ {
+ TreeNode root;
+ Partition::Cell* split_cell = find_next_cell_to_be_splitted(p.first_cell);
+ root.split_cell_first = split_cell->first;
+ root.split_element = TreeNode::SPLIT_START;
+ root.partition_bt_point = p.set_backtrack_point();
+ root.certificate_index = 0;
+ root.fp_on = true;
+ root.fp_cert_equal = true;
+ root.fp_extendable = TreeNode::MAYBE;
+ root.in_best_path = false;
+ root.cmp_to_best_path = 0;
+ root.long_prune_begin = 0;
+
+ root.failure_recording_ival = 0;
+
+ /* Save component recursion info for backtracking */
+ root.cr_level = cr_level;
+ root.cr_cep_stack_size = cr_cep_stack.size();
+ root.cr_cep_index = cr_cep_index;
+ search_stack.push_back(root);
+ }
+
+ /*
+ * Set status and global flags for search related procedures
+ */
+ in_search = true;
+ /* Do not compare certificates during refinement until the first path has been traversed to the leaf */
+ refine_compare_certificate = false;
+
+
+
+
+ /*
+ * The actual backtracking search
+ */
+ while(!search_stack.empty())
+ {
+ TreeNode& current_node = search_stack.back();
+ const unsigned int current_level = (unsigned int)search_stack.size()-1;
+
+
+ if(opt_use_comprec)
+ {
+ CR_CEP& cep = cr_cep_stack[current_node.cr_cep_index];
+ if(cep.first_checked == true and
+ current_node.fp_extendable == TreeNode::MAYBE and
+ !search_stack[cep.creation_level].fp_on)
+ {
+ current_node.fp_extendable = TreeNode::NO;
+ }
+ }
+
+ if(current_node.fp_on)
+ {
+ if(current_node.split_element == TreeNode::SPLIT_END)
+ {
+ search_stack.pop_back();
+ continue;
+ }
+ }
+ else
+ {
+ if(current_node.fp_extendable == TreeNode::YES)
+ {
+ search_stack.pop_back();
+ continue;
+ }
+ if(current_node.split_element == TreeNode::SPLIT_END)
+ {
+ if(opt_use_failure_recording)
+ {
+ TreeNode& parent_node = search_stack[current_level-1];
+ if(parent_node.fp_on)
+ failure_recording_hashes[current_level-1].insert(current_node.failure_recording_ival);
+ }
+ search_stack.pop_back();
+ continue;
+ }
+ if(current_node.fp_extendable == TreeNode::NO and
+ (!canonical or current_node.cmp_to_best_path < 0))
+ {
+ if(opt_use_failure_recording)
+ {
+ TreeNode& parent_node = search_stack[current_level-1];
+ if(parent_node.fp_on)
+ failure_recording_hashes[current_level-1].insert(current_node.failure_recording_ival);
+ }
+ search_stack.pop_back();
+ continue;
+ }
+ }
+
+ /* Restore partition ... */
+ p.goto_backtrack_point(current_node.partition_bt_point);
+ /* ... and re-remember backtracking point */
+ current_node.partition_bt_point = p.set_backtrack_point();
+
+ /* Restore current path certificate */
+ certificate_index = current_node.certificate_index;
+ refine_current_path_certificate_index = current_node.certificate_index;
+ certificate_current_path.resize(certificate_index);
+
+ /* Fetch split cell information */
+ Partition::Cell * const cell =
+ p.get_cell(p.elements[current_node.split_cell_first]);
+
+ /* Restore component recursion information */
+ cr_level = current_node.cr_level;
+ cr_cep_stack.resize(current_node.cr_cep_stack_size);
+ cr_cep_index = current_node.cr_cep_index;
+
+
+ /*
+ * Update long prune redundancy sets
+ */
+ if(opt_use_long_prune and current_level >= 1 and !current_node.fp_on)
+ {
+ unsigned int begin = (current_node.long_prune_begin>long_prune_begin)?current_node.long_prune_begin:long_prune_begin;
+ for(unsigned int i = begin; i < long_prune_end; i++)
+ {
+ const std::vector<bool>& fixed = long_prune_get_fixed(i);
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ for(unsigned int l = 0; l < search_stack.size()-2; l++)
+ assert(fixed[search_stack[l].split_element]);
+#endif
+ if(fixed[search_stack[search_stack.size()-1-1].split_element] ==
+ false)
+ {
+ long_prune_swap(begin, i);
+ begin++;
+ current_node.long_prune_begin = begin;
+ continue;
+ }
+ }
+
+ if(current_node.split_element == TreeNode::SPLIT_START)
+ {
+ current_node.needs_long_prune = true;
+ }
+ else if(current_node.needs_long_prune)
+ {
+ current_node.needs_long_prune = false;
+ unsigned int begin = (current_node.long_prune_begin>long_prune_begin)?current_node.long_prune_begin:long_prune_begin;
+ for(unsigned int i = begin; i < long_prune_end; i++)
+ {
+ const std::vector<bool>& fixed = long_prune_get_fixed(i);
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ for(unsigned int l = 0; l < search_stack.size()-2; l++)
+ assert(fixed[search_stack[l].split_element]);
+#endif
+ assert(fixed[search_stack[current_level-1].split_element] == true);
+ if(fixed[search_stack[current_level-1].split_element] == false)
+ {
+ long_prune_swap(begin, i);
+ begin++;
+ current_node.long_prune_begin = begin;
+ continue;
+ }
+ const std::vector<bool>& mcrs = long_prune_get_mcrs(i);
+ unsigned int* ep = p.elements + cell->first;
+ for(unsigned int j = cell->length; j > 0; j--, ep++) {
+ if(mcrs[*ep] == false)
+ current_node.long_prune_redundant.insert(*ep);
+ }
+ }
+ }
+ }
+
+
+ /*
+ * Find the next smallest, non-isomorphic element in the cell and
+ * store it in current_node.split_element
+ */
+ {
+ unsigned int next_split_element = UINT_MAX;
+ //unsigned int* next_split_element_pos = 0;
+ unsigned int* ep = p.elements + cell->first;
+ if(current_node.fp_on)
+ {
+ /* Find the next larger splitting element that is
+ * a minimal orbit representative w.r.t. first_path_orbits */
+ for(unsigned int i = cell->length; i > 0; i--, ep++) {
+ if((int)(*ep) > current_node.split_element and
+ *ep < next_split_element and
+ first_path_orbits.is_minimal_representative(*ep)) {
+ next_split_element = *ep;
+ //next_split_element_pos = ep;
+ }
+ }
+ }
+ else if(current_node.in_best_path)
+ {
+ /* Find the next larger splitting element that is
+ * a minimal orbit representative w.r.t. best_path_orbits */
+ for(unsigned int i = cell->length; i > 0; i--, ep++) {
+ if((int)(*ep) > current_node.split_element and
+ *ep < next_split_element and
+ best_path_orbits.is_minimal_representative(*ep) and
+ (!opt_use_long_prune or
+ current_node.long_prune_redundant.find(*ep) ==
+ current_node.long_prune_redundant.end())) {
+ next_split_element = *ep;
+ //next_split_element_pos = ep;
+ }
+ }
+ }
+ else
+ {
+ /* Find the next larger splitting element */
+ for(unsigned int i = cell->length; i > 0; i--, ep++) {
+ if((int)(*ep) > current_node.split_element and
+ *ep < next_split_element and
+ (!opt_use_long_prune or
+ current_node.long_prune_redundant.find(*ep) ==
+ current_node.long_prune_redundant.end())) {
+ next_split_element = *ep;
+ //next_split_element_pos = ep;
+ }
+ }
+ }
+ if(next_split_element == UINT_MAX)
+ {
+ /* No more (unexplored children) in the cell */
+ current_node.split_element = TreeNode::SPLIT_END;
+ if(current_node.fp_on)
+ {
+ /* Update group size */
+ const unsigned int index = first_path_orbits.orbit_size(first_path_info[search_stack.size()-1].splitting_element);
+ stats.group_size.multiply(index);
+ stats.group_size_approx *= (long double)index;
+ /*
+ * Update all_same_level
+ */
+ if(index == cell->length and all_same_level == current_level+1)
+ all_same_level = current_level;
+ if(verbstr and verbose_level >= 2) {
+ fprintf(verbstr,
+ "Level %u: orbits=%u, index=%u/%u, all_same_level=%u\n",
+ current_level,
+ first_path_orbits.nof_orbits(),
+ index, cell->length,
+ all_same_level);
+ fflush(verbstr);
+ }
+ }
+ continue;
+ }
+
+ /* Split on smallest */
+ current_node.split_element = next_split_element;
+ }
+
+ const unsigned int child_level = current_level+1;
+ /* Update some statistics */
+ stats.nof_nodes++;
+ if(search_stack.size() > stats.max_level)
+ stats.max_level = search_stack.size();
+
+
+
+ /* Set flags and indices for the refiner certificate builder */
+ refine_equal_to_first = current_node.fp_cert_equal;
+ refine_cmp_to_best = current_node.cmp_to_best_path;
+ if(!first_path_info.empty())
+ {
+ if(refine_equal_to_first)
+ refine_first_path_subcertificate_end =
+ first_path_info[search_stack.size()-1].certificate_index +
+ first_path_info[search_stack.size()-1].subcertificate_length;
+ if(canonical)
+ {
+ if(refine_cmp_to_best == 0)
+ refine_best_path_subcertificate_end =
+ best_path_info[search_stack.size()-1].certificate_index +
+ best_path_info[search_stack.size()-1].subcertificate_length;
+ }
+ else
+ refine_cmp_to_best = -1;
+ }
+
+ const bool was_fp_cert_equal = current_node.fp_cert_equal;
+
+ /* Individualize, i.e. split the cell in two, the latter new cell
+ * will be a unit one containing info.split_element */
+ Partition::Cell* const new_cell =
+ p.individualize(cell, current_node.split_element);
+
+ /*
+ * Refine the new partition to equitable
+ */
+ if(cell->is_unit())
+ refine_to_equitable(cell, new_cell);
+ else
+ refine_to_equitable(new_cell);
+
+
+
+
+ /* Update statistics */
+ if(p.is_discrete())
+ stats.nof_leaf_nodes++;
+
+
+ if(!first_path_info.empty())
+ {
+ /* We are no longer on the first path */
+ const unsigned int subcertificate_length =
+ certificate_current_path.size() - certificate_index;
+ if(refine_equal_to_first)
+ {
+ /* Was equal to the first path so far */
+ PathInfo& first_pinfo = first_path_info[current_level];
+ assert(first_pinfo.certificate_index == certificate_index);
+ if(subcertificate_length != first_pinfo.subcertificate_length)
+ {
+ refine_equal_to_first = false;
+ if(opt_use_failure_recording)
+ failure_recording_fp_deviation = subcertificate_length;
+ }
+ else if(first_pinfo.eqref_hash.cmp(eqref_hash) != 0)
+ {
+ refine_equal_to_first = false;
+ if(opt_use_failure_recording)
+ failure_recording_fp_deviation = eqref_hash.get_value();
+ }
+ }
+ if(canonical and (refine_cmp_to_best == 0))
+ {
+ /* Was equal to the best path so far */
+ PathInfo& bestp_info = best_path_info[current_level];
+ assert(bestp_info.certificate_index == certificate_index);
+ if(subcertificate_length < bestp_info.subcertificate_length)
+ {
+ refine_cmp_to_best = -1;
+ }
+ else if(subcertificate_length > bestp_info.subcertificate_length)
+ {
+ refine_cmp_to_best = 1;
+ }
+ else if(bestp_info.eqref_hash.cmp(eqref_hash) > 0)
+ {
+ refine_cmp_to_best = -1;
+ }
+ else if(bestp_info.eqref_hash.cmp(eqref_hash) < 0)
+ {
+ refine_cmp_to_best = 1;
+ }
+ }
+
+ if(opt_use_failure_recording and
+ was_fp_cert_equal and
+ !refine_equal_to_first)
+ {
+ UintSeqHash k;
+ k.update(failure_recording_fp_deviation);
+ k.update(eqref_hash.get_value());
+ failure_recording_fp_deviation = k.get_value();
+
+ if(current_node.fp_on)
+ failure_recording_hashes[current_level].insert(failure_recording_fp_deviation);
+ else
+ {
+ for(unsigned int i = current_level; i > 0; i--)
+ {
+ if(search_stack[i].fp_on)
+ break;
+ const FailureRecordingSet& s = failure_recording_hashes[i];
+ if(i == current_level and
+ s.find(failure_recording_fp_deviation) != s.end())
+ break;
+ if(s.find(0) != s.end())
+ break;
+ search_stack[i].fp_extendable = TreeNode::NO;
+ }
+ }
+ }
+
+
+ /* Check if no longer equal to the first path and,
+ * if canonical labeling is desired, also worse than the
+ * current best path */
+ if(refine_equal_to_first == false and
+ (!canonical or (refine_cmp_to_best < 0)))
+ {
+ /* Yes, backtrack */
+ stats.nof_bad_nodes++;
+ if(current_node.fp_cert_equal == true and
+ current_level+1 > all_same_level)
+ {
+ assert(all_same_level >= 1);
+ for(unsigned int i = all_same_level;
+ i < search_stack.size();
+ i++)
+ {
+ search_stack[i].fp_extendable = TreeNode::NO;
+ }
+ }
+
+ continue;
+ }
+ }
+
+#if defined(BLISS_VERIFY_EQUITABLEDNESS)
+ /* The new partition should be equitable */
+ if(!is_equitable())
+ fatal_error("consistency check failed - partition after refinement is not equitable");
+#endif
+
+ /*
+ * Next level search tree node info
+ */
+ TreeNode child_node;
+
+ /* No more in the first path */
+ child_node.fp_on = false;
+ /* No more in the best path */
+ child_node.in_best_path = false;
+
+ child_node.fp_cert_equal = refine_equal_to_first;
+ if(current_node.fp_extendable == TreeNode::NO or
+ (current_node.fp_extendable == TreeNode::MAYBE and
+ child_node.fp_cert_equal == false))
+ child_node.fp_extendable = TreeNode::NO;
+ else
+ child_node.fp_extendable = TreeNode::MAYBE;
+ child_node.cmp_to_best_path = refine_cmp_to_best;
+
+ child_node.failure_recording_ival = 0;
+ child_node.cr_cep_stack_size = current_node.cr_cep_stack_size;
+ child_node.cr_cep_index = current_node.cr_cep_index;
+ child_node.cr_level = current_node.cr_level;
+
+ certificate_index = certificate_current_path.size();
+
+ current_node.eqref_hash = eqref_hash;
+ current_node.subcertificate_length =
+ certificate_index - current_node.certificate_index;
+
+
+ /*
+ * The first encountered leaf node at the end of the "first path"?
+ */
+ if(p.is_discrete() and first_path_info.empty())
+ {
+ //fprintf(stdout, "Level %u: FIRST\n", child_level); fflush(stdout);
+ stats.nof_canupdates++;
+ /*
+ * Update labelings and their inverses
+ */
+ update_labeling_and_its_inverse(first_path_labeling,
+ first_path_labeling_inv);
+ update_labeling_and_its_inverse(best_path_labeling,
+ best_path_labeling_inv);
+ /*
+ * Reset automorphism array
+ */
+ reset_permutation(first_path_automorphism);
+ reset_permutation(best_path_automorphism);
+ /*
+ * Reset orbit information
+ */
+ first_path_orbits.reset();
+ best_path_orbits.reset();
+ /*
+ * Reset group size
+ */
+ stats.group_size.assign(1);
+ stats.group_size_approx = 1.0;
+ /*
+ * Reset all_same_level
+ */
+ all_same_level = child_level;
+ /*
+ * Mark the current path to be the first and best one and save it
+ */
+ const unsigned int base_size = search_stack.size();
+ best_path_info.clear();
+ //fprintf(stdout, " New base is: ");
+ for(unsigned int i = 0; i < base_size; i++) {
+ search_stack[i].fp_on = true;
+ search_stack[i].fp_cert_equal = true;
+ search_stack[i].fp_extendable = TreeNode::YES;
+ search_stack[i].in_best_path = true;
+ search_stack[i].cmp_to_best_path = 0;
+ PathInfo path_info;
+ path_info.splitting_element = search_stack[i].split_element;
+ path_info.certificate_index = search_stack[i].certificate_index;
+ path_info.eqref_hash = search_stack[i].eqref_hash;
+ path_info.subcertificate_length = search_stack[i].subcertificate_length;
+ first_path_info.push_back(path_info);
+ best_path_info.push_back(path_info);
+ //fprintf(stdout, "%u ", search_stack[i].split_element);
+ }
+ //fprintf(stdout, "\n"); fflush(stdout);
+ /* Copy certificates */
+ certificate_first_path = certificate_current_path;
+ certificate_best_path = certificate_current_path;
+
+ /* From now on, compare certificates when refining */
+ refine_compare_certificate = true;
+
+ if(opt_use_failure_recording)
+ failure_recording_hashes.resize(base_size);
+
+ /*
+ for(unsigned int j = 0; j < search_stack.size(); j++)
+ fprintf(stderr, "%u ", search_stack[j].split_element);
+ fprintf(stderr, "\n");
+ p.print(stderr); fprintf(stderr, "\n");
+ */
+
+ /*
+ * Backtrack to the previous level
+ */
+ continue;
+ }
+
+
+ if(p.is_discrete() and child_node.fp_cert_equal)
+ {
+ /*
+ * A leaf node that is equal to the first one.
+ * An automorphism found: aut[i] = elements[first_path_labeling[i]]
+ */
+ goto handle_first_path_automorphism;
+ }
+
+
+ if(!p.is_discrete())
+ {
+ Partition::Cell* next_split_cell = 0;
+ /*
+ * An internal, non-leaf node
+ */
+ if(opt_use_comprec)
+ {
+ assert(p.nof_discrete_cells() <=
+ cr_cep_stack[cr_cep_index].discrete_cell_limit);
+ assert(cr_level == child_node.cr_level);
+
+
+ if(p.nof_discrete_cells() ==
+ cr_cep_stack[cr_cep_index].discrete_cell_limit)
+ {
+ /* We have reached the end of a component */
+ assert(cr_cep_index != 0);
+ CR_CEP& cep = cr_cep_stack[cr_cep_index];
+
+ /* First, compare with respect to the first path */
+ if(first_path_info.empty() or child_node.fp_cert_equal) {
+ if(cep.first_checked == false)
+ {
+ /* First time, go to the next component */
+ cep.first_checked = true;
+ }
+ else
+ {
+ assert(!first_path_info.empty());
+ assert(cep.creation_level < search_stack.size());
+ TreeNode& old_info = search_stack[cep.creation_level];
+ /* If the component was found when on the first path,
+ * handle the found automorphism as the other
+ * first path automorphisms */
+ if(old_info.fp_on)
+ goto handle_first_path_automorphism;
+ }
+ }
+
+ if(canonical and
+ !first_path_info.empty() and
+ child_node.cmp_to_best_path >= 0) {
+ if(cep.best_checked == false)
+ {
+ /* First time, go to the next component */
+ cep.best_checked = true;
+ }
+ else
+ {
+ assert(cep.creation_level < search_stack.size());
+ TreeNode& old_info = search_stack[cep.creation_level];
+ if(child_node.cmp_to_best_path == 0) {
+ /* If the component was found when on the best path,
+ * handle the found automorphism as the other
+ * best path automorphisms */
+ if(old_info.in_best_path)
+ goto handle_best_path_automorphism;
+ /* Otherwise, we do not remember the automorhism as
+ * we didn't memorize the path that was invariant
+ * equal to the best one and passed through the
+ * component.
+ * Thus we can only backtrack to the previous level */
+ child_node.cmp_to_best_path = -1;
+ if(!child_node.fp_cert_equal)
+ {
+ continue;
+ }
+ }
+ else {
+ assert(child_node.cmp_to_best_path > 0);
+ if(old_info.in_best_path)
+ {
+ stats.nof_canupdates++;
+ /*
+ * Update canonical labeling and its inverse
+ */
+ for(unsigned int i = 0; i < N; i++) {
+ if(p.get_cell(p.elements[i])->is_unit()) {
+ best_path_labeling[p.elements[i]] = i;
+ best_path_labeling_inv[i] = p.elements[i];
+ }
+ }
+ //update_labeling_and_its_inverse(best_path_labeling, best_path_labeling_inv);
+ /* Reset best path automorphism */
+ reset_permutation(best_path_automorphism);
+ /* Reset best path orbit structure */
+ best_path_orbits.reset();
+ /* Mark to be the best one and save prefix */
+ unsigned int postfix_start = cep.creation_level;
+ assert(postfix_start < best_path_info.size());
+ while(p.get_cell(best_path_info[postfix_start].splitting_element)->is_unit()) {
+ postfix_start++;
+ assert(postfix_start < best_path_info.size());
+ }
+ unsigned int postfix_start_cert = best_path_info[postfix_start].certificate_index;
+ std::vector<PathInfo> best_path_temp = best_path_info;
+ best_path_info.clear();
+ for(unsigned int i = 0; i < search_stack.size(); i++) {
+ TreeNode& ss_info = search_stack[i];
+ PathInfo bp_info;
+ ss_info.cmp_to_best_path = 0;
+ ss_info.in_best_path = true;
+ bp_info.splitting_element = ss_info.split_element;
+ bp_info.certificate_index = ss_info.certificate_index;
+ bp_info.subcertificate_length = ss_info.subcertificate_length;
+ bp_info.eqref_hash = ss_info.eqref_hash;
+ best_path_info.push_back(bp_info);
+ }
+ /* Copy the postfix of the previous best path */
+ for(unsigned int i = postfix_start;
+ i < best_path_temp.size();
+ i++)
+ {
+ best_path_info.push_back(best_path_temp[i]);
+ best_path_info[best_path_info.size()-1].certificate_index =
+ best_path_info[best_path_info.size()-2].certificate_index +
+ best_path_info[best_path_info.size()-2].subcertificate_length;
+ }
+ std::vector<unsigned int> certificate_best_path_old = certificate_best_path;
+ certificate_best_path = certificate_current_path;
+ for(unsigned int i = postfix_start_cert; i < certificate_best_path_old.size(); i++)
+ certificate_best_path.push_back(certificate_best_path_old[i]);
+ assert(certificate_best_path.size() == best_path_info.back().certificate_index + best_path_info.back().subcertificate_length);
+ /* Backtrack to the previous level */
+ continue;
+ }
+ }
+ }
+ }
+
+ /* No backtracking performed, go to next componenet */
+ cr_level = cep.next_cr_level;
+ cr_cep_index = cep.next_cep_index;
+ }
+
+ /* Check if the current component has been split into
+ * new non-uniformity subcomponents */
+ //if(nucr_find_first_component(cr_level) == true and
+ // p.nof_discrete_cells() + cr_component_elements <
+ // cr_cep_stack[cr_cep_index].discrete_cell_limit)
+ if(nucr_find_first_component(cr_level, cr_component,
+ cr_component_elements,
+ next_split_cell) == true and
+ p.nof_discrete_cells() + cr_component_elements <
+ cr_cep_stack[cr_cep_index].discrete_cell_limit)
+ {
+ const unsigned int next_cr_level =
+ p.cr_split_level(cr_level, cr_component);
+ CR_CEP cep;
+ cep.creation_level = search_stack.size();
+ cep.discrete_cell_limit =
+ p.nof_discrete_cells() + cr_component_elements;
+ cep.next_cr_level = cr_level;
+ cep.next_cep_index = cr_cep_index;
+ cep.first_checked = false;
+ cep.best_checked = false;
+ cr_cep_index = cr_cep_stack.size();
+ cr_cep_stack.push_back(cep);
+ cr_level = next_cr_level;
+ }
+ }
+
+
+ /*
+ * Build the next node info
+ */
+ /* Find the next cell to be splitted */
+ if(!next_split_cell)
+ next_split_cell = find_next_cell_to_be_splitted(p.get_cell(p.elements[current_node.split_cell_first]));
+ //Partition::Cell * const next_split_cell = find_next_cell_to_be_splitted(p.get_cell(p.elements[current_node.split_cell_first]));
+ child_node.split_cell_first = next_split_cell->first;
+ child_node.split_element = TreeNode::SPLIT_START;
+ child_node.certificate_index = certificate_index;
+ child_node.partition_bt_point = p.set_backtrack_point();
+ child_node.long_prune_redundant.clear();
+ child_node.long_prune_begin = current_node.long_prune_begin;
+
+ /* Save component recursion info for backtracking */
+ child_node.cr_level = cr_level;
+ child_node.cr_cep_stack_size = cr_cep_stack.size();
+ child_node.cr_cep_index = cr_cep_index;
+
+ search_stack.push_back(child_node);
+ continue;
+ }
+
+ /*
+ * A leaf node not in the first path or equivalent to the first path
+ */
+
+
+
+ if(child_node.cmp_to_best_path > 0)
+ {
+ /*
+ * A new, better representative found
+ */
+ //fprintf(stdout, "Level %u: NEW BEST\n", child_level); fflush(stdout);
+ stats.nof_canupdates++;
+ /*
+ * Update canonical labeling and its inverse
+ */
+ update_labeling_and_its_inverse(best_path_labeling,
+ best_path_labeling_inv);
+ /* Reset best path automorphism */
+ reset_permutation(best_path_automorphism);
+ /* Reset best path orbit structure */
+ best_path_orbits.reset();
+ /*
+ * Mark the current path to be the best one and save it
+ */
+ const unsigned int base_size = search_stack.size();
+ assert(current_level+1 == base_size);
+ best_path_info.clear();
+ for(unsigned int i = 0; i < base_size; i++) {
+ search_stack[i].cmp_to_best_path = 0;
+ search_stack[i].in_best_path = true;
+ PathInfo path_info;
+ path_info.splitting_element = search_stack[i].split_element;
+ path_info.certificate_index = search_stack[i].certificate_index;
+ path_info.subcertificate_length = search_stack[i].subcertificate_length;
+ path_info.eqref_hash = search_stack[i].eqref_hash;
+ best_path_info.push_back(path_info);
+ }
+ certificate_best_path = certificate_current_path;
+ /*
+ * Backtrack to the previous level
+ */
+ continue;
+ }
+
+
+ handle_best_path_automorphism:
+ /*
+ *
+ * Best path automorphism handling
+ *
+ */
+ {
+
+ /*
+ * Equal to the previous best path
+ */
+ if(p.is_discrete())
+ {
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ /* Verify that the automorphism is correctly built */
+ for(unsigned int i = 0; i < N; i++)
+ assert(best_path_automorphism[i] ==
+ p.elements[best_path_labeling[i]]);
+#endif
+ }
+ else
+ {
+ /* An automorphism that was found before the partition was discrete.
+ * Set the image of all elements in non-disrete cells accordingly */
+ for(Partition::Cell* c = p.first_nonsingleton_cell; c;
+ c = c->next_nonsingleton) {
+ for(unsigned int i = c->first; i < c->first+c->length; i++)
+ if(p.get_cell(p.elements[best_path_labeling[p.elements[i]]])->is_unit())
+ best_path_automorphism[p.elements[best_path_labeling[p.elements[i]]]] = p.elements[i];
+ else
+ best_path_automorphism[p.elements[i]] = p.elements[i];
+ }
+ }
+
+#if defined(BLISS_VERIFY_AUTOMORPHISMS)
+ /* Verify that it really is an automorphism */
+ if(!is_automorphism(best_path_automorphism))
+ fatal_error("Best path automorhism validation check failed");
+#endif
+
+ unsigned int gca_level_with_first = 0;
+ for(unsigned int i = search_stack.size(); i > 0; i--) {
+ if((int)first_path_info[gca_level_with_first].splitting_element !=
+ search_stack[gca_level_with_first].split_element)
+ break;
+ gca_level_with_first++;
+ }
+
+ unsigned int gca_level_with_best = 0;
+ for(unsigned int i = search_stack.size(); i > 0; i--) {
+ if((int)best_path_info[gca_level_with_best].splitting_element !=
+ search_stack[gca_level_with_best].split_element)
+ break;
+ gca_level_with_best++;
+ }
+
+ if(opt_use_long_prune)
+ {
+ /* Record automorphism */
+ long_prune_add_automorphism(best_path_automorphism);
+ }
+
+ /*
+ * Update orbit information
+ */
+ update_orbit_information(best_path_orbits, best_path_automorphism);
+
+ /*
+ * Update orbit information
+ */
+ const unsigned int nof_old_orbits = first_path_orbits.nof_orbits();
+ update_orbit_information(first_path_orbits, best_path_automorphism);
+ if(nof_old_orbits != first_path_orbits.nof_orbits())
+ {
+ /* Some orbits were merged */
+ /* Report automorphism */
+ if(report_hook)
+ (*report_hook)(report_user_param,
+ get_nof_vertices(),
+ best_path_automorphism);
+ /* Update statistics */
+ stats.nof_generators++;
+ }
+
+ /*
+ * Compute backjumping level
+ */
+ unsigned int backjumping_level = current_level+1-1;
+ if(!first_path_orbits.is_minimal_representative(search_stack[gca_level_with_first].split_element))
+ {
+ backjumping_level = gca_level_with_first;
+ }
+ else
+ {
+ assert(!best_path_orbits.is_minimal_representative(search_stack[gca_level_with_best].split_element));
+ backjumping_level = gca_level_with_best;
+ }
+ /* Backtrack */
+ search_stack.resize(backjumping_level + 1);
+ continue;
+ }
+
+
+ _INTERNAL_ERROR();
+
+
+ handle_first_path_automorphism:
+ /*
+ *
+ * A first-path automorphism: aut[i] = elements[first_path_labeling[i]]
+ *
+ */
+
+
+ if(p.is_discrete())
+ {
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ /* Verify that the complete automorphism is correctly built */
+ for(unsigned int i = 0; i < N; i++)
+ assert(first_path_automorphism[i] ==
+ p.elements[first_path_labeling[i]]);
+#endif
+ }
+ else
+ {
+ /* An automorphism that was found before the partition was discrete.
+ * Set the image of all elements in non-disrete cells accordingly */
+ for(Partition::Cell* c = p.first_nonsingleton_cell; c;
+ c = c->next_nonsingleton) {
+ for(unsigned int i = c->first; i < c->first+c->length; i++)
+ if(p.get_cell(p.elements[first_path_labeling[p.elements[i]]])->is_unit())
+ first_path_automorphism[p.elements[first_path_labeling[p.elements[i]]]] = p.elements[i];
+ else
+ first_path_automorphism[p.elements[i]] = p.elements[i];
+ }
+ }
+
+#if defined(BLISS_VERIFY_AUTOMORPHISMS)
+ /* Verify that it really is an automorphism */
+ if(!is_automorphism(first_path_automorphism))
+ fatal_error("First path automorphism validation check failed");
+#endif
+
+ if(opt_use_long_prune)
+ {
+ long_prune_add_automorphism(first_path_automorphism);
+ }
+
+ /*
+ * Update orbit information
+ */
+ update_orbit_information(first_path_orbits, first_path_automorphism);
+
+ /*
+ * Compute backjumping level
+ */
+ for(unsigned int i = 0; i < search_stack.size(); i++) {
+ TreeNode& n = search_stack[i];
+ if(n.fp_on) {
+ ;
+ } else {
+ n.fp_extendable = TreeNode::YES;
+ }
+ }
+
+ /* Report automorphism by calling the user defined hook function */
+ if(report_hook)
+ (*report_hook)(report_user_param,
+ get_nof_vertices(),
+ first_path_automorphism);
+
+ /* Update statistics */
+ stats.nof_generators++;
+ continue;
+
+ } /* while(!search_stack.empty()) */
+
+
+
+
+ /* Free "long prune" technique memory */
+ if(opt_use_long_prune)
+ long_prune_deallocate();
+
+ /* Release component recursion data in partition */
+ if(opt_use_comprec)
+ p.cr_free();
+}
+
+
+
+
+void
+AbstractGraph::find_automorphisms(Stats& stats,
+ void (*hook)(void *user_param,
+ unsigned int n,
+ const unsigned int *aut),
+ void *user_param)
+{
+ report_hook = hook;
+ report_user_param = user_param;
+
+ search(false, stats);
+
+ if(first_path_labeling)
+ {
+ free(first_path_labeling);
+ first_path_labeling = 0;
+ }
+ if(best_path_labeling)
+ {
+ free(best_path_labeling);
+ best_path_labeling = 0;
+ }
+}
+
+
+const unsigned int *
+AbstractGraph::canonical_form(Stats& stats,
+ void (*hook)(void *user_param,
+ unsigned int n,
+ const unsigned int *aut),
+ void *user_param)
+{
+
+ report_hook = hook;
+ report_user_param = user_param;
+
+ search(true, stats);
+
+ return best_path_labeling;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Routines for directed graphs
+ *
+ *-------------------------------------------------------------------------*/
+
+Digraph::Vertex::Vertex()
+{
+ color = 0;
+}
+
+
+Digraph::Vertex::~Vertex()
+{
+ ;
+}
+
+
+void
+Digraph::Vertex::add_edge_to(const unsigned int other_vertex)
+{
+ edges_out.push_back(other_vertex);
+}
+
+
+void
+Digraph::Vertex::add_edge_from(const unsigned int other_vertex)
+{
+ edges_in.push_back(other_vertex);
+}
+
+
+void
+Digraph::Vertex::remove_duplicate_edges(std::vector<bool>& tmp)
+{
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ /* Pre-conditions */
+ for(unsigned int i = 0; i < tmp.size(); i++) assert(tmp[i] == false);
+#endif
+ for(std::vector<unsigned int>::iterator iter = edges_out.begin();
+ iter != edges_out.end(); )
+ {
+ const unsigned int dest_vertex = *iter;
+ if(tmp[dest_vertex] == true)
+ {
+ /* A duplicate edge found! */
+ iter = edges_out.erase(iter);
+ }
+ else
+ {
+ /* Not seen earlier, mark as seen */
+ tmp[dest_vertex] = true;
+ iter++;
+ }
+ }
+
+ /* Clear tmp */
+ for(std::vector<unsigned int>::iterator iter = edges_out.begin();
+ iter != edges_out.end();
+ iter++)
+ {
+ tmp[*iter] = false;
+ }
+
+ for(std::vector<unsigned int>::iterator iter = edges_in.begin();
+ iter != edges_in.end(); )
+ {
+ const unsigned int dest_vertex = *iter;
+ if(tmp[dest_vertex] == true)
+ {
+ /* A duplicate edge found! */
+ iter = edges_in.erase(iter);
+ }
+ else
+ {
+ /* Not seen earlier, mark as seen */
+ tmp[dest_vertex] = true;
+ iter++;
+ }
+ }
+
+ /* Clear tmp */
+ for(std::vector<unsigned int>::iterator iter = edges_in.begin();
+ iter != edges_in.end();
+ iter++)
+ {
+ tmp[*iter] = false;
+ }
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ /* Post-conditions */
+ for(unsigned int i = 0; i < tmp.size(); i++) assert(tmp[i] == false);
+#endif
+}
+
+
+/**
+ * Sort the edges entering and leaving the vertex according to
+ * the vertex number of the other edge end.
+ * Time complexity: O(e log(e)), where e is the number of edges
+ * entering/leaving the vertex.
+ */
+void
+Digraph::Vertex::sort_edges()
+{
+ std::sort(edges_in.begin(), edges_in.end());
+ std::sort(edges_out.begin(), edges_out.end());
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Constructor and destructor for directed graphs
+ *
+ *-------------------------------------------------------------------------*/
+
+
+Digraph::Digraph(const unsigned int nof_vertices)
+{
+ vertices.resize(nof_vertices);
+ sh = shs_flm;
+}
+
+
+Digraph::~Digraph()
+{
+ ;
+}
+
+
+unsigned int
+Digraph::add_vertex(const unsigned int color)
+{
+ const unsigned int new_vertex_num = vertices.size();
+ vertices.resize(new_vertex_num + 1);
+ vertices.back().color = color;
+ return new_vertex_num;
+}
+
+
+void
+Digraph::add_edge(const unsigned int vertex1, const unsigned int vertex2)
+{
+ assert(vertex1 < get_nof_vertices());
+ assert(vertex2 < get_nof_vertices());
+ vertices[vertex1].add_edge_to(vertex2);
+ vertices[vertex2].add_edge_from(vertex1);
+}
+
+
+void
+Digraph::change_color(const unsigned int vertex, const unsigned int new_color)
+{
+ assert(vertex < get_nof_vertices());
+ vertices[vertex].color = new_color;
+}
+
+
+void
+Digraph::sort_edges()
+{
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ vertices[i].sort_edges();
+}
+
+
+int
+Digraph::cmp(Digraph& other)
+{
+ /* Compare the numbers of vertices */
+ if(get_nof_vertices() < other.get_nof_vertices())
+ return -1;
+ if(get_nof_vertices() > other.get_nof_vertices())
+ return 1;
+ /* Compare vertex colors */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ if(vertices[i].color < other.vertices[i].color)
+ return -1;
+ if(vertices[i].color > other.vertices[i].color)
+ return 1;
+ }
+ /* Compare vertex degrees */
+ remove_duplicate_edges();
+ other.remove_duplicate_edges();
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ if(vertices[i].nof_edges_in() < other.vertices[i].nof_edges_in())
+ return -1;
+ if(vertices[i].nof_edges_in() > other.vertices[i].nof_edges_in())
+ return 1;
+ if(vertices[i].nof_edges_out() < other.vertices[i].nof_edges_out())
+ return -1;
+ if(vertices[i].nof_edges_out() > other.vertices[i].nof_edges_out())
+ return 1;
+ }
+ /* Compare edges */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex& v1 = vertices[i];
+ Vertex& v2 = other.vertices[i];
+ v1.sort_edges();
+ v2.sort_edges();
+ std::vector<unsigned int>::const_iterator ei1 = v1.edges_in.begin();
+ std::vector<unsigned int>::const_iterator ei2 = v2.edges_in.begin();
+ while(ei1 != v1.edges_in.end())
+ {
+ if(*ei1 < *ei2)
+ return -1;
+ if(*ei1 > *ei2)
+ return 1;
+ ei1++;
+ ei2++;
+ }
+ ei1 = v1.edges_out.begin();
+ ei2 = v2.edges_out.begin();
+ while(ei1 != v1.edges_out.end())
+ {
+ if(*ei1 < *ei2)
+ return -1;
+ if(*ei1 > *ei2)
+ return 1;
+ ei1++;
+ ei2++;
+ }
+ }
+ return 0;
+}
+
+
+
+
+Digraph*
+Digraph::permute(const std::vector<unsigned int>& perm) const
+{
+ Digraph* const g = new Digraph(get_nof_vertices());
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ const Vertex& v = vertices[i];
+ g->change_color(perm[i], v.color);
+ for(std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ ei != v.edges_out.end();
+ ei++)
+ {
+ g->add_edge(perm[i], perm[*ei]);
+ }
+ }
+ g->sort_edges();
+ return g;
+}
+
+
+Digraph*
+Digraph::permute(const unsigned int* const perm) const
+{
+ Digraph* const g = new Digraph(get_nof_vertices());
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ const Vertex &v = vertices[i];
+ g->change_color(perm[i], v.color);
+ for(std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ ei != v.edges_out.end();
+ ei++)
+ {
+ g->add_edge(perm[i], perm[*ei]);
+ }
+ }
+ g->sort_edges();
+ return g;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Print graph in graphviz format
+ *
+ *-------------------------------------------------------------------------*/
+
+
+void
+Digraph::write_dot(const char* const filename)
+{
+ FILE* const fp = fopen(filename, "w");
+ if(fp)
+ {
+ write_dot(fp);
+ fclose(fp);
+ }
+}
+
+
+void
+Digraph::write_dot(FILE* const fp)
+{
+ remove_duplicate_edges();
+
+ fprintf(fp, "digraph g {\n");
+
+ unsigned int vnum = 0;
+ for(std::vector<Vertex>::const_iterator vi = vertices.begin();
+ vi != vertices.end();
+ vi++, vnum++)
+ {
+ const Vertex& v = *vi;
+ fprintf(fp, "v%u [label=\"%u:%u\"];\n", vnum, vnum, v.color);
+ for(std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ ei != v.edges_out.end();
+ ei++)
+ {
+ fprintf(fp, "v%u -> v%u\n", vnum, *ei);
+ }
+ }
+
+ fprintf(fp, "}\n");
+}
+
+
+void
+Digraph::remove_duplicate_edges()
+{
+ std::vector<bool> tmp(get_nof_vertices(), false);
+
+ for(std::vector<Vertex>::iterator vi = vertices.begin();
+ vi != vertices.end();
+ vi++)
+ {
+#if defined(BLISS_EXPENSIVE_CONSISTENCY_CHECKS)
+ for(unsigned int i = 0; i < tmp.size(); i++) assert(tmp[i] == false);
+#endif
+ (*vi).remove_duplicate_edges(tmp);
+ }
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Get a hash value for the graph.
+ *
+ *-------------------------------------------------------------------------*/
+
+unsigned int
+Digraph::get_hash()
+{
+ remove_duplicate_edges();
+ sort_edges();
+
+ UintSeqHash h;
+
+ h.update(get_nof_vertices());
+
+ /* Hash the color of each vertex */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ h.update(vertices[i].color);
+ }
+
+ /* Hash the edges */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex &v = vertices[i];
+ for(std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ ei != v.edges_out.end();
+ ei++)
+ {
+ h.update(i);
+ h.update(*ei);
+ }
+ }
+
+ return h.get_value();
+}
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Read directed graph in the DIMACS format.
+ * Returns 0 if an error occurred.
+ *
+ *-------------------------------------------------------------------------*/
+
+Digraph*
+Digraph::read_dimacs(FILE* const fp, FILE* const errstr)
+{
+ Digraph* g = 0;
+ unsigned int nof_vertices;
+ unsigned int nof_edges;
+ unsigned int line_num = 1;
+
+ const bool verbose = false;
+ FILE* const verbstr = stdout;
+
+ /* Read comments and the problem definition line */
+ while(1)
+ {
+ int c = getc(fp);
+ if(c == 'c')
+ {
+ /* A comment, ignore the rest of the line */
+ while((c = getc(fp)) != '\n')
+ {
+ if(c == EOF) {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ }
+ line_num++;
+ continue;
+ }
+ if(c == 'p')
+ {
+ /* The problem definition line */
+ if(fscanf(fp, " edge %u %u\n", &nof_vertices, &nof_edges) != 2)
+ {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ line_num++;
+ break;
+ }
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n", line_num);
+ goto error_exit;
+ }
+
+ if(nof_vertices <= 0)
+ {
+ if(errstr)
+ fprintf(errstr, "error: no vertices\n");
+ goto error_exit;
+ }
+ if(verbose)
+ {
+ fprintf(verbstr, "Instance has %d vertices and %d edges\n",
+ nof_vertices, nof_edges);
+ fflush(verbstr);
+ }
+
+ g = new Digraph(nof_vertices);
+
+ //
+ // Read vertex colors
+ //
+ if(verbose)
+ {
+ fprintf(verbstr, "Reading vertex colors...\n");
+ fflush(verbstr);
+ }
+ while(1)
+ {
+ int c = getc(fp);
+ if(c != 'n')
+ {
+ ungetc(c, fp);
+ break;
+ }
+ ungetc(c, fp);
+ unsigned int vertex;
+ unsigned int color;
+ if(fscanf(fp, "n %u %u\n", &vertex, &color) != 2)
+ {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ if(!((vertex >= 1) && (vertex <= nof_vertices)))
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: vertex %u not in range [1,...%u]\n",
+ line_num, vertex, nof_vertices);
+ goto error_exit;
+ }
+ line_num++;
+ g->change_color(vertex - 1, color);
+ }
+ if(verbose)
+ {
+ fprintf(verbstr, "Done\n");
+ fflush(verbstr);
+ }
+
+ //
+ // Read edges
+ //
+ if(verbose)
+ {
+ fprintf(verbstr, "Reading edges...\n");
+ fflush(verbstr);
+ }
+ for(unsigned i = 0; i < nof_edges; i++)
+ {
+ unsigned int from, to;
+ if(fscanf(fp, "e %u %u\n", &from, &to) != 2)
+ {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ if(not((1 <= from) and (from <= nof_vertices)))
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: vertex %u not in range [1,...%u]\n",
+ line_num, from, nof_vertices);
+ goto error_exit;
+ }
+ if(not((1 <= to) and (to <= nof_vertices)))
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: vertex %u not in range [1,...%u]\n",
+ line_num, to, nof_vertices);
+ goto error_exit;
+ }
+ line_num++;
+ g->add_edge(from-1, to-1);
+ }
+ if(verbose)
+ {
+ fprintf(verbstr, "Done\n");
+ fflush(verbstr);
+ }
+
+ return g;
+
+ error_exit:
+ if(g)
+ delete g;
+ return 0;
+}
+
+
+
+
+
+void
+Digraph::write_dimacs(FILE* const fp)
+{
+ remove_duplicate_edges();
+ sort_edges();
+
+ /* First count the total number of edges */
+ unsigned int nof_edges = 0;
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ nof_edges += vertices[i].edges_out.size();
+ }
+
+ /* Output the "header" line */
+ fprintf(fp, "p edge %u %u\n", get_nof_vertices(), nof_edges);
+
+ /* Print the color of each vertex */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex& v = vertices[i];
+ fprintf(fp, "n %u %u\n", i+1, v.color);
+ /*
+ if(v.color != 0)
+ {
+ fprintf(fp, "n %u %u\n", i+1, v.color);
+ }
+ */
+ }
+
+ /* Print the edges */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex& v = vertices[i];
+ for(std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ ei != v.edges_out.end();
+ ei++)
+ {
+ fprintf(fp, "e %u %u\n", i+1, (*ei)+1);
+ }
+ }
+}
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Partition independent invariants
+ *
+ *-------------------------------------------------------------------------*/
+
+unsigned int
+Digraph::vertex_color_invariant(const Digraph* const g, const unsigned int vnum)
+{
+ return g->vertices[vnum].color;
+}
+
+unsigned int
+Digraph::indegree_invariant(const Digraph* const g, const unsigned int vnum)
+{
+ return g->vertices[vnum].nof_edges_in();
+}
+
+unsigned int
+Digraph::outdegree_invariant(const Digraph* const g, const unsigned int vnum)
+{
+ return g->vertices[vnum].nof_edges_out();
+}
+
+unsigned int
+Digraph::selfloop_invariant(const Digraph* const g, const unsigned int vnum)
+{
+ /* Quite inefficient but luckily not in the critical path */
+ const Vertex& v = g->vertices[vnum];
+ for(std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ ei != v.edges_out.end();
+ ei++)
+ {
+ if(*ei == vnum)
+ return 1;
+ }
+ return 0;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Refine the partition p according to a partition independent invariant
+ *
+ *-------------------------------------------------------------------------*/
+
+bool
+Digraph::refine_according_to_invariant(unsigned int (*inv)(const Digraph* const g,
+ const unsigned int v))
+{
+ bool refined = false;
+
+ for(Partition::Cell* cell = p.first_nonsingleton_cell; cell; )
+ {
+
+ Partition::Cell* const next_cell = cell->next_nonsingleton;
+ const unsigned int* ep = p.elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--, ep++)
+ {
+ unsigned int ival = inv(this, *ep);
+ p.invariant_values[*ep] = ival;
+ if(ival > cell->max_ival) {
+ cell->max_ival = ival;
+ cell->max_ival_count = 1;
+ }
+ else if(ival == cell->max_ival) {
+ cell->max_ival_count++;
+ }
+ }
+ Partition::Cell* const last_new_cell = p.zplit_cell(cell, true);
+ refined |= (last_new_cell != cell);
+ cell = next_cell;
+ }
+
+ return refined;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Split the neighbourhood of a cell according to the equitable invariant
+ *
+ *-------------------------------------------------------------------------*/
+
+bool
+Digraph::split_neighbourhood_of_cell(Partition::Cell* const cell)
+{
+
+
+ const bool was_equal_to_first = refine_equal_to_first;
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(cell->first);
+ eqref_hash.update(cell->length);
+ }
+
+ const unsigned int* ep = p.elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--)
+ {
+ const Vertex& v = vertices[*ep++];
+
+ std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j != 0; j--)
+ {
+ const unsigned int dest_vertex = *ei++;
+ Partition::Cell* const neighbour_cell = p.get_cell(dest_vertex);
+ if(neighbour_cell->is_unit())
+ continue;
+ const unsigned int ival = ++p.invariant_values[dest_vertex];
+ if(ival > neighbour_cell->max_ival) {
+ neighbour_cell->max_ival = ival;
+ neighbour_cell->max_ival_count = 1;
+ if(ival == 1)
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ else if(ival == neighbour_cell->max_ival) {
+ neighbour_cell->max_ival_count++;
+ }
+ }
+ }
+
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell = p.get_cell(p.elements[start]);
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(neighbour_cell->max_ival);
+ eqref_hash.update(neighbour_cell->max_ival_count);
+ }
+
+
+ Partition::Cell* const last_new_cell = p.zplit_cell(neighbour_cell, true);
+
+ /* Update certificate and hash if needed */
+ const Partition::Cell* c = neighbour_cell;
+ while(1)
+ {
+ if(in_search)
+ {
+ /* Build certificate */
+ cert_add_redundant(CERT_SPLIT, c->first, c->length);
+ /* No need to continue? */
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ goto worse_exit;
+ }
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(c->first);
+ eqref_hash.update(c->length);
+ }
+ if(c == last_new_cell)
+ break;
+ c = c->next;
+ }
+ }
+
+ if(cell->is_in_splitting_queue())
+ {
+ return false;
+ }
+
+
+ ep = p.elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--)
+ {
+ const Vertex& v = vertices[*ep++];
+
+ std::vector<unsigned int>::const_iterator ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ const unsigned int dest_vertex = *ei++;
+ Partition::Cell* const neighbour_cell = p.get_cell(dest_vertex);
+ if(neighbour_cell->is_unit())
+ continue;
+ const unsigned int ival = ++p.invariant_values[dest_vertex];
+ if(ival > neighbour_cell->max_ival)
+ {
+ neighbour_cell->max_ival = ival;
+ neighbour_cell->max_ival_count = 1;
+ if(ival == 1)
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ else if(ival == neighbour_cell->max_ival) {
+ neighbour_cell->max_ival_count++;
+ }
+ }
+ }
+
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell = p.get_cell(p.elements[start]);
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(neighbour_cell->max_ival);
+ eqref_hash.update(neighbour_cell->max_ival_count);
+ }
+
+ Partition::Cell* const last_new_cell = p.zplit_cell(neighbour_cell, true);
+
+ /* Update certificate and hash if needed */
+ const Partition::Cell* c = neighbour_cell;
+ while(1)
+ {
+ if(in_search)
+ {
+ /* Build certificate */
+ cert_add_redundant(CERT_SPLIT, c->first, c->length);
+ /* No need to continue? */
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ goto worse_exit;
+ }
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(c->first);
+ eqref_hash.update(c->length);
+ }
+ if(c == last_new_cell)
+ break;
+ c = c->next;
+ }
+ }
+
+
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ return true;
+
+ return false;
+
+ worse_exit:
+ /* Clear neighbour heap */
+ UintSeqHash rest;
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell = p.get_cell(p.elements[start]);
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ rest.update(neighbour_cell->first);
+ rest.update(neighbour_cell->length);
+ rest.update(neighbour_cell->max_ival);
+ rest.update(neighbour_cell->max_ival_count);
+ }
+ neighbour_cell->max_ival = 0;
+ neighbour_cell->max_ival_count = 0;
+ p.clear_ivs(neighbour_cell);
+ }
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ for(unsigned int i = p.splitting_queue.size(); i > 0; i--)
+ {
+ Partition::Cell* const cell = p.splitting_queue.pop_front();
+ rest.update(cell->first);
+ rest.update(cell->length);
+ p.splitting_queue.push_back(cell);
+ }
+ rest.update(failure_recording_fp_deviation);
+ failure_recording_fp_deviation = rest.get_value();
+ }
+
+ return true;
+}
+
+
+bool
+Digraph::split_neighbourhood_of_unit_cell(Partition::Cell* const unit_cell)
+{
+
+
+ const bool was_equal_to_first = refine_equal_to_first;
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(0x87654321);
+ eqref_hash.update(unit_cell->first);
+ eqref_hash.update(1);
+ }
+
+ const Vertex& v = vertices[p.elements[unit_cell->first]];
+
+ /*
+ * Phase 1
+ * Refine neighbours according to the edges that leave the vertex v
+ */
+ std::vector<unsigned int>::const_iterator ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j > 0; j--)
+ {
+ const unsigned int dest_vertex = *ei++;
+ Partition::Cell* const neighbour_cell = p.get_cell(dest_vertex);
+
+ if(neighbour_cell->is_unit()) {
+ if(in_search) {
+ /* Remember neighbour in order to generate certificate */
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ continue;
+ }
+ if(neighbour_cell->max_ival_count == 0)
+ {
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ neighbour_cell->max_ival_count++;
+
+ unsigned int* const swap_position =
+ p.elements + neighbour_cell->first + neighbour_cell->length -
+ neighbour_cell->max_ival_count;
+ *p.in_pos[dest_vertex] = *swap_position;
+ p.in_pos[*swap_position] = p.in_pos[dest_vertex];
+ *swap_position = dest_vertex;
+ p.in_pos[dest_vertex] = swap_position;
+ }
+
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* neighbour_cell = p.get_cell(p.elements[start]);
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ assert(neighbour_cell->first == start);
+ if(neighbour_cell->is_unit()) {
+ assert(neighbour_cell->max_ival_count == 0);
+ } else {
+ assert(neighbour_cell->max_ival_count > 0);
+ assert(neighbour_cell->max_ival_count <= neighbour_cell->length);
+ }
+#endif
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(neighbour_cell->max_ival_count);
+ }
+
+ if(neighbour_cell->length > 1 and
+ neighbour_cell->max_ival_count != neighbour_cell->length)
+ {
+
+ Partition::Cell* const new_cell =
+ p.aux_split_in_two(neighbour_cell,
+ neighbour_cell->length -
+ neighbour_cell->max_ival_count);
+ unsigned int* ep = p.elements + new_cell->first;
+ unsigned int* const lp = p.elements+new_cell->first+new_cell->length;
+ while(ep < lp)
+ {
+ p.element_to_cell_map[*ep] = new_cell;
+ ep++;
+ }
+ neighbour_cell->max_ival_count = 0;
+
+
+ if(compute_eqref_hash)
+ {
+ /* Update hash */
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(0);
+ eqref_hash.update(new_cell->first);
+ eqref_hash.update(new_cell->length);
+ eqref_hash.update(1);
+ }
+
+ /* Add cells in splitting_queue */
+ if(neighbour_cell->is_in_splitting_queue()) {
+ /* Both cells must be included in splitting_queue in order
+ to have refinement to equitable partition */
+ p.splitting_queue_add(new_cell);
+ } else {
+ Partition::Cell *min_cell, *max_cell;
+ if(neighbour_cell->length <= new_cell->length) {
+ min_cell = neighbour_cell;
+ max_cell = new_cell;
+ } else {
+ min_cell = new_cell;
+ max_cell = neighbour_cell;
+ }
+ /* Put the smaller cell in splitting_queue */
+ p.splitting_queue_add(min_cell);
+ if(max_cell->is_unit()) {
+ /* Put the "larger" cell also in splitting_queue */
+ p.splitting_queue_add(max_cell);
+ }
+ }
+ /* Update pointer for certificate generation */
+ neighbour_cell = new_cell;
+ }
+ else
+ {
+ neighbour_cell->max_ival_count = 0;
+ }
+
+ /*
+ * Build certificate if required
+ */
+ if(in_search)
+ {
+ for(unsigned int i = neighbour_cell->first,
+ j = neighbour_cell->length;
+ j > 0;
+ j--, i++)
+ {
+ /* Build certificate */
+ cert_add(CERT_EDGE, unit_cell->first, i);
+ /* No need to continue? */
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ goto worse_exit;
+ }
+ } /* if(in_search) */
+ } /* while(!neighbour_heap.is_empty()) */
+
+ /*
+ * Phase 2
+ * Refine neighbours according to the edges that enter the vertex v
+ */
+ ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ const unsigned int dest_vertex = *ei++;
+ Partition::Cell* const neighbour_cell = p.get_cell(dest_vertex);
+
+ if(neighbour_cell->is_unit()) {
+ if(in_search) {
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ continue;
+ }
+ if(neighbour_cell->max_ival_count == 0)
+ {
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ neighbour_cell->max_ival_count++;
+
+ unsigned int* const swap_position =
+ p.elements + neighbour_cell->first + neighbour_cell->length -
+ neighbour_cell->max_ival_count;
+ *p.in_pos[dest_vertex] = *swap_position;
+ p.in_pos[*swap_position] = p.in_pos[dest_vertex];
+ *swap_position = dest_vertex;
+ p.in_pos[dest_vertex] = swap_position;
+ }
+
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* neighbour_cell = p.get_cell(p.elements[start]);
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ assert(neighbour_cell->first == start);
+ if(neighbour_cell->is_unit()) {
+ assert(neighbour_cell->max_ival_count == 0);
+ } else {
+ assert(neighbour_cell->max_ival_count > 0);
+ assert(neighbour_cell->max_ival_count <= neighbour_cell->length);
+ }
+#endif
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(neighbour_cell->max_ival_count);
+ }
+
+ if(neighbour_cell->length > 1 and
+ neighbour_cell->max_ival_count != neighbour_cell->length)
+ {
+ Partition::Cell* const new_cell =
+ p.aux_split_in_two(neighbour_cell,
+ neighbour_cell->length -
+ neighbour_cell->max_ival_count);
+ unsigned int* ep = p.elements + new_cell->first;
+ unsigned int* const lp = p.elements+new_cell->first+new_cell->length;
+ while(ep < lp) {
+ p.element_to_cell_map[*ep] = new_cell;
+ ep++;
+ }
+ neighbour_cell->max_ival_count = 0;
+
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(0);
+ eqref_hash.update(new_cell->first);
+ eqref_hash.update(new_cell->length);
+ eqref_hash.update(1);
+ }
+
+ /* Add cells in splitting_queue */
+ if(neighbour_cell->is_in_splitting_queue()) {
+ /* Both cells must be included in splitting_queue in order
+ to have refinement to equitable partition */
+ p.splitting_queue_add(new_cell);
+ } else {
+ Partition::Cell *min_cell, *max_cell;
+ if(neighbour_cell->length <= new_cell->length) {
+ min_cell = neighbour_cell;
+ max_cell = new_cell;
+ } else {
+ min_cell = new_cell;
+ max_cell = neighbour_cell;
+ }
+ /* Put the smaller cell in splitting_queue */
+ p.splitting_queue_add(min_cell);
+ if(max_cell->is_unit()) {
+ /* Put the "larger" cell also in splitting_queue */
+ p.splitting_queue_add(max_cell);
+ }
+ }
+ /* Update pointer for certificate generation */
+ neighbour_cell = new_cell;
+ }
+ else
+ {
+ neighbour_cell->max_ival_count = 0;
+ }
+
+ /*
+ * Build certificate if required
+ */
+ if(in_search)
+ {
+ for(unsigned int i = neighbour_cell->first,
+ j = neighbour_cell->length;
+ j > 0;
+ j--, i++)
+ {
+ /* Build certificate */
+ cert_add(CERT_EDGE, i, unit_cell->first);
+ /* No need to continue? */
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ goto worse_exit;
+ }
+ } /* if(in_search) */
+ } /* while(!neighbour_heap.is_empty()) */
+
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ return true;
+
+ return false;
+
+ worse_exit:
+ /* Clear neighbour heap */
+ UintSeqHash rest;
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell = p.get_cell(p.elements[start]);
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ rest.update(neighbour_cell->first);
+ rest.update(neighbour_cell->length);
+ rest.update(neighbour_cell->max_ival_count);
+ }
+ neighbour_cell->max_ival_count = 0;
+ }
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ rest.update(failure_recording_fp_deviation);
+ failure_recording_fp_deviation = rest.get_value();
+ }
+ return true;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Check whether the current partition p is equitable.
+ * Performance: very slow, use only for debugging purposes.
+ *
+ *-------------------------------------------------------------------------*/
+
+bool
+Digraph::is_equitable() const
+{
+ const unsigned int N = get_nof_vertices();
+ if(N == 0)
+ return true;
+
+ std::vector<unsigned int> first_count = std::vector<unsigned int>(N, 0);
+ std::vector<unsigned int> other_count = std::vector<unsigned int>(N, 0);
+
+ /*
+ * Check equitabledness w.r.t. outgoing edges
+ */
+ for(Partition::Cell* cell = p.first_cell; cell; cell = cell->next)
+ {
+ if(cell->is_unit())
+ continue;
+
+ unsigned int* ep = p.elements + cell->first;
+ const Vertex& first_vertex = vertices[*ep++];
+
+ /* Count outgoing edges of the first vertex for cells */
+ for(std::vector<unsigned int>::const_iterator ei =
+ first_vertex.edges_out.begin();
+ ei != first_vertex.edges_out.end();
+ ei++)
+ {
+ first_count[p.get_cell(*ei)->first]++;
+ }
+
+ /* Count and compare outgoing edges of the other vertices */
+ for(unsigned int i = cell->length; i > 1; i--)
+ {
+ const Vertex &vertex = vertices[*ep++];
+ for(std::vector<unsigned int>::const_iterator ei =
+ vertex.edges_out.begin();
+ ei != vertex.edges_out.end();
+ ei++)
+ {
+ other_count[p.get_cell(*ei)->first]++;
+ }
+ for(Partition::Cell *cell2 = p.first_cell;
+ cell2;
+ cell2 = cell2->next)
+ {
+ if(first_count[cell2->first] != other_count[cell2->first])
+ {
+ /* Not equitable */
+ return false;
+ }
+ other_count[cell2->first] = 0;
+ }
+ }
+ /* Reset first_count */
+ for(unsigned int i = 0; i < N; i++)
+ first_count[i] = 0;
+ }
+
+
+ /*
+ * Check equitabledness w.r.t. incoming edges
+ */
+ for(Partition::Cell* cell = p.first_cell; cell; cell = cell->next)
+ {
+ if(cell->is_unit())
+ continue;
+
+ unsigned int* ep = p.elements + cell->first;
+ const Vertex& first_vertex = vertices[*ep++];
+
+ /* Count incoming edges of the first vertex for cells */
+ for(std::vector<unsigned int>::const_iterator ei =
+ first_vertex.edges_in.begin();
+ ei != first_vertex.edges_in.end();
+ ei++)
+ {
+ first_count[p.get_cell(*ei)->first]++;
+ }
+
+ /* Count and compare incoming edges of the other vertices */
+ for(unsigned int i = cell->length; i > 1; i--)
+ {
+ const Vertex &vertex = vertices[*ep++];
+ for(std::vector<unsigned int>::const_iterator ei =
+ vertex.edges_in.begin();
+ ei != vertex.edges_in.end();
+ ei++)
+ {
+ other_count[p.get_cell(*ei)->first]++;
+ }
+ for(Partition::Cell *cell2 = p.first_cell;
+ cell2;
+ cell2 = cell2->next)
+ {
+ if(first_count[cell2->first] != other_count[cell2->first])
+ {
+ /* Not equitable */
+ return false;
+ }
+ other_count[cell2->first] = 0;
+ }
+ }
+ /* Reset first_count */
+ for(unsigned int i = 0; i < N; i++)
+ first_count[i] = 0;
+ }
+ return true;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Build the initial equitable partition
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+Digraph::make_initial_equitable_partition()
+{
+ refine_according_to_invariant(&vertex_color_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_according_to_invariant(&selfloop_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_according_to_invariant(&outdegree_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_according_to_invariant(&indegree_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_to_equitable();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Find the next cell to be splitted
+ *
+ *-------------------------------------------------------------------------*/
+
+Partition::Cell*
+Digraph::find_next_cell_to_be_splitted(Partition::Cell* cell)
+{
+ switch(sh) {
+ case shs_f: return sh_first();
+ case shs_fs: return sh_first_smallest();
+ case shs_fl: return sh_first_largest();
+ case shs_fm: return sh_first_max_neighbours();
+ case shs_fsm: return sh_first_smallest_max_neighbours();
+ case shs_flm: return sh_first_largest_max_neighbours();
+ default:
+ fatal_error("Internal error - unknown splitting heuristics");
+ return 0;
+ }
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first nonsingleton cell in the current partition.
+ * The argument \a cell is ignored.
+ */
+Partition::Cell*
+Digraph::sh_first()
+{
+ Partition::Cell* best_cell = 0;
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ best_cell = cell;
+ break;
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first smallest nonsingleton cell in the current partition.
+ * The argument \a cell is ignored.
+ */
+Partition::Cell*
+Digraph::sh_first_smallest()
+{
+ Partition::Cell* best_cell = 0;
+ unsigned int best_size = UINT_MAX;
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ if(cell->length < best_size)
+ {
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first largest nonsingleton cell in the current partition.
+ * The argument \a cell is ignored.
+ */
+Partition::Cell*
+Digraph::sh_first_largest()
+{
+ Partition::Cell* best_cell = 0;
+ unsigned int best_size = 0;
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ if(cell->length > best_size)
+ {
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first nonsingleton cell with max number of neighbouring
+ * nonsingleton cells.
+ * Assumes that the partition p is equitable.
+ * Assumes that the max_ival fields of the cells are all 0.
+ */
+Partition::Cell*
+Digraph::sh_first_max_neighbours()
+{
+ Partition::Cell* best_cell = 0;
+ int best_value = -1;
+ KStack<Partition::Cell*> neighbour_cells_visited;
+ neighbour_cells_visited.init(get_nof_vertices());
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ int value = 0;
+ const Vertex &v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei;
+ ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ Partition::Cell * const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+
+ ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j > 0; j--)
+ {
+ Partition::Cell * const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+
+ if(value > best_value)
+ {
+ best_value = value;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first smallest nonsingleton cell with max number of neighbouring
+ * nonsingleton cells.
+ * Assumes that the partition p is equitable.
+ * Assumes that the max_ival fields of the cells are all 0.
+ */
+Partition::Cell*
+Digraph::sh_first_smallest_max_neighbours()
+{
+ Partition::Cell* best_cell = 0;
+ int best_value = -1;
+ unsigned int best_size = UINT_MAX;
+ KStack<Partition::Cell*> neighbour_cells_visited;
+ neighbour_cells_visited.init(get_nof_vertices());
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+
+ int value = 0;
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei;
+
+ ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ Partition::Cell * const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell * const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+
+ ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j > 0; j--)
+ {
+ Partition::Cell * const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell * const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+
+ if((value > best_value) or
+ (value == best_value and cell->length < best_size))
+ {
+ best_value = value;
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first largest nonsingleton cell with max number of neighbouring
+ * nonsingleton cells.
+ * Assumes that the partition p is equitable.
+ * Assumes that the max_ival fields of the cells are all 0.
+ */
+Partition::Cell*
+Digraph::sh_first_largest_max_neighbours()
+{
+ Partition::Cell* best_cell = 0;
+ int best_value = -1;
+ unsigned int best_size = 0;
+ KStack<Partition::Cell*> neighbour_cells_visited;
+ neighbour_cells_visited.init(get_nof_vertices());
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+
+ int value = 0;
+ const Vertex &v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei;
+
+ ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ Partition::Cell* const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+
+ ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j > 0; j--)
+ {
+ Partition::Cell* const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+
+ if((value > best_value) ||
+ (value == best_value && cell->length > best_size))
+ {
+ best_value = value;
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+
+
+
+
+
+/*------------------------------------------------------------------------
+ *
+ * Initialize the certificate size and memory
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+Digraph::initialize_certificate()
+{
+ certificate_index = 0;
+ certificate_current_path.clear();
+ certificate_first_path.clear();
+ certificate_best_path.clear();
+}
+
+
+
+/*
+ * Check whether perm is an automorphism.
+ * Slow, mainly for debugging and validation purposes.
+ */
+bool
+Digraph::is_automorphism(unsigned int* const perm)
+{
+ std::set<unsigned int, std::less<unsigned int> > edges1;
+ std::set<unsigned int, std::less<unsigned int> > edges2;
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ if(!is_permutation(get_nof_vertices(), perm))
+ _INTERNAL_ERROR();
+#endif
+
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex& v1 = vertices[i];
+ Vertex& v2 = vertices[perm[i]];
+
+ edges1.clear();
+ for(std::vector<unsigned int>::iterator ei = v1.edges_in.begin();
+ ei != v1.edges_in.end();
+ ei++)
+ edges1.insert(perm[*ei]);
+ edges2.clear();
+ for(std::vector<unsigned int>::iterator ei = v2.edges_in.begin();
+ ei != v2.edges_in.end();
+ ei++)
+ edges2.insert(*ei);
+ if(!(edges1 == edges2))
+ return false;
+
+ edges1.clear();
+ for(std::vector<unsigned int>::iterator ei = v1.edges_out.begin();
+ ei != v1.edges_out.end();
+ ei++)
+ edges1.insert(perm[*ei]);
+ edges2.clear();
+ for(std::vector<unsigned int>::iterator ei = v2.edges_out.begin();
+ ei != v2.edges_out.end();
+ ei++)
+ edges2.insert(*ei);
+ if(!(edges1 == edges2))
+ return false;
+ }
+
+ return true;
+}
+
+bool
+Digraph::is_automorphism(const std::vector<unsigned int>& perm) const
+{
+
+ if(!(perm.size() == get_nof_vertices() and is_permutation(perm)))
+ return false;
+
+ std::set<unsigned int, std::less<unsigned int> > edges1;
+ std::set<unsigned int, std::less<unsigned int> > edges2;
+
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ const Vertex& v1 = vertices[i];
+ const Vertex& v2 = vertices[perm[i]];
+
+ edges1.clear();
+ for(std::vector<unsigned int>::const_iterator ei = v1.edges_in.begin();
+ ei != v1.edges_in.end();
+ ei++)
+ edges1.insert(perm[*ei]);
+ edges2.clear();
+ for(std::vector<unsigned int>::const_iterator ei = v2.edges_in.begin();
+ ei != v2.edges_in.end();
+ ei++)
+ edges2.insert(*ei);
+ if(!(edges1 == edges2))
+ return false;
+
+ edges1.clear();
+ for(std::vector<unsigned int>::const_iterator ei = v1.edges_out.begin();
+ ei != v1.edges_out.end();
+ ei++)
+ edges1.insert(perm[*ei]);
+ edges2.clear();
+ for(std::vector<unsigned int>::const_iterator ei = v2.edges_out.begin();
+ ei != v2.edges_out.end();
+ ei++)
+ edges2.insert(*ei);
+ if(!(edges1 == edges2))
+ return false;
+ }
+
+ return true;
+}
+
+
+
+
+bool
+Digraph::nucr_find_first_component(const unsigned int level)
+{
+
+ cr_component.clear();
+ cr_component_elements = 0;
+
+ /* Find first non-discrete cell in the component level */
+ Partition::Cell* first_cell = p.first_nonsingleton_cell;
+ while(first_cell)
+ {
+ if(p.cr_get_level(first_cell->first) == level)
+ break;
+ first_cell = first_cell->next_nonsingleton;
+ }
+
+ /* The component is discrete, return false */
+ if(!first_cell)
+ return false;
+
+ std::vector<Partition::Cell*> component;
+ first_cell->max_ival = 1;
+ component.push_back(first_cell);
+
+ for(unsigned int i = 0; i < component.size(); i++)
+ {
+ Partition::Cell* const cell = component[i];
+
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei;
+
+ ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j > 0; j--)
+ {
+ const unsigned int neighbour = *ei++;
+ Partition::Cell* const neighbour_cell = p.get_cell(neighbour);
+
+ /* Skip unit neighbours */
+ if(neighbour_cell->is_unit())
+ continue;
+ /* Already marked to be in the same component? */
+ if(neighbour_cell->max_ival == 1)
+ continue;
+ /* Is the neighbour at the same component recursion level? */
+ if(p.cr_get_level(neighbour_cell->first) != level)
+ continue;
+
+ if(neighbour_cell->max_ival_count == 0)
+ neighbour_heap.insert(neighbour_cell->first);
+ neighbour_cell->max_ival_count++;
+ }
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell =
+ p.get_cell(p.elements[start]);
+
+ /* Skip saturated neighbour cells */
+ if(neighbour_cell->max_ival_count == neighbour_cell->length)
+ {
+ neighbour_cell->max_ival_count = 0;
+ continue;
+ }
+ neighbour_cell->max_ival_count = 0;
+ neighbour_cell->max_ival = 1;
+ component.push_back(neighbour_cell);
+ }
+
+ ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ const unsigned int neighbour = *ei++;
+
+ Partition::Cell* const neighbour_cell = p.get_cell(neighbour);
+
+ /* Skip unit neighbours */
+ if(neighbour_cell->is_unit())
+ continue;
+ /* Already marked to be in the same component? */
+ if(neighbour_cell->max_ival == 1)
+ continue;
+ /* Is the neighbour at the same component recursion level? */
+ if(p.cr_get_level(neighbour_cell->first) != level)
+ continue;
+
+ if(neighbour_cell->max_ival_count == 0)
+ neighbour_heap.insert(neighbour_cell->first);
+ neighbour_cell->max_ival_count++;
+ }
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell =
+ p.get_cell(p.elements[start]);
+
+ /* Skip saturated neighbour cells */
+ if(neighbour_cell->max_ival_count == neighbour_cell->length)
+ {
+ neighbour_cell->max_ival_count = 0;
+ continue;
+ }
+ neighbour_cell->max_ival_count = 0;
+ neighbour_cell->max_ival = 1;
+ component.push_back(neighbour_cell);
+ }
+ }
+
+ for(unsigned int i = 0; i < component.size(); i++)
+ {
+ Partition::Cell* const cell = component[i];
+ cell->max_ival = 0;
+ cr_component.push_back(cell->first);
+ cr_component_elements += cell->length;
+ }
+
+ if(verbstr and verbose_level > 2) {
+ fprintf(verbstr, "NU-component with %lu cells and %u vertices\n",
+ (long unsigned)cr_component.size(), cr_component_elements);
+ fflush(verbstr);
+ }
+
+ return true;
+}
+
+
+
+
+
+bool
+Digraph::nucr_find_first_component(const unsigned int level,
+ std::vector<unsigned int>& component,
+ unsigned int& component_elements,
+ Partition::Cell*& sh_return)
+{
+
+ component.clear();
+ component_elements = 0;
+ sh_return = 0;
+ unsigned int sh_first = 0;
+ unsigned int sh_size = 0;
+ unsigned int sh_nuconn = 0;
+
+ /* Find first non-discrete cell in the component level */
+ Partition::Cell* first_cell = p.first_nonsingleton_cell;
+ while(first_cell)
+ {
+ if(p.cr_get_level(first_cell->first) == level)
+ break;
+ first_cell = first_cell->next_nonsingleton;
+ }
+
+ if(!first_cell)
+ {
+ /* The component is discrete, return false */
+ return false;
+ }
+
+ std::vector<Partition::Cell*> comp;
+ KStack<Partition::Cell*> neighbours;
+ neighbours.init(get_nof_vertices());
+
+ first_cell->max_ival = 1;
+ comp.push_back(first_cell);
+
+ for(unsigned int i = 0; i < comp.size(); i++)
+ {
+ Partition::Cell* const cell = comp[i];
+
+ unsigned int nuconn = 1;
+
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei;
+
+ /*| Phase 1: outgoing edges */
+ ei = v.edges_out.begin();
+ for(unsigned int j = v.nof_edges_out(); j > 0; j--)
+ {
+ const unsigned int neighbour = *ei++;
+
+ Partition::Cell* const neighbour_cell = p.get_cell(neighbour);
+
+ /* Skip unit neighbours */
+ if(neighbour_cell->is_unit())
+ continue;
+ /* Is the neighbour at the same component recursion level? */
+ //if(p.cr_get_level(neighbour_cell->first) != level)
+ // continue;
+ if(neighbour_cell->max_ival_count == 0)
+ neighbours.push(neighbour_cell);
+ neighbour_cell->max_ival_count++;
+ }
+ while(!neighbours.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbours.pop();
+ /* Skip saturated neighbour cells */
+ if(neighbour_cell->max_ival_count == neighbour_cell->length)
+ {
+ neighbour_cell->max_ival_count = 0;
+ continue;
+ }
+ nuconn++;
+ neighbour_cell->max_ival_count = 0;
+ if(neighbour_cell->max_ival == 0) {
+ comp.push_back(neighbour_cell);
+ neighbour_cell->max_ival = 1;
+ }
+ }
+
+ /*| Phase 2: incoming edges */
+ ei = v.edges_in.begin();
+ for(unsigned int j = v.nof_edges_in(); j > 0; j--)
+ {
+ const unsigned int neighbour = *ei++;
+ Partition::Cell* const neighbour_cell = p.get_cell(neighbour);
+ /*| Skip unit neighbours */
+ if(neighbour_cell->is_unit())
+ continue;
+ /* Is the neighbour at the same component recursion level? */
+ //if(p.cr_get_level(neighbour_cell->first) != level)
+ // continue;
+ if(neighbour_cell->max_ival_count == 0)
+ neighbours.push(neighbour_cell);
+ neighbour_cell->max_ival_count++;
+ }
+ while(!neighbours.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbours.pop();
+ /* Skip saturated neighbour cells */
+ if(neighbour_cell->max_ival_count == neighbour_cell->length)
+ {
+ neighbour_cell->max_ival_count = 0;
+ continue;
+ }
+ nuconn++;
+ neighbour_cell->max_ival_count = 0;
+ if(neighbour_cell->max_ival == 0) {
+ comp.push_back(neighbour_cell);
+ neighbour_cell->max_ival = 1;
+ }
+ }
+
+ /*| Phase 3: splitting heuristics */
+ switch(sh) {
+ case shs_f:
+ if(sh_return == 0 or
+ cell->first <= sh_first) {
+ sh_return = cell;
+ sh_first = cell->first;
+ }
+ break;
+ case shs_fs:
+ if(sh_return == 0 or
+ cell->length < sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ }
+ break;
+ case shs_fl:
+ if(sh_return == 0 or
+ cell->length > sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ }
+ break;
+ case shs_fm:
+ if(sh_return == 0 or
+ nuconn > sh_nuconn or
+ (nuconn == sh_nuconn and cell->first <= sh_first)) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_nuconn = nuconn;
+ }
+ break;
+ case shs_fsm:
+ if(sh_return == 0 or
+ nuconn > sh_nuconn or
+ (nuconn == sh_nuconn and
+ (cell->length < sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)))) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ sh_nuconn = nuconn;
+ }
+ break;
+ case shs_flm:
+ if(sh_return == 0 or
+ nuconn > sh_nuconn or
+ (nuconn == sh_nuconn and
+ (cell->length > sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)))) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ sh_nuconn = nuconn;
+ }
+ break;
+ default:
+ fatal_error("Internal error - unknown splitting heuristics");
+ return 0;
+ }
+ }
+ assert(sh_return);
+
+ for(unsigned int i = 0; i < comp.size(); i++)
+ {
+ Partition::Cell* const cell = comp[i];
+ cell->max_ival = 0;
+ component.push_back(cell->first);
+ component_elements += cell->length;
+ }
+
+ if(verbstr and verbose_level > 2) {
+ fprintf(verbstr, "NU-component with %lu cells and %u vertices\n",
+ (long unsigned)component.size(), component_elements);
+ fflush(verbstr);
+ }
+
+ return true;
+}
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Routines for undirected graphs
+ *
+ *-------------------------------------------------------------------------*/
+
+Graph::Vertex::Vertex()
+{
+ color = 0;
+}
+
+
+Graph::Vertex::~Vertex()
+{
+ ;
+}
+
+
+void
+Graph::Vertex::add_edge(const unsigned int other_vertex)
+{
+ edges.push_back(other_vertex);
+}
+
+
+void
+Graph::Vertex::remove_duplicate_edges(std::vector<bool>& tmp)
+{
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ /* Pre-conditions */
+ for(unsigned int i = 0; i < tmp.size(); i++) assert(tmp[i] == false);
+#endif
+ for(std::vector<unsigned int>::iterator iter = edges.begin();
+ iter != edges.end(); )
+ {
+ const unsigned int dest_vertex = *iter;
+ if(tmp[dest_vertex] == true)
+ {
+ /* A duplicate edge found! */
+ iter = edges.erase(iter);
+ }
+ else
+ {
+ /* Not seen earlier, mark as seen */
+ tmp[dest_vertex] = true;
+ iter++;
+ }
+ }
+
+ /* Clear tmp */
+ for(std::vector<unsigned int>::iterator iter = edges.begin();
+ iter != edges.end();
+ iter++)
+ {
+ tmp[*iter] = false;
+ }
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ /* Post-conditions */
+ for(unsigned int i = 0; i < tmp.size(); i++) assert(tmp[i] == false);
+#endif
+}
+
+
+/**
+ * Sort the edges leaving the vertex according to
+ * the vertex number of the other edge end.
+ * Time complexity: O(e log(e)), where e is the number of edges
+ * leaving the vertex.
+ */
+void
+Graph::Vertex::sort_edges()
+{
+ std::sort(edges.begin(), edges.end());
+}
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Constructor and destructor for undirected graphs
+ *
+ *-------------------------------------------------------------------------*/
+
+
+Graph::Graph(const unsigned int nof_vertices)
+{
+ vertices.resize(nof_vertices);
+ sh = shs_flm;
+}
+
+
+Graph::~Graph()
+{
+ ;
+}
+
+
+unsigned int
+Graph::add_vertex(const unsigned int color)
+{
+ const unsigned int vertex_num = vertices.size();
+ vertices.resize(vertex_num + 1);
+ vertices.back().color = color;
+ return vertex_num;
+}
+
+
+void
+Graph::add_edge(const unsigned int vertex1, const unsigned int vertex2)
+{
+ //fprintf(stderr, "(%u,%u) ", vertex1, vertex2);
+ vertices[vertex1].add_edge(vertex2);
+ vertices[vertex2].add_edge(vertex1);
+}
+
+
+void
+Graph::change_color(const unsigned int vertex, const unsigned int color)
+{
+ vertices[vertex].color = color;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Read graph in the DIMACS format.
+ * Returns 0 if an error occurred.
+ *
+ *-------------------------------------------------------------------------*/
+
+Graph*
+Graph::read_dimacs(FILE* const fp, FILE* const errstr)
+{
+ Graph *g = 0;
+ unsigned int nof_vertices;
+ unsigned int nof_edges;
+ unsigned int line_num = 1;
+ int c;
+
+ const bool verbose = false;
+ FILE* const verbstr = stdout;
+
+ /* Read comments and the problem definition line */
+ while(1)
+ {
+ c = getc(fp);
+ if(c == 'c')
+ {
+ /* A comment, ignore the rest of the line */
+ while((c = getc(fp)) != '\n')
+ {
+ if(c == EOF)
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ }
+ line_num++;
+ continue;
+ }
+ if(c == 'p')
+ {
+ /* The problem definition line */
+ if(fscanf(fp, " edge %u %u\n", &nof_vertices, &nof_edges) != 2)
+ {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ line_num++;
+ break;
+ }
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n", line_num);
+ goto error_exit;
+ }
+
+ if(nof_vertices <= 0)
+ {
+ if(errstr)
+ fprintf(errstr, "error: no vertices\n");
+ goto error_exit;
+ }
+ if(verbose)
+ {
+ fprintf(verbstr, "Instance has %d vertices and %d edges\n",
+ nof_vertices, nof_edges);
+ fflush(verbstr);
+ }
+
+ g = new Graph(nof_vertices);
+
+ //
+ // Read vertex colors
+ //
+ if(verbose)
+ {
+ fprintf(verbstr, "Reading vertex colors...\n");
+ fflush(verbstr);
+ }
+ while(1)
+ {
+ c = getc(fp);
+ if(c != 'n')
+ {
+ ungetc(c, fp);
+ break;
+ }
+ ungetc(c, fp);
+ unsigned int vertex;
+ unsigned int color;
+ if(fscanf(fp, "n %u %u\n", &vertex, &color) != 2)
+ {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ if(!((vertex >= 1) && (vertex <= nof_vertices)))
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: vertex %u not in range [1,...,%u]\n",
+ line_num, vertex, nof_vertices);
+ goto error_exit;
+ }
+ line_num++;
+ g->change_color(vertex - 1, color);
+ }
+ if(verbose)
+ {
+ fprintf(verbstr, "Done\n");
+ fflush(verbstr);
+ }
+
+ //
+ // Read edges
+ //
+ if(verbose)
+ {
+ fprintf(verbstr, "Reading edges...\n");
+ fflush(verbstr);
+ }
+ for(unsigned i = 0; i < nof_edges; i++)
+ {
+ unsigned int from, to;
+ if(fscanf(fp, "e %u %u\n", &from, &to) != 2)
+ {
+ if(errstr)
+ fprintf(errstr, "error in line %u: not in DIMACS format\n",
+ line_num);
+ goto error_exit;
+ }
+ if(!((from >= 1) && (from <= nof_vertices)))
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: vertex %u not in range [1,...,%u]\n",
+ line_num, from, nof_vertices);
+ goto error_exit;
+ }
+ if(!((to >= 1) && (to <= nof_vertices)))
+ {
+ if(errstr)
+ fprintf(errstr,
+ "error in line %u: vertex %u not in range [1,...,%u]\n",
+ line_num, to, nof_vertices);
+ goto error_exit;
+ }
+ line_num++;
+ g->add_edge(from-1, to-1);
+ }
+ if(verbose)
+ {
+ fprintf(verbstr, "Done\n");
+ fflush(verbstr);
+ }
+
+ return g;
+
+ error_exit:
+ if(g)
+ delete g;
+ return 0;
+
+}
+
+
+void
+Graph::write_dimacs(FILE* const fp)
+{
+ remove_duplicate_edges();
+ sort_edges();
+
+ /* First count the total number of edges */
+ unsigned int nof_edges = 0;
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex &v = vertices[i];
+ for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ ei != v.edges.end();
+ ei++)
+ {
+ const unsigned int dest_i = *ei;
+ if(dest_i < i)
+ continue;
+ nof_edges++;
+ }
+ }
+
+ /* Output the "header" line */
+ fprintf(fp, "p edge %u %u\n", get_nof_vertices(), nof_edges);
+
+ /* Print the color of each vertex */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex &v = vertices[i];
+ fprintf(fp, "n %u %u\n", i+1, v.color);
+ /*
+ if(v.color != 0)
+ {
+ fprintf(fp, "n %u %u\n", i+1, v.color);
+ }
+ */
+ }
+
+ /* Print the edges */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex &v = vertices[i];
+ for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ ei != v.edges.end();
+ ei++)
+ {
+ const unsigned int dest_i = *ei;
+ if(dest_i < i)
+ continue;
+ fprintf(fp, "e %u %u\n", i+1, dest_i+1);
+ }
+ }
+}
+
+
+
+void
+Graph::sort_edges()
+{
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ vertices[i].sort_edges();
+}
+
+
+int
+Graph::cmp(Graph& other)
+{
+ /* Compare the numbers of vertices */
+ if(get_nof_vertices() < other.get_nof_vertices())
+ return -1;
+ if(get_nof_vertices() > other.get_nof_vertices())
+ return 1;
+ /* Compare vertex colors */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ if(vertices[i].color < other.vertices[i].color)
+ return -1;
+ if(vertices[i].color > other.vertices[i].color)
+ return 1;
+ }
+ /* Compare vertex degrees */
+ remove_duplicate_edges();
+ other.remove_duplicate_edges();
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ if(vertices[i].nof_edges() < other.vertices[i].nof_edges())
+ return -1;
+ if(vertices[i].nof_edges() > other.vertices[i].nof_edges())
+ return 1;
+ }
+ /* Compare edges */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex &v1 = vertices[i];
+ Vertex &v2 = other.vertices[i];
+ v1.sort_edges();
+ v2.sort_edges();
+ std::vector<unsigned int>::const_iterator ei1 = v1.edges.begin();
+ std::vector<unsigned int>::const_iterator ei2 = v2.edges.begin();
+ while(ei1 != v1.edges.end())
+ {
+ if(*ei1 < *ei2)
+ return -1;
+ if(*ei1 > *ei2)
+ return 1;
+ ei1++;
+ ei2++;
+ }
+ }
+ return 0;
+}
+
+
+Graph*
+Graph::permute(const std::vector<unsigned int>& perm) const
+{
+#if defined(BLISS_CONSISTENCY_CHECKS)
+#endif
+
+ Graph* const g = new Graph(get_nof_vertices());
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ const Vertex& v = vertices[i];
+ Vertex& permuted_v = g->vertices[perm[i]];
+ permuted_v.color = v.color;
+ for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ ei != v.edges.end();
+ ei++)
+ {
+ const unsigned int dest_v = *ei;
+ permuted_v.add_edge(perm[dest_v]);
+ }
+ permuted_v.sort_edges();
+ }
+ return g;
+}
+
+Graph*
+Graph::permute(const unsigned int* perm) const
+{
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ if(!is_permutation(get_nof_vertices(), perm))
+ _INTERNAL_ERROR();
+#endif
+
+ Graph* const g = new Graph(get_nof_vertices());
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ const Vertex& v = vertices[i];
+ Vertex& permuted_v = g->vertices[perm[i]];
+ permuted_v.color = v.color;
+ for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ ei != v.edges.end();
+ ei++)
+ {
+ const unsigned int dest_v = *ei;
+ permuted_v.add_edge(perm[dest_v]);
+ }
+ permuted_v.sort_edges();
+ }
+ return g;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Print graph in graphviz format
+ *
+ *-------------------------------------------------------------------------*/
+
+
+void
+Graph::write_dot(const char* const filename)
+{
+ FILE *fp = fopen(filename, "w");
+ if(fp)
+ {
+ write_dot(fp);
+ fclose(fp);
+ }
+}
+
+void
+Graph::write_dot(FILE* const fp)
+{
+ remove_duplicate_edges();
+
+ fprintf(fp, "graph g {\n");
+
+ unsigned int vnum = 0;
+ for(std::vector<Vertex>::iterator vi = vertices.begin();
+ vi != vertices.end();
+ vi++, vnum++)
+ {
+ Vertex& v = *vi;
+ fprintf(fp, "v%u [label=\"%u:%u\"];\n", vnum, vnum, v.color);
+ for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ ei != v.edges.end();
+ ei++)
+ {
+ const unsigned int vnum2 = *ei;
+ if(vnum2 > vnum)
+ fprintf(fp, "v%u -- v%u\n", vnum, vnum2);
+ }
+ }
+
+ fprintf(fp, "}\n");
+}
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Get a hash value for the graph.
+ *
+ *-------------------------------------------------------------------------*/
+
+unsigned int
+Graph::get_hash()
+{
+ remove_duplicate_edges();
+ sort_edges();
+
+ UintSeqHash h;
+
+ h.update(get_nof_vertices());
+
+ /* Hash the color of each vertex */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ h.update(vertices[i].color);
+ }
+
+ /* Hash the edges */
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex &v = vertices[i];
+ for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ ei != v.edges.end();
+ ei++)
+ {
+ const unsigned int dest_i = *ei;
+ if(dest_i < i)
+ continue;
+ h.update(i);
+ h.update(dest_i);
+ }
+ }
+
+ return h.get_value();
+}
+
+
+
+
+
+void
+Graph::remove_duplicate_edges()
+{
+ std::vector<bool> tmp(vertices.size(), false);
+
+ for(std::vector<Vertex>::iterator vi = vertices.begin();
+ vi != vertices.end();
+ vi++)
+ {
+#if defined(BLISS_EXPENSIVE_CONSISTENCY_CHECKS)
+ for(unsigned int i = 0; i < tmp.size(); i++) assert(tmp[i] == false);
+#endif
+ (*vi).remove_duplicate_edges(tmp);
+ }
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Partition independent invariants
+ *
+ *-------------------------------------------------------------------------*/
+
+/*
+ * Return the color of the vertex.
+ * Time complexity: O(1)
+ */
+unsigned int
+Graph::vertex_color_invariant(const Graph* const g, const unsigned int v)
+{
+ return g->vertices[v].color;
+}
+
+/*
+ * Return the degree of the vertex.
+ * Time complexity: O(1)
+ */
+unsigned int
+Graph::degree_invariant(const Graph* const g, const unsigned int v)
+{
+ return g->vertices[v].nof_edges();
+}
+
+/*
+ * Return 1 if the vertex v has a self-loop, 0 otherwise
+ * Time complexity: O(E_v), where E_v is the number of edges leaving v
+ */
+unsigned int
+Graph::selfloop_invariant(const Graph* const g, const unsigned int v)
+{
+ const Vertex& vertex = g->vertices[v];
+ for(std::vector<unsigned int>::const_iterator ei = vertex.edges.begin();
+ ei != vertex.edges.end();
+ ei++)
+ {
+ if(*ei == v)
+ return 1;
+ }
+ return 0;
+}
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Refine the partition p according to a partition independent invariant
+ *
+ *-------------------------------------------------------------------------*/
+
+bool
+Graph::refine_according_to_invariant(unsigned int (*inv)(const Graph* const g,
+ const unsigned int v))
+{
+ bool refined = false;
+
+ for(Partition::Cell* cell = p.first_nonsingleton_cell; cell; )
+ {
+
+ Partition::Cell* const next_cell = cell->next_nonsingleton;
+
+ const unsigned int* ep = p.elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--, ep++)
+ {
+ const unsigned int ival = inv(this, *ep);
+ p.invariant_values[*ep] = ival;
+ if(ival > cell->max_ival)
+ {
+ cell->max_ival = ival;
+ cell->max_ival_count = 1;
+ }
+ else if(ival == cell->max_ival)
+ {
+ cell->max_ival_count++;
+ }
+ }
+ Partition::Cell* const last_new_cell = p.zplit_cell(cell, true);
+ refined |= (last_new_cell != cell);
+ cell = next_cell;
+ }
+
+ return refined;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Split the neighbourhood of a cell according to the equitable invariant
+ *
+ *-------------------------------------------------------------------------*/
+
+bool
+Graph::split_neighbourhood_of_cell(Partition::Cell* const cell)
+{
+
+
+ const bool was_equal_to_first = refine_equal_to_first;
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(cell->first);
+ eqref_hash.update(cell->length);
+ }
+
+ const unsigned int* ep = p.elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--)
+ {
+ const Vertex& v = vertices[*ep++];
+
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j != 0; j--)
+ {
+ const unsigned int dest_vertex = *ei++;
+ Partition::Cell * const neighbour_cell = p.get_cell(dest_vertex);
+ if(neighbour_cell->is_unit())
+ continue;
+ const unsigned int ival = ++p.invariant_values[dest_vertex];
+ if(ival > neighbour_cell->max_ival)
+ {
+ neighbour_cell->max_ival = ival;
+ neighbour_cell->max_ival_count = 1;
+ if(ival == 1) {
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ }
+ else if(ival == neighbour_cell->max_ival) {
+ neighbour_cell->max_ival_count++;
+ }
+ }
+ }
+
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell * const neighbour_cell = p.get_cell(p.elements[start]);
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(neighbour_cell->max_ival);
+ eqref_hash.update(neighbour_cell->max_ival_count);
+ }
+
+
+ Partition::Cell* const last_new_cell = p.zplit_cell(neighbour_cell, true);
+
+ /* Update certificate and hash if needed */
+ const Partition::Cell* c = neighbour_cell;
+ while(1)
+ {
+ if(in_search)
+ {
+ /* Build certificate */
+ cert_add_redundant(CERT_SPLIT, c->first, c->length);
+ /* No need to continue? */
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ goto worse_exit;
+ }
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(c->first);
+ eqref_hash.update(c->length);
+ }
+ if(c == last_new_cell)
+ break;
+ c = c->next;
+ }
+ }
+
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ return true;
+
+ return false;
+
+ worse_exit:
+ /* Clear neighbour heap */
+ UintSeqHash rest;
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell * const neighbour_cell = p.get_cell(p.elements[start]);
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ rest.update(neighbour_cell->first);
+ rest.update(neighbour_cell->length);
+ rest.update(neighbour_cell->max_ival);
+ rest.update(neighbour_cell->max_ival_count);
+ }
+ neighbour_cell->max_ival = 0;
+ neighbour_cell->max_ival_count = 0;
+ p.clear_ivs(neighbour_cell);
+ }
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ for(unsigned int i = p.splitting_queue.size(); i > 0; i--)
+ {
+ Partition::Cell* const cell = p.splitting_queue.pop_front();
+ rest.update(cell->first);
+ rest.update(cell->length);
+ p.splitting_queue.push_back(cell);
+ }
+ rest.update(failure_recording_fp_deviation);
+ failure_recording_fp_deviation = rest.get_value();
+ }
+
+ return true;
+}
+
+
+
+bool
+Graph::split_neighbourhood_of_unit_cell(Partition::Cell* const unit_cell)
+{
+
+
+ const bool was_equal_to_first = refine_equal_to_first;
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(0x87654321);
+ eqref_hash.update(unit_cell->first);
+ eqref_hash.update(1);
+ }
+
+ const Vertex& v = vertices[p.elements[unit_cell->first]];
+
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j > 0; j--)
+ {
+ const unsigned int dest_vertex = *ei++;
+ Partition::Cell * const neighbour_cell = p.get_cell(dest_vertex);
+
+ if(neighbour_cell->is_unit()) {
+ if(in_search) {
+ /* Remember neighbour in order to generate certificate */
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ continue;
+ }
+ if(neighbour_cell->max_ival_count == 0)
+ {
+ neighbour_heap.insert(neighbour_cell->first);
+ }
+ neighbour_cell->max_ival_count++;
+
+ unsigned int * const swap_position =
+ p.elements + neighbour_cell->first + neighbour_cell->length -
+ neighbour_cell->max_ival_count;
+ *p.in_pos[dest_vertex] = *swap_position;
+ p.in_pos[*swap_position] = p.in_pos[dest_vertex];
+ *swap_position = dest_vertex;
+ p.in_pos[dest_vertex] = swap_position;
+ }
+
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* neighbour_cell = p.get_cell(p.elements[start]);
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ if(neighbour_cell->is_unit()) {
+ } else {
+ }
+#endif
+
+ if(compute_eqref_hash)
+ {
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(neighbour_cell->max_ival_count);
+ }
+
+ if(neighbour_cell->length > 1 and
+ neighbour_cell->max_ival_count != neighbour_cell->length)
+ {
+ Partition::Cell * const new_cell =
+ p.aux_split_in_two(neighbour_cell,
+ neighbour_cell->length -
+ neighbour_cell->max_ival_count);
+ unsigned int *ep = p.elements + new_cell->first;
+ unsigned int * const lp = p.elements+new_cell->first+new_cell->length;
+ while(ep < lp)
+ {
+ p.element_to_cell_map[*ep] = new_cell;
+ ep++;
+ }
+ neighbour_cell->max_ival_count = 0;
+
+
+ if(compute_eqref_hash)
+ {
+ /* Update hash */
+ eqref_hash.update(neighbour_cell->first);
+ eqref_hash.update(neighbour_cell->length);
+ eqref_hash.update(0);
+ eqref_hash.update(new_cell->first);
+ eqref_hash.update(new_cell->length);
+ eqref_hash.update(1);
+ }
+
+ /* Add cells in splitting_queue */
+ if(neighbour_cell->is_in_splitting_queue()) {
+ /* Both cells must be included in splitting_queue in order
+ to ensure refinement into equitable partition */
+ p.splitting_queue_add(new_cell);
+ } else {
+ Partition::Cell *min_cell, *max_cell;
+ if(neighbour_cell->length <= new_cell->length) {
+ min_cell = neighbour_cell;
+ max_cell = new_cell;
+ } else {
+ min_cell = new_cell;
+ max_cell = neighbour_cell;
+ }
+ /* Put the smaller cell in splitting_queue */
+ p.splitting_queue_add(min_cell);
+ if(max_cell->is_unit()) {
+ /* Put the "larger" cell also in splitting_queue */
+ p.splitting_queue_add(max_cell);
+ }
+ }
+ /* Update pointer for certificate generation */
+ neighbour_cell = new_cell;
+ }
+ else
+ {
+ /* neighbour_cell->length == 1 ||
+ neighbour_cell->max_ival_count == neighbour_cell->length */
+ neighbour_cell->max_ival_count = 0;
+ }
+
+ /*
+ * Build certificate if required
+ */
+ if(in_search)
+ {
+ for(unsigned int i = neighbour_cell->first,
+ j = neighbour_cell->length;
+ j > 0;
+ j--, i++)
+ {
+ /* Build certificate */
+ cert_add(CERT_EDGE, unit_cell->first, i);
+ /* No need to continue? */
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ goto worse_exit;
+ }
+ } /* if(in_search) */
+ } /* while(!neighbour_heap.is_empty()) */
+
+ if(refine_compare_certificate and
+ (refine_equal_to_first == false) and
+ (refine_cmp_to_best < 0))
+ return true;
+
+ return false;
+
+ worse_exit:
+ /* Clear neighbour heap */
+ UintSeqHash rest;
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell * const neighbour_cell = p.get_cell(p.elements[start]);
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ rest.update(neighbour_cell->first);
+ rest.update(neighbour_cell->length);
+ rest.update(neighbour_cell->max_ival_count);
+ }
+ neighbour_cell->max_ival_count = 0;
+ }
+ if(opt_use_failure_recording and was_equal_to_first)
+ {
+ rest.update(failure_recording_fp_deviation);
+ failure_recording_fp_deviation = rest.get_value();
+ }
+ return true;
+}
+
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Check whether the current partition p is equitable.
+ * Performance: very slow, use only for debugging purposes.
+ *
+ *-------------------------------------------------------------------------*/
+
+bool Graph::is_equitable() const
+{
+ const unsigned int N = get_nof_vertices();
+ if(N == 0)
+ return true;
+
+ std::vector<unsigned int> first_count = std::vector<unsigned int>(N, 0);
+ std::vector<unsigned int> other_count = std::vector<unsigned int>(N, 0);
+
+ for(Partition::Cell *cell = p.first_cell; cell; cell = cell->next)
+ {
+ if(cell->is_unit())
+ continue;
+
+ unsigned int *ep = p.elements + cell->first;
+ const Vertex &first_vertex = vertices[*ep++];
+
+ /* Count how many edges lead from the first vertex to
+ * the neighbouring cells */
+ for(std::vector<unsigned int>::const_iterator ei =
+ first_vertex.edges.begin();
+ ei != first_vertex.edges.end();
+ ei++)
+ {
+ first_count[p.get_cell(*ei)->first]++;
+ }
+
+ /* Count and compare to the edges of the other vertices */
+ for(unsigned int i = cell->length; i > 1; i--)
+ {
+ const Vertex &vertex = vertices[*ep++];
+ for(std::vector<unsigned int>::const_iterator ei =
+ vertex.edges.begin();
+ ei != vertex.edges.end();
+ ei++)
+ {
+ other_count[p.get_cell(*ei)->first]++;
+ }
+ for(Partition::Cell *cell2 = p.first_cell;
+ cell2;
+ cell2 = cell2->next)
+ {
+ if(first_count[cell2->first] != other_count[cell2->first])
+ {
+ /* Not equitable */
+ return false;
+ }
+ other_count[cell2->first] = 0;
+ }
+ }
+ /* Reset first_count */
+ for(unsigned int i = 0; i < N; i++)
+ first_count[i] = 0;
+ }
+ return true;
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Build the initial equitable partition
+ *
+ *-------------------------------------------------------------------------*/
+
+void Graph::make_initial_equitable_partition()
+{
+ refine_according_to_invariant(&vertex_color_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_according_to_invariant(&selfloop_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_according_to_invariant(°ree_invariant);
+ p.splitting_queue_clear();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+ refine_to_equitable();
+ //p.print_signature(stderr); fprintf(stderr, "\n");
+
+}
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Find the next cell to be splitted
+ *
+ *-------------------------------------------------------------------------*/
+
+
+Partition::Cell*
+Graph::find_next_cell_to_be_splitted(Partition::Cell* cell)
+{
+ switch(sh) {
+ case shs_f: return sh_first();
+ case shs_fs: return sh_first_smallest();
+ case shs_fl: return sh_first_largest();
+ case shs_fm: return sh_first_max_neighbours();
+ case shs_fsm: return sh_first_smallest_max_neighbours();
+ case shs_flm: return sh_first_largest_max_neighbours();
+ default:
+ fatal_error("Internal error - unknown splitting heuristics");
+ return 0;
+ }
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first nonsingleton cell in the current partition.
+ */
+Partition::Cell*
+Graph::sh_first()
+{
+ Partition::Cell* best_cell = 0;
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ best_cell = cell;
+ break;
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first smallest nonsingleton cell in the current partition.
+ */
+Partition::Cell*
+Graph::sh_first_smallest()
+{
+ Partition::Cell* best_cell = 0;
+ unsigned int best_size = UINT_MAX;
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ if(cell->length < best_size)
+ {
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first largest nonsingleton cell in the current partition.
+ */
+Partition::Cell*
+Graph::sh_first_largest()
+{
+ Partition::Cell* best_cell = 0;
+ unsigned int best_size = 0;
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ if(cell->length > best_size)
+ {
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first nonsingleton cell with max number of neighbouring
+ * nonsingleton cells.
+ * Assumes that the partition p is equitable.
+ * Assumes that the max_ival fields of the cells are all 0.
+ */
+Partition::Cell*
+Graph::sh_first_max_neighbours()
+{
+ Partition::Cell* best_cell = 0;
+ int best_value = -1;
+ KStack<Partition::Cell*> neighbour_cells_visited;
+ neighbour_cells_visited.init(get_nof_vertices());
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j > 0; j--)
+ {
+ Partition::Cell * const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ int value = 0;
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+ if(value > best_value)
+ {
+ best_value = value;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first smallest nonsingleton cell with max number of neighbouring
+ * nonsingleton cells.
+ * Assumes that the partition p is equitable.
+ * Assumes that the max_ival fields of the cells are all 0.
+ */
+Partition::Cell*
+Graph::sh_first_smallest_max_neighbours()
+{
+ Partition::Cell* best_cell = 0;
+ int best_value = -1;
+ unsigned int best_size = UINT_MAX;
+ KStack<Partition::Cell*> neighbour_cells_visited;
+ neighbour_cells_visited.init(get_nof_vertices());
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j > 0; j--)
+ {
+ Partition::Cell* const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ int value = 0;
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+ if((value > best_value) or
+ (value == best_value and cell->length < best_size))
+ {
+ best_value = value;
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+/** \internal
+ * A splitting heuristic.
+ * Returns the first largest nonsingleton cell with max number of neighbouring
+ * nonsingleton cells.
+ * Assumes that the partition p is equitable.
+ * Assumes that the max_ival fields of the cells are all 0.
+ */
+Partition::Cell*
+Graph::sh_first_largest_max_neighbours()
+{
+ Partition::Cell* best_cell = 0;
+ int best_value = -1;
+ unsigned int best_size = 0;
+ KStack<Partition::Cell*> neighbour_cells_visited;
+ neighbour_cells_visited.init(get_nof_vertices());
+ for(Partition::Cell* cell = p.first_nonsingleton_cell;
+ cell;
+ cell = cell->next_nonsingleton)
+ {
+
+ if(opt_use_comprec and p.cr_get_level(cell->first) != cr_level)
+ continue;
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j > 0; j--)
+ {
+ Partition::Cell* const neighbour_cell = p.get_cell(*ei++);
+ if(neighbour_cell->is_unit())
+ continue;
+ neighbour_cell->max_ival++;
+ if(neighbour_cell->max_ival == 1)
+ neighbour_cells_visited.push(neighbour_cell);
+ }
+ int value = 0;
+ while(!neighbour_cells_visited.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbour_cells_visited.pop();
+ if(neighbour_cell->max_ival != neighbour_cell->length)
+ value++;
+ neighbour_cell->max_ival = 0;
+ }
+ if((value > best_value) or
+ (value == best_value and cell->length > best_size))
+ {
+ best_value = value;
+ best_size = cell->length;
+ best_cell = cell;
+ }
+ }
+ return best_cell;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Initialize the certificate size and memory
+ *
+ *-------------------------------------------------------------------------*/
+
+void
+Graph::initialize_certificate()
+{
+ certificate_index = 0;
+ certificate_current_path.clear();
+ certificate_first_path.clear();
+ certificate_best_path.clear();
+}
+
+
+
+
+
+/*-------------------------------------------------------------------------
+ *
+ * Check whether perm is an automorphism.
+ * Slow, mainly for debugging and validation purposes.
+ *
+ *-------------------------------------------------------------------------*/
+
+bool
+Graph::is_automorphism(unsigned int* const perm)
+{
+ std::set<unsigned int, std::less<unsigned int> > edges1;
+ std::set<unsigned int, std::less<unsigned int> > edges2;
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ if(!is_permutation(get_nof_vertices(), perm))
+ _INTERNAL_ERROR();
+#endif
+
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ Vertex& v1 = vertices[i];
+ edges1.clear();
+ for(std::vector<unsigned int>::iterator ei = v1.edges.begin();
+ ei != v1.edges.end();
+ ei++)
+ edges1.insert(perm[*ei]);
+
+ Vertex& v2 = vertices[perm[i]];
+ edges2.clear();
+ for(std::vector<unsigned int>::iterator ei = v2.edges.begin();
+ ei != v2.edges.end();
+ ei++)
+ edges2.insert(*ei);
+
+ if(!(edges1 == edges2))
+ return false;
+ }
+
+ return true;
+}
+
+
+
+
+bool
+Graph::is_automorphism(const std::vector<unsigned int>& perm) const
+{
+
+ if(!(perm.size() == get_nof_vertices() and is_permutation(perm)))
+ return false;
+
+ std::set<unsigned int, std::less<unsigned int> > edges1;
+ std::set<unsigned int, std::less<unsigned int> > edges2;
+
+ for(unsigned int i = 0; i < get_nof_vertices(); i++)
+ {
+ const Vertex& v1 = vertices[i];
+ edges1.clear();
+ for(std::vector<unsigned int>::const_iterator ei = v1.edges.begin();
+ ei != v1.edges.end();
+ ei++)
+ edges1.insert(perm[*ei]);
+
+ const Vertex& v2 = vertices[perm[i]];
+ edges2.clear();
+ for(std::vector<unsigned int>::const_iterator ei = v2.edges.begin();
+ ei != v2.edges.end();
+ ei++)
+ edges2.insert(*ei);
+
+ if(!(edges1 == edges2))
+ return false;
+ }
+
+ return true;
+}
+
+
+
+
+
+
+
+bool
+Graph::nucr_find_first_component(const unsigned int level)
+{
+
+ cr_component.clear();
+ cr_component_elements = 0;
+
+ /* Find first non-discrete cell in the component level */
+ Partition::Cell* first_cell = p.first_nonsingleton_cell;
+ while(first_cell)
+ {
+ if(p.cr_get_level(first_cell->first) == level)
+ break;
+ first_cell = first_cell->next_nonsingleton;
+ }
+
+ /* The component is discrete, return false */
+ if(!first_cell)
+ return false;
+
+ std::vector<Partition::Cell*> component;
+ first_cell->max_ival = 1;
+ component.push_back(first_cell);
+
+ for(unsigned int i = 0; i < component.size(); i++)
+ {
+ Partition::Cell* const cell = component[i];
+
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j > 0; j--)
+ {
+ const unsigned int neighbour = *ei++;
+
+ Partition::Cell* const neighbour_cell = p.get_cell(neighbour);
+
+ /* Skip unit neighbours */
+ if(neighbour_cell->is_unit())
+ continue;
+ /* Already marked to be in the same component? */
+ if(neighbour_cell->max_ival == 1)
+ continue;
+ /* Is the neighbour at the same component recursion level? */
+ if(p.cr_get_level(neighbour_cell->first) != level)
+ continue;
+
+ if(neighbour_cell->max_ival_count == 0)
+ neighbour_heap.insert(neighbour_cell->first);
+ neighbour_cell->max_ival_count++;
+ }
+ while(!neighbour_heap.is_empty())
+ {
+ const unsigned int start = neighbour_heap.remove();
+ Partition::Cell* const neighbour_cell =
+ p.get_cell(p.elements[start]);
+
+ /* Skip saturated neighbour cells */
+ if(neighbour_cell->max_ival_count == neighbour_cell->length)
+ {
+ neighbour_cell->max_ival_count = 0;
+ continue;
+ }
+ neighbour_cell->max_ival_count = 0;
+ neighbour_cell->max_ival = 1;
+ component.push_back(neighbour_cell);
+ }
+ }
+
+ for(unsigned int i = 0; i < component.size(); i++)
+ {
+ Partition::Cell* const cell = component[i];
+ cell->max_ival = 0;
+ cr_component.push_back(cell->first);
+ cr_component_elements += cell->length;
+ }
+
+ if(verbstr and verbose_level > 2) {
+ fprintf(verbstr, "NU-component with %lu cells and %u vertices\n",
+ (long unsigned)cr_component.size(), cr_component_elements);
+ fflush(verbstr);
+ }
+
+ return true;
+}
+
+
+
+
+bool
+Graph::nucr_find_first_component(const unsigned int level,
+ std::vector<unsigned int>& component,
+ unsigned int& component_elements,
+ Partition::Cell*& sh_return)
+{
+
+ component.clear();
+ component_elements = 0;
+ sh_return = 0;
+ unsigned int sh_first = 0;
+ unsigned int sh_size = 0;
+ unsigned int sh_nuconn = 0;
+
+ /* Find first non-discrete cell in the component level */
+ Partition::Cell* first_cell = p.first_nonsingleton_cell;
+ while(first_cell)
+ {
+ if(p.cr_get_level(first_cell->first) == level)
+ break;
+ first_cell = first_cell->next_nonsingleton;
+ }
+
+ if(!first_cell)
+ {
+ /* The component is discrete, return false */
+ return false;
+ }
+
+ std::vector<Partition::Cell*> comp;
+ KStack<Partition::Cell*> neighbours;
+ neighbours.init(get_nof_vertices());
+
+ first_cell->max_ival = 1;
+ comp.push_back(first_cell);
+
+ for(unsigned int i = 0; i < comp.size(); i++)
+ {
+ Partition::Cell* const cell = comp[i];
+
+ const Vertex& v = vertices[p.elements[cell->first]];
+ std::vector<unsigned int>::const_iterator ei = v.edges.begin();
+ for(unsigned int j = v.nof_edges(); j > 0; j--)
+ {
+ const unsigned int neighbour = *ei++;
+
+ Partition::Cell* const neighbour_cell = p.get_cell(neighbour);
+
+ /* Skip unit neighbours */
+ if(neighbour_cell->is_unit())
+ continue;
+ /* Is the neighbour at the same component recursion level? */
+ //if(p.cr_get_level(neighbour_cell->first) != level)
+ // continue;
+ if(neighbour_cell->max_ival_count == 0)
+ neighbours.push(neighbour_cell);
+ neighbour_cell->max_ival_count++;
+ }
+ unsigned int nuconn = 1;
+ while(!neighbours.is_empty())
+ {
+ Partition::Cell* const neighbour_cell = neighbours.pop();
+ //neighbours.pop_back();
+
+ /* Skip saturated neighbour cells */
+ if(neighbour_cell->max_ival_count == neighbour_cell->length)
+ {
+ neighbour_cell->max_ival_count = 0;
+ continue;
+ }
+ nuconn++;
+ neighbour_cell->max_ival_count = 0;
+ if(neighbour_cell->max_ival == 0) {
+ comp.push_back(neighbour_cell);
+ neighbour_cell->max_ival = 1;
+ }
+ }
+
+ switch(sh) {
+ case shs_f:
+ if(sh_return == 0 or
+ cell->first <= sh_first) {
+ sh_return = cell;
+ sh_first = cell->first;
+ }
+ break;
+ case shs_fs:
+ if(sh_return == 0 or
+ cell->length < sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ }
+ break;
+ case shs_fl:
+ if(sh_return == 0 or
+ cell->length > sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ }
+ break;
+ case shs_fm:
+ if(sh_return == 0 or
+ nuconn > sh_nuconn or
+ (nuconn == sh_nuconn and cell->first <= sh_first)) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_nuconn = nuconn;
+ }
+ break;
+ case shs_fsm:
+ if(sh_return == 0 or
+ nuconn > sh_nuconn or
+ (nuconn == sh_nuconn and
+ (cell->length < sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)))) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ sh_nuconn = nuconn;
+ }
+ break;
+ case shs_flm:
+ if(sh_return == 0 or
+ nuconn > sh_nuconn or
+ (nuconn == sh_nuconn and
+ (cell->length > sh_size or
+ (cell->length == sh_size and cell->first <= sh_first)))) {
+ sh_return = cell;
+ sh_first = cell->first;
+ sh_size = cell->length;
+ sh_nuconn = nuconn;
+ }
+ break;
+ default:
+ fatal_error("Internal error - unknown splitting heuristics");
+ return 0;
+ }
+ }
+ assert(sh_return);
+
+ for(unsigned int i = 0; i < comp.size(); i++)
+ {
+ Partition::Cell* const cell = comp[i];
+ cell->max_ival = 0;
+ component.push_back(cell->first);
+ component_elements += cell->length;
+ }
+
+ if(verbstr and verbose_level > 2) {
+ fprintf(verbstr, "NU-component with %lu cells and %u vertices\n",
+ (long unsigned)component.size(), component_elements);
+ fflush(verbstr);
+ }
+
+ return true;
+}
+
+
+
+
+}
diff --git a/src/bliss/graph.hh b/src/bliss/graph.hh
new file mode 100644
index 0000000..8288379
--- /dev/null
+++ b/src/bliss/graph.hh
@@ -0,0 +1,997 @@
+#ifndef BLISS_GRAPH_HH
+#define BLISS_GRAPH_HH
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * \namespace bliss
+ * The namespace bliss contains all the classes and functions of the bliss
+ * tool except for the C programming language API.
+ */
+namespace bliss {
+ class AbstractGraph;
+}
+
+#include <cstdio>
+#include <vector>
+#include "kstack.hh"
+#include "kqueue.hh"
+#include "heap.hh"
+#include "orbit.hh"
+#include "partition.hh"
+#include "bignum.hh"
+#include "uintseqhash.hh"
+
+namespace bliss {
+
+/**
+ * \brief Statistics returned by the bliss search algorithm.
+ */
+class Stats
+{
+ friend class AbstractGraph;
+public:
+ /** \internal The size of the automorphism group. */
+ BigNum group_size;
+private:
+ /** \internal An approximation (due to possible overflows) of
+ * the size of the automorphism group. */
+ long double group_size_approx;
+ /** \internal The number of nodes in the search tree. */
+ long unsigned int nof_nodes;
+ /** \internal The number of leaf nodes in the search tree. */
+ long unsigned int nof_leaf_nodes;
+ /** \internal The number of bad nodes in the search tree. */
+ long unsigned int nof_bad_nodes;
+ /** \internal The number of canonical representative updates. */
+ long unsigned int nof_canupdates;
+ /** \internal The number of generator permutations. */
+ long unsigned int nof_generators;
+ /** \internal The maximal depth of the search tree. */
+ unsigned long int max_level;
+ /** */
+ void reset()
+ {
+ group_size.assign(1);
+ group_size_approx = 1.0;
+ nof_nodes = 0;
+ nof_leaf_nodes = 0;
+ nof_bad_nodes = 0;
+ nof_canupdates = 0;
+ nof_generators = 0;
+ max_level = 0;
+ }
+public:
+ Stats() { reset(); }
+ /** Print the statistics. */
+ size_t print(FILE* const fp) const
+ {
+ size_t r = 0;
+ r += fprintf(fp, "Nodes: %lu\n", nof_nodes);
+ r += fprintf(fp, "Leaf nodes: %lu\n", nof_leaf_nodes);
+ r += fprintf(fp, "Bad nodes: %lu\n", nof_bad_nodes);
+ r += fprintf(fp, "Canrep updates: %lu\n", nof_canupdates);
+ r += fprintf(fp, "Generators: %lu\n", nof_generators);
+ r += fprintf(fp, "Max level: %lu\n", max_level);
+ r += fprintf(fp, "|Aut|: ")+group_size.print(fp)+fprintf(fp, "\n");
+ fflush(fp);
+ return r;
+ }
+ /** An approximation (due to possible overflows/rounding errors) of
+ * the size of the automorphism group. */
+ long double get_group_size_approx() const {return group_size_approx;}
+ /** The number of nodes in the search tree. */
+ long unsigned int get_nof_nodes() const {return nof_nodes;}
+ /** The number of leaf nodes in the search tree. */
+ long unsigned int get_nof_leaf_nodes() const {return nof_leaf_nodes;}
+ /** The number of bad nodes in the search tree. */
+ long unsigned int get_nof_bad_nodes() const {return nof_bad_nodes;}
+ /** The number of canonical representative updates. */
+ long unsigned int get_nof_canupdates() const {return nof_canupdates;}
+ /** The number of generator permutations. */
+ long unsigned int get_nof_generators() const {return nof_generators;}
+ /** The maximal depth of the search tree. */
+ unsigned long int get_max_level() const {return max_level;}
+};
+
+
+
+
+
+
+/**
+ * \brief An abstract base class for different types of graphs.
+ */
+class AbstractGraph
+{
+ friend class Partition;
+
+public:
+ AbstractGraph();
+ virtual ~AbstractGraph();
+
+ /**
+ * Set the verbose output level for the algorithms.
+ * \param level the level of verbose output, 0 means no verbose output
+ */
+ void set_verbose_level(const unsigned int level);
+
+ /**
+ * Set the file stream for the verbose output.
+ * \param fp the file stream; if null, no verbose output is written
+ */
+ void set_verbose_file(FILE * const fp);
+
+ /**
+ * Add a new vertex with color \a color in the graph and return its index.
+ */
+ virtual unsigned int add_vertex(const unsigned int color = 0) = 0;
+
+ /**
+ * Add an edge between vertices \a source and \a target.
+ * Duplicate edges between vertices are ignored but try to avoid introducing
+ * them in the first place as they are not ignored immediately but will
+ * consume memory and computation resources for a while.
+ */
+ virtual void add_edge(const unsigned int source, const unsigned int target) = 0;
+
+ /**
+ * Change the color of the vertex \a vertex to \a color.
+ */
+ virtual void change_color(const unsigned int vertex, const unsigned int color) = 0;
+
+ /**
+ * Check whether \a perm is an automorphism of this graph.
+ * Unoptimized, mainly for debugging purposes.
+ */
+ virtual bool is_automorphism(const std::vector<unsigned int>& perm) const;
+
+
+ /** Activate/deactivate failure recording.
+ * May not be called during the search, i.e. from an automorphism reporting
+ * hook function.
+ * \param active if true, activate failure recording, deactivate otherwise
+ */
+ void set_failure_recording(const bool active) {assert(!in_search); opt_use_failure_recording = active;}
+
+ /** Activate/deactivate component recursion.
+ * The choice affects the computed canonical labelings;
+ * therefore, if you want to compare whether two graphs are isomorphic by
+ * computing and comparing (for equality) their canonical versions,
+ * be sure to use the same choice for both graphs.
+ * May not be called during the search, i.e. from an automorphism reporting
+ * hook function.
+ * \param active if true, activate component recursion, deactivate otherwise
+ */
+ void set_component_recursion(const bool active) {assert(!in_search); opt_use_comprec = active;}
+
+
+
+ /**
+ * Return the number of vertices in the graph.
+ */
+ virtual unsigned int get_nof_vertices() const = 0;
+
+ /**
+ * Return a new graph that is the result of applying the permutation \a perm
+ * to this graph. This graph is not modified.
+ * \a perm must contain N=this.get_nof_vertices() elements and be a bijection
+ * on {0,1,...,N-1}, otherwise the result is undefined or a segfault.
+ */
+ virtual AbstractGraph* permute(const unsigned int* const perm) const = 0;
+ virtual AbstractGraph* permute(const std::vector<unsigned int>& perm) const = 0;
+
+ /**
+ * Find a set of generators for the automorphism group of the graph.
+ * The function \a hook (if non-null) is called each time a new generator
+ * for the automorphism group is found.
+ * The first argument \a user_param for the hook is the
+ * \a hook_user_param given below,
+ * the second argument \a n is the length of the automorphism (equal to
+ * get_nof_vertices()) and
+ * the third argument \a aut is the automorphism
+ * (a bijection on {0,...,get_nof_vertices()-1}).
+ * The memory for the automorphism \a aut will be invalidated immediately
+ * after the return from the hook function;
+ * if you want to use the automorphism later, you have to take a copy of it.
+ * Do not call any member functions in the hook.
+ * The search statistics are copied in \a stats.
+ */
+ void find_automorphisms(Stats& stats,
+ void (*hook)(void* user_param,
+ unsigned int n,
+ const unsigned int* aut),
+ void* hook_user_param);
+
+ /**
+ * Otherwise the same as find_automorphisms() except that
+ * a canonical labeling of the graph (a bijection on
+ * {0,...,get_nof_vertices()-1}) is returned.
+ * The memory allocated for the returned canonical labeling will remain
+ * valid only until the next call to a member function with the exception
+ * that constant member functions (for example, bliss::Graph::permute()) can
+ * be called without invalidating the labeling.
+ * To compute the canonical version of an undirected graph, call this
+ * function and then bliss::Graph::permute() with the returned canonical
+ * labeling.
+ * Note that the computed canonical version may depend on the applied version
+ * of bliss as well as on some other options (for instance, the splitting
+ * heuristic selected with bliss::Graph::set_splitting_heuristic()).
+ */
+ const unsigned int* canonical_form(Stats& stats,
+ void (*hook)(void* user_param,
+ unsigned int n,
+ const unsigned int* aut),
+ void* hook_user_param);
+
+ /**
+ * Write the graph to a file in a variant of the DIMACS format.
+ * See the <A href="http://www.tcs.hut.fi/Software/bliss/">bliss website</A>
+ * for the definition of the file format.
+ * Note that in the DIMACS file the vertices are numbered from 1 to N while
+ * in this C++ API they are from 0 to N-1.
+ * Thus the vertex n in the file corresponds to the vertex n-1 in the API.
+ * \param fp the file stream where the graph is written
+ */
+ virtual void write_dimacs(FILE * const fp) = 0;
+
+ /**
+ * Write the graph to a file in the graphviz dotty format.
+ * \param fp the file stream where the graph is written
+ */
+ virtual void write_dot(FILE * const fp) = 0;
+
+ /**
+ * Write the graph in a file in the graphviz dotty format.
+ * Do nothing if the file cannot be written.
+ * \param file_name the name of the file to which the graph is written
+ */
+ virtual void write_dot(const char * const file_name) = 0;
+
+ /**
+ * Get a hash value for the graph.
+ * \return the hash value
+ */
+ virtual unsigned int get_hash() = 0;
+
+ /**
+ * Disable/enable the "long prune" method.
+ * The choice affects the computed canonical labelings;
+ * therefore, if you want to compare whether two graphs are isomorphic by
+ * computing and comparing (for equality) their canonical versions,
+ * be sure to use the same choice for both graphs.
+ * May not be called during the search, i.e. from an automorphism reporting
+ * hook function.
+ * \param active if true, activate "long prune", deactivate otherwise
+ */
+ void set_long_prune_activity(const bool active) {
+ assert(!in_search);
+ opt_use_long_prune = active;
+ }
+
+
+
+protected:
+ /** \internal
+ * How much verbose output is produced (0 means none) */
+ unsigned int verbose_level;
+ /** \internal
+ * The output stream for verbose output. */
+ FILE *verbstr;
+protected:
+
+ /** \internal
+ * The ordered partition used in the search algorithm. */
+ Partition p;
+
+ /** \internal
+ * Whether the search for automorphisms and a canonical labeling is
+ * in progress.
+ */
+ bool in_search;
+
+ /** \internal
+ * Is failure recording in use?
+ */
+ bool opt_use_failure_recording;
+ /* The "tree-specific" invariant value for the point when current path
+ * got different from the first path */
+ unsigned int failure_recording_fp_deviation;
+
+ /** \internal
+ * Is component recursion in use?
+ */
+ bool opt_use_comprec;
+
+
+ unsigned int refine_current_path_certificate_index;
+ bool refine_compare_certificate;
+ bool refine_equal_to_first;
+ unsigned int refine_first_path_subcertificate_end;
+ int refine_cmp_to_best;
+ unsigned int refine_best_path_subcertificate_end;
+
+ static const unsigned int CERT_SPLIT = 0; //UINT_MAX;
+ static const unsigned int CERT_EDGE = 1; //UINT_MAX-1;
+ /** \internal
+ * Add a triple (v1,v2,v3) in the certificate.
+ * May modify refine_equal_to_first and refine_cmp_to_best.
+ * May also update eqref_hash and failure_recording_fp_deviation. */
+ void cert_add(const unsigned int v1,
+ const unsigned int v2,
+ const unsigned int v3);
+
+ /** \internal
+ * Add a redundant triple (v1,v2,v3) in the certificate.
+ * Can also just dicard the triple.
+ * May modify refine_equal_to_first and refine_cmp_to_best.
+ * May also update eqref_hash and failure_recording_fp_deviation. */
+ void cert_add_redundant(const unsigned int x,
+ const unsigned int y,
+ const unsigned int z);
+
+ /**\internal
+ * Is the long prune method in use?
+ */
+ bool opt_use_long_prune;
+ /**\internal
+ * Maximum amount of memory (in megabytes) available for
+ * the long prune method
+ */
+ static const unsigned int long_prune_options_max_mem = 50;
+ /**\internal
+ * Maximum amount of automorphisms stored for the long prune method;
+ * less than this is stored if the memory limit above is reached first
+ */
+ static const unsigned int long_prune_options_max_stored_auts = 100;
+
+ unsigned int long_prune_max_stored_autss;
+ std::vector<std::vector<bool> *> long_prune_fixed;
+ std::vector<std::vector<bool> *> long_prune_mcrs;
+ std::vector<bool> long_prune_temp;
+ unsigned int long_prune_begin;
+ unsigned int long_prune_end;
+ /** \internal
+ * Initialize the "long prune" data structures.
+ */
+ void long_prune_init();
+ /** \internal
+ * Release the memory allocated for "long prune" data structures.
+ */
+ void long_prune_deallocate();
+ void long_prune_add_automorphism(const unsigned int *aut);
+ std::vector<bool>& long_prune_get_fixed(const unsigned int index);
+ std::vector<bool>& long_prune_allocget_fixed(const unsigned int index);
+ std::vector<bool>& long_prune_get_mcrs(const unsigned int index);
+ std::vector<bool>& long_prune_allocget_mcrs(const unsigned int index);
+ /** \internal
+ * Swap the i:th and j:th stored automorphism information;
+ * i and j must be "in window, i.e. in [long_prune_begin,long_prune_end[
+ */
+ void long_prune_swap(const unsigned int i, const unsigned int j);
+
+ /*
+ * Data structures and routines for refining the partition p into equitable
+ */
+ Heap neighbour_heap;
+ virtual bool split_neighbourhood_of_unit_cell(Partition::Cell *) = 0;
+ virtual bool split_neighbourhood_of_cell(Partition::Cell * const) = 0;
+ void refine_to_equitable();
+ void refine_to_equitable(Partition::Cell * const unit_cell);
+ void refine_to_equitable(Partition::Cell * const unit_cell1,
+ Partition::Cell * const unit_cell2);
+
+
+ /** \internal
+ * \return false if it was detected that the current certificate
+ * is different from the first and/or best (whether this is checked
+ * depends on in_search and refine_compare_certificate flags.
+ */
+ bool do_refine_to_equitable();
+
+ unsigned int eqref_max_certificate_index;
+ /** \internal
+ * Whether eqref_hash is updated during equitable refinement process.
+ */
+ bool compute_eqref_hash;
+ UintSeqHash eqref_hash;
+
+
+ /** \internal
+ * Check whether the current partition p is equitable.
+ * Performance: very slow, use only for debugging purposes.
+ */
+ virtual bool is_equitable() const = 0;
+
+ unsigned int *first_path_labeling;
+ unsigned int *first_path_labeling_inv;
+ Orbit first_path_orbits;
+ unsigned int *first_path_automorphism;
+
+ unsigned int *best_path_labeling;
+ unsigned int *best_path_labeling_inv;
+ Orbit best_path_orbits;
+ unsigned int *best_path_automorphism;
+
+ void update_labeling(unsigned int * const lab);
+ void update_labeling_and_its_inverse(unsigned int * const lab,
+ unsigned int * const lab_inv);
+ void update_orbit_information(Orbit &o, const unsigned int *perm);
+
+ void reset_permutation(unsigned int *perm);
+
+ /* Mainly for debugging purposes */
+ virtual bool is_automorphism(unsigned int* const perm);
+
+ std::vector<unsigned int> certificate_current_path;
+ std::vector<unsigned int> certificate_first_path;
+ std::vector<unsigned int> certificate_best_path;
+
+ unsigned int certificate_index;
+ virtual void initialize_certificate() = 0;
+
+ virtual void remove_duplicate_edges() = 0;
+ virtual void make_initial_equitable_partition() = 0;
+ virtual Partition::Cell* find_next_cell_to_be_splitted(Partition::Cell *cell) = 0;
+
+
+ void search(const bool canonical, Stats &stats);
+
+
+ void (*report_hook)(void *user_param,
+ unsigned int n,
+ const unsigned int *aut);
+ void *report_user_param;
+
+
+ /*
+ *
+ * Nonuniform component recursion (NUCR)
+ *
+ */
+
+ /** The currently traversed component */
+ unsigned int cr_level;
+
+ /** \internal
+ * The "Component End Point" data structure
+ */
+ class CR_CEP {
+ public:
+ /** At which level in the search was this CEP created */
+ unsigned int creation_level;
+ /** The current component has been fully traversed when the partition has
+ * this many discrete cells left */
+ unsigned int discrete_cell_limit;
+ /** The component to be traversed after the current one */
+ unsigned int next_cr_level;
+ /** The next component end point */
+ unsigned int next_cep_index;
+ bool first_checked;
+ bool best_checked;
+ };
+ /** \internal
+ * A stack for storing Component End Points
+ */
+ std::vector<CR_CEP> cr_cep_stack;
+
+ /** \internal
+ * Find the first non-uniformity component at the component recursion
+ * level \a level.
+ * The component is stored in \a cr_component.
+ * If no component is found, \a cr_component is empty.
+ * Returns false if all the cells in the component recursion level \a level
+ * were discrete.
+ * Modifies the max_ival and max_ival_count fields of Partition:Cell
+ * (assumes that they are 0 when called and
+ * quarantees that they are 0 when returned).
+ */
+ virtual bool nucr_find_first_component(const unsigned int level) = 0;
+ virtual bool nucr_find_first_component(const unsigned int level,
+ std::vector<unsigned int>& component,
+ unsigned int& component_elements,
+ Partition::Cell*& sh_return) = 0;
+ /** \internal
+ * The non-uniformity component found by nucr_find_first_component()
+ * is stored here.
+ */
+ std::vector<unsigned int> cr_component;
+ /** \internal
+ * The number of vertices in the component \a cr_component
+ */
+ unsigned int cr_component_elements;
+
+
+
+
+};
+
+
+
+/**
+ * \brief The class for undirected, vertex colored graphs.
+ *
+ * Multiple edges between vertices are not allowed (i.e., are ignored).
+ */
+class Graph : public AbstractGraph
+{
+public:
+ /**
+ * The possible splitting heuristics.
+ * The selected splitting heuristics affects the computed canonical
+ * labelings; therefore, if you want to compare whether two graphs
+ * are isomorphic by computing and comparing (for equality) their
+ * canonical versions, be sure to use the same splitting heuristics
+ * for both graphs.
+ */
+ typedef enum {
+ /** First non-unit cell.
+ * Very fast but may result in large search spaces on difficult graphs.
+ * Use for large but easy graphs. */
+ shs_f = 0,
+ /** First smallest non-unit cell.
+ * Fast, should usually produce smaller search spaces than shs_f. */
+ shs_fs,
+ /** First largest non-unit cell.
+ * Fast, should usually produce smaller search spaces than shs_f. */
+ shs_fl,
+ /** First maximally non-trivially connected non-unit cell.
+ * Not so fast, should usually produce smaller search spaces than shs_f,
+ * shs_fs, and shs_fl. */
+ shs_fm,
+ /** First smallest maximally non-trivially connected non-unit cell.
+ * Not so fast, should usually produce smaller search spaces than shs_f,
+ * shs_fs, and shs_fl. */
+ shs_fsm,
+ /** First largest maximally non-trivially connected non-unit cell.
+ * Not so fast, should usually produce smaller search spaces than shs_f,
+ * shs_fs, and shs_fl. */
+ shs_flm
+ } SplittingHeuristic;
+
+protected:
+ class Vertex {
+ public:
+ Vertex();
+ ~Vertex();
+ void add_edge(const unsigned int other_vertex);
+ void remove_duplicate_edges(std::vector<bool>& tmp);
+ void sort_edges();
+
+ unsigned int color;
+ std::vector<unsigned int> edges;
+ unsigned int nof_edges() const {return edges.size(); }
+ };
+ std::vector<Vertex> vertices;
+ void sort_edges();
+ void remove_duplicate_edges();
+
+ /** \internal
+ * Partition independent invariant.
+ * Returns the color of the vertex.
+ * Time complexity: O(1).
+ */
+ static unsigned int vertex_color_invariant(const Graph* const g,
+ const unsigned int v);
+ /** \internal
+ * Partition independent invariant.
+ * Returns the degree of the vertex.
+ * DUPLICATE EDGES MUST HAVE BEEN REMOVED BEFORE.
+ * Time complexity: O(1).
+ */
+ static unsigned int degree_invariant(const Graph* const g,
+ const unsigned int v);
+ /** \internal
+ * Partition independent invariant.
+ * Returns 1 if there is an edge from the vertex to itself, 0 if not.
+ * Time complexity: O(k), where k is the number of edges leaving the vertex.
+ */
+ static unsigned int selfloop_invariant(const Graph* const g,
+ const unsigned int v);
+
+
+ bool refine_according_to_invariant(unsigned int (*inv)(const Graph* const g,
+ const unsigned int v));
+
+ /*
+ * Routines needed when refining the partition p into equitable
+ */
+ bool split_neighbourhood_of_unit_cell(Partition::Cell *);
+ bool split_neighbourhood_of_cell(Partition::Cell * const);
+
+ /** \internal
+ * \copydoc AbstractGraph::is_equitable() const
+ */
+ bool is_equitable() const;
+
+ /* Splitting heuristics, documented in more detail in graph.cc */
+ SplittingHeuristic sh;
+ Partition::Cell* find_next_cell_to_be_splitted(Partition::Cell *cell);
+ Partition::Cell* sh_first();
+ Partition::Cell* sh_first_smallest();
+ Partition::Cell* sh_first_largest();
+ Partition::Cell* sh_first_max_neighbours();
+ Partition::Cell* sh_first_smallest_max_neighbours();
+ Partition::Cell* sh_first_largest_max_neighbours();
+
+
+ void make_initial_equitable_partition();
+
+ void initialize_certificate();
+
+ bool is_automorphism(unsigned int* const perm);
+
+
+ bool nucr_find_first_component(const unsigned int level);
+ bool nucr_find_first_component(const unsigned int level,
+ std::vector<unsigned int>& component,
+ unsigned int& component_elements,
+ Partition::Cell*& sh_return);
+
+
+
+public:
+ /**
+ * Create a new graph with \a N vertices and no edges.
+ */
+ Graph(const unsigned int N = 0);
+
+ /**
+ * Destroy the graph.
+ */
+ ~Graph();
+
+ /**
+ * Read the graph from the file \a fp in a variant of the DIMACS format.
+ * See the <A href="http://www.tcs.hut.fi/Software/bliss/">bliss website</A>
+ * for the definition of the file format.
+ * Note that in the DIMACS file the vertices are numbered from 1 to N while
+ * in this C++ API they are from 0 to N-1.
+ * Thus the vertex n in the file corresponds to the vertex n-1 in the API.
+ *
+ * \param fp the file stream for the graph file
+ * \param errstr if non-null, the possible error messages are printed
+ * in this file stream
+ * \return a new Graph object or 0 if reading failed for some
+ * reason
+ */
+ static Graph* read_dimacs(FILE* const fp, FILE* const errstr = stderr);
+
+ /**
+ * Write the graph to a file in a variant of the DIMACS format.
+ * See the <A href="http://www.tcs.hut.fi/Software/bliss/">bliss website</A>
+ * for the definition of the file format.
+ */
+ void write_dimacs(FILE* const fp);
+
+ /**
+ * \copydoc AbstractGraph::write_dot(FILE * const fp)
+ */
+ void write_dot(FILE* const fp);
+
+ /**
+ * \copydoc AbstractGraph::write_dot(const char * const file_name)
+ */
+ void write_dot(const char* const file_name);
+
+ /**
+ * \copydoc AbstractGraph::is_automorphism(const std::vector<unsigned int>& perm) const
+ */
+ bool is_automorphism(const std::vector<unsigned int>& perm) const;
+
+
+ /**
+ * \copydoc AbstractGraph::get_hash()
+ */
+ virtual unsigned int get_hash();
+
+ /**
+ * Return the number of vertices in the graph.
+ */
+ unsigned int get_nof_vertices() const {return vertices.size(); }
+
+ /**
+ * \copydoc AbstractGraph::permute(const unsigned int* const perm) const
+ */
+ Graph* permute(const unsigned int* const perm) const;
+ Graph* permute(const std::vector<unsigned int>& perm) const;
+
+ /**
+ * Add a new vertex with color \a color in the graph and return its index.
+ */
+ unsigned int add_vertex(const unsigned int color = 0);
+
+ /**
+ * Add an edge between vertices \a v1 and \a v2.
+ * Duplicate edges between vertices are ignored but try to avoid introducing
+ * them in the first place as they are not ignored immediately but will
+ * consume memory and computation resources for a while.
+ */
+ void add_edge(const unsigned int v1, const unsigned int v2);
+
+ /**
+ * Change the color of the vertex \a vertex to \a color.
+ */
+ void change_color(const unsigned int vertex, const unsigned int color);
+
+ /**
+ * Compare this graph with the graph \a other.
+ * Returns 0 if the graphs are equal, and a negative (positive) integer
+ * if this graph is "smaller than" ("greater than", resp.) than \a other.
+ */
+ int cmp(Graph& other);
+
+ /**
+ * Set the splitting heuristic used by the automorphism and canonical
+ * labeling algorithm.
+ * The selected splitting heuristics affects the computed canonical
+ * labelings; therefore, if you want to compare whether two graphs
+ * are isomorphic by computing and comparing (for equality) their
+ * canonical versions, be sure to use the same splitting heuristics
+ * for both graphs.
+ */
+ void set_splitting_heuristic(const SplittingHeuristic shs) {sh = shs; }
+
+
+};
+
+
+
+/**
+ * \brief The class for directed, vertex colored graphs.
+ *
+ * Multiple edges between vertices are not allowed (i.e., are ignored).
+ */
+class Digraph : public AbstractGraph
+{
+public:
+ /**
+ * The possible splitting heuristics.
+ * The selected splitting heuristics affects the computed canonical
+ * labelings; therefore, if you want to compare whether two graphs
+ * are isomorphic by computing and comparing (for equality) their
+ * canonical versions, be sure to use the same splitting heuristics
+ * for both graphs.
+ */
+ typedef enum {
+ /** First non-unit cell.
+ * Very fast but may result in large search spaces on difficult graphs.
+ * Use for large but easy graphs. */
+ shs_f = 0,
+ /** First smallest non-unit cell.
+ * Fast, should usually produce smaller search spaces than shs_f. */
+ shs_fs,
+ /** First largest non-unit cell.
+ * Fast, should usually produce smaller search spaces than shs_f. */
+ shs_fl,
+ /** First maximally non-trivially connected non-unit cell.
+ * Not so fast, should usually produce smaller search spaces than shs_f,
+ * shs_fs, and shs_fl. */
+ shs_fm,
+ /** First smallest maximally non-trivially connected non-unit cell.
+ * Not so fast, should usually produce smaller search spaces than shs_f,
+ * shs_fs, and shs_fl. */
+ shs_fsm,
+ /** First largest maximally non-trivially connected non-unit cell.
+ * Not so fast, should usually produce smaller search spaces than shs_f,
+ * shs_fs, and shs_fl. */
+ shs_flm
+ } SplittingHeuristic;
+
+protected:
+ class Vertex {
+ public:
+ Vertex();
+ ~Vertex();
+ void add_edge_to(const unsigned int dest_vertex);
+ void add_edge_from(const unsigned int source_vertex);
+ void remove_duplicate_edges(std::vector<bool>& tmp);
+ void sort_edges();
+ unsigned int color;
+ std::vector<unsigned int> edges_out;
+ std::vector<unsigned int> edges_in;
+ unsigned int nof_edges_in() const {return edges_in.size(); }
+ unsigned int nof_edges_out() const {return edges_out.size(); }
+ };
+ std::vector<Vertex> vertices;
+ void remove_duplicate_edges();
+
+ /** \internal
+ * Partition independent invariant.
+ * Returns the color of the vertex.
+ * Time complexity: O(1).
+ */
+ static unsigned int vertex_color_invariant(const Digraph* const g,
+ const unsigned int v);
+ /** \internal
+ * Partition independent invariant.
+ * Returns the indegree of the vertex.
+ * DUPLICATE EDGES MUST HAVE BEEN REMOVED BEFORE.
+ * Time complexity: O(1).
+ */
+ static unsigned int indegree_invariant(const Digraph* const g,
+ const unsigned int v);
+ /** \internal
+ * Partition independent invariant.
+ * Returns the outdegree of the vertex.
+ * DUPLICATE EDGES MUST HAVE BEEN REMOVED BEFORE.
+ * Time complexity: O(1).
+ */
+ static unsigned int outdegree_invariant(const Digraph* const g,
+ const unsigned int v);
+ /** \internal
+ * Partition independent invariant.
+ * Returns 1 if there is an edge from the vertex to itself, 0 if not.
+ * Time complexity: O(k), where k is the number of edges leaving the vertex.
+ */
+ static unsigned int selfloop_invariant(const Digraph* const g,
+ const unsigned int v);
+
+ /** \internal
+ * Refine the partition \a p according to
+ * the partition independent invariant \a inv.
+ */
+ bool refine_according_to_invariant(unsigned int (*inv)(const Digraph* const g,
+ const unsigned int v));
+
+ /*
+ * Routines needed when refining the partition p into equitable
+ */
+ bool split_neighbourhood_of_unit_cell(Partition::Cell* const);
+ bool split_neighbourhood_of_cell(Partition::Cell* const);
+
+
+ /** \internal
+ * \copydoc AbstractGraph::is_equitable() const
+ */
+ bool is_equitable() const;
+
+ /* Splitting heuristics, documented in more detail in the cc-file. */
+ SplittingHeuristic sh;
+ Partition::Cell* find_next_cell_to_be_splitted(Partition::Cell *cell);
+ Partition::Cell* sh_first();
+ Partition::Cell* sh_first_smallest();
+ Partition::Cell* sh_first_largest();
+ Partition::Cell* sh_first_max_neighbours();
+ Partition::Cell* sh_first_smallest_max_neighbours();
+ Partition::Cell* sh_first_largest_max_neighbours();
+
+ void make_initial_equitable_partition();
+
+ void initialize_certificate();
+
+ bool is_automorphism(unsigned int* const perm);
+
+ void sort_edges();
+
+ bool nucr_find_first_component(const unsigned int level);
+ bool nucr_find_first_component(const unsigned int level,
+ std::vector<unsigned int>& component,
+ unsigned int& component_elements,
+ Partition::Cell*& sh_return);
+
+public:
+ /**
+ * Create a new directed graph with \a N vertices and no edges.
+ */
+ Digraph(const unsigned int N = 0);
+
+ /**
+ * Destroy the graph.
+ */
+ ~Digraph();
+
+ /**
+ * Read the graph from the file \a fp in a variant of the DIMACS format.
+ * See the <A href="http://www.tcs.hut.fi/Software/bliss/">bliss website</A>
+ * for the definition of the file format.
+ * Note that in the DIMACS file the vertices are numbered from 1 to N while
+ * in this C++ API they are from 0 to N-1.
+ * Thus the vertex n in the file corresponds to the vertex n-1 in the API.
+ * \param fp the file stream for the graph file
+ * \param errstr if non-null, the possible error messages are printed
+ * in this file stream
+ * \return a new Digraph object or 0 if reading failed for some
+ * reason
+ */
+ static Digraph* read_dimacs(FILE* const fp, FILE* const errstr = stderr);
+
+ /**
+ * \copydoc AbstractGraph::write_dimacs(FILE * const fp)
+ */
+ void write_dimacs(FILE* const fp);
+
+
+ /**
+ * \copydoc AbstractGraph::write_dot(FILE *fp)
+ */
+ void write_dot(FILE * const fp);
+
+ /**
+ * \copydoc AbstractGraph::write_dot(const char * const file_name)
+ */
+ void write_dot(const char * const file_name);
+
+ /**
+ * \copydoc AbstractGraph::is_automorphism(const std::vector<unsigned int>& perm) const
+ */
+ bool is_automorphism(const std::vector<unsigned int>& perm) const;
+
+
+
+ /**
+ * \copydoc AbstractGraph::get_hash()
+ */
+ virtual unsigned int get_hash();
+
+ /**
+ * Return the number of vertices in the graph.
+ */
+ unsigned int get_nof_vertices() const {return vertices.size(); }
+
+ /**
+ * Add a new vertex with color 'color' in the graph and return its index.
+ */
+ unsigned int add_vertex(const unsigned int color = 0);
+
+ /**
+ * Add an edge from the vertex \a source to the vertex \a target.
+ * Duplicate edges are ignored but try to avoid introducing
+ * them in the first place as they are not ignored immediately but will
+ * consume memory and computation resources for a while.
+ */
+ void add_edge(const unsigned int source, const unsigned int target);
+
+ /**
+ * Change the color of the vertex 'vertex' to 'color'.
+ */
+ void change_color(const unsigned int vertex, const unsigned int color);
+
+ /**
+ * Compare this graph with the graph \a other.
+ * Returns 0 if the graphs are equal, and a negative (positive) integer
+ * if this graph is "smaller than" ("greater than", resp.) than \a other.
+ */
+ int cmp(Digraph& other);
+
+ /**
+ * Set the splitting heuristic used by the automorphism and canonical
+ * labeling algorithm.
+ * The selected splitting heuristics affects the computed canonical
+ * labelings; therefore, if you want to compare whether two graphs
+ * are isomorphic by computing and comparing (for equality) their
+ * canonical versions, be sure to use the same splitting heuristics
+ * for both graphs.
+ */
+ void set_splitting_heuristic(SplittingHeuristic shs) {sh = shs; }
+
+ /**
+ * \copydoc AbstractGraph::permute(const unsigned int* const perm) const
+ */
+ Digraph* permute(const unsigned int* const perm) const;
+ Digraph* permute(const std::vector<unsigned int>& perm) const;
+};
+
+
+
+
+}
+
+#endif
diff --git a/src/bliss/heap.hh b/src/bliss/heap.hh
new file mode 100644
index 0000000..cf65913
--- /dev/null
+++ b/src/bliss/heap.hh
@@ -0,0 +1,83 @@
+#ifndef BLISS_HEAP_HH
+#define BLISS_HEAP_HH
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+/** \internal
+ * \brief A capacity bounded heap data structure.
+ */
+
+class Heap
+{
+ unsigned int N;
+ unsigned int n;
+ unsigned int *array;
+ void upheap(unsigned int k);
+ void downheap(unsigned int k);
+public:
+ /**
+ * Create a new heap.
+ * init() must be called after this.
+ */
+ Heap() {array = 0; n = 0; N = 0; }
+ ~Heap();
+
+ /**
+ * Initialize the heap to have the capacity to hold \e size elements.
+ */
+ void init(const unsigned int size);
+
+ /**
+ * Is the heap empty?
+ * Time complexity is O(1).
+ */
+ bool is_empty() const {return(n==0); }
+
+ /**
+ * Remove all the elements in the heap.
+ * Time complexity is O(1).
+ */
+ void clear() {n = 0;}
+
+ /**
+ * Insert the element \a e in the heap.
+ * Time complexity is O(log(N)), where N is the number of elements
+ * currently in the heap.
+ */
+ void insert(const unsigned int e);
+
+ /**
+ * Remove and return the smallest element in the heap.
+ * Time complexity is O(log(N)), where N is the number of elements
+ * currently in the heap.
+ */
+ unsigned int remove();
+
+ /**
+ * Get the number of elements in the heap.
+ */
+ unsigned int size() const {return n; }
+};
+
+} // namespace bliss
+
+#endif
diff --git a/src/bliss/igraph-changes.md b/src/bliss/igraph-changes.md
new file mode 100644
index 0000000..32df7c9
--- /dev/null
+++ b/src/bliss/igraph-changes.md
@@ -0,0 +1,36 @@
+This file lists changes that were made to the original Bliss package (version 0.73) to integrate it into igraph.
+
+Remove `Makefile`, `Doxyfile`
+
+Removed `bliss.cc`, `bliss_C.cc`, `bliss_C.h`
+
+Remove references to `Timer` class in `graph.cc`
+
+Remove `timer.cc` and `timer.hh`
+
+Add to `defs.hh`:
+
+ #include "config.h"
+
+ #if HAVE_GMP == 1
+ # define BLISS_USE_GMP
+ #endif
+
+In `bignum.hh`:
+
+Move `#if defined(BLISS_USE_GMP) ...` below `#include "defs.h"`
+
+Add:
+
+ #include "igraph_memory.h"
+ #include "igraph_error.h"
+
+Also add, for the `tostring` method without GMP:
+
+ #include <cmath>
+ #include <cstring>
+ #include <sstream>
+
+Add `tostring` member function to `BigNum` class for both cases (with or without GMP).
+
+In `graph.cc`, add IGRAPH_THREAD_LOCAL to the `PathInfo` global variable on line 612.
diff --git a/src/bliss_kqueue.hh b/src/bliss/kqueue.hh
similarity index 51%
rename from src/bliss_kqueue.hh
rename to src/bliss/kqueue.hh
index eabf856..41a4b70 100644
--- a/src/bliss_kqueue.hh
+++ b/src/bliss/kqueue.hh
@@ -1,50 +1,72 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
+#ifndef BLISS_KQUEUE_HH
+#define BLISS_KQUEUE_HH
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
*/
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_KQUEUE_HH
-#define BLISS_KQUEUE_HH
-
-#include "bliss_defs.hh"
-#include <cstdlib> // malloc
+#include "defs.hh"
-namespace igraph {
+namespace bliss {
-/*
- * A queue with fixed capacity
+/** \internal
+ * \brief A very simple implementation of queues with fixed capacity.
*/
+
template <class Type>
class KQueue
{
public:
+ /**
+ * Create a new queue with capacity zero.
+ * The function init() should be called next.
+ */
KQueue();
+
~KQueue();
- void init(const unsigned int k);
+
+ /**
+ * Initialize the queue to have the capacity to hold at most \a N elements.
+ */
+ void init(const unsigned int N);
+ /** Is the queue empty? */
bool is_empty() const;
+
+ /** Return the number of elements in the queue. */
unsigned int size() const;
- unsigned int capacity() const;
+
+ /** Remove all the elements in the queue. */
void clear();
+ /** Return (but don't remove) the first element in the queue. */
Type front() const;
+
+ /** Remove and return the first element of the queue. */
Type pop_front();
+
+ /** Push the element \a e in the front of the queue. */
void push_front(Type e);
+
+ /** Remove and return the last element of the queue. */
Type pop_back();
+
+ /** Push the element \a e in the back of the queue. */
void push_back(Type e);
private:
Type *entries, *end;
@@ -103,14 +125,12 @@ unsigned int KQueue<Type>::size() const
template <class Type>
Type KQueue<Type>::front() const
{
- DEBUG_ASSERT(head != tail);
return *head;
}
template <class Type>
Type KQueue<Type>::pop_front()
{
- DEBUG_ASSERT(head != tail);
Type *old_head = head;
head++;
if(head == end)
@@ -125,7 +145,6 @@ void KQueue<Type>::push_front(Type e)
head = end - 1;
else
head--;
- DEBUG_ASSERT(head != tail);
*head = e;
}
@@ -136,9 +155,8 @@ void KQueue<Type>::push_back(Type e)
tail++;
if(tail == end)
tail = entries;
- DEBUG_ASSERT(head != tail);
}
-}
+} // namespace bliss
#endif
diff --git a/src/bliss/kstack.hh b/src/bliss/kstack.hh
new file mode 100644
index 0000000..08493a0
--- /dev/null
+++ b/src/bliss/kstack.hh
@@ -0,0 +1,141 @@
+#ifndef BLISS_KSTACK_H
+#define BLISS_KSTACK_H
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include <cstdlib>
+#include "defs.hh"
+
+namespace bliss {
+
+/** \internal
+ * \brief A very simple implementation of a stack with fixed capacity.
+ */
+template <class Type>
+class KStack {
+public:
+ /**
+ * Create a new stack with zero capacity.
+ * The function init() should be called next.
+ */
+ KStack();
+
+ /**
+ * Create a new stack with the capacity to hold at most \a N elements.
+ */
+ KStack(int N);
+
+ ~KStack();
+
+ /**
+ * Initialize the stack to have the capacity to hold at most \a N elements.
+ */
+ void init(int N);
+
+ /**
+ * Is the stack empty?
+ */
+ bool is_empty() const {return(cursor == entries); }
+
+ /**
+ * Return (but don't remove) the top element of the stack.
+ */
+ Type top() const {BLISS_ASSERT(cursor > entries); return *cursor; }
+
+ /**
+ * Pop (remove) the top element of the stack.
+ */
+ Type pop()
+ {
+ return *cursor--;
+ }
+
+ /**
+ * Push the element \a e in the stack.
+ */
+ void push(Type e)
+ {
+ *(++cursor) = e;
+ }
+
+ /** Remove all the elements in the stack. */
+ void clean() {cursor = entries; }
+
+ /**
+ * Get the number of elements in the stack.
+ */
+ unsigned int size() const {return(cursor - entries); }
+
+ /**
+ * Return the i:th element in the stack, where \a i is in the range
+ * 0,...,this.size()-1; the 0:th element is the bottom element
+ * in the stack.
+ */
+ Type element_at(unsigned int i)
+ {
+ assert(i < size());
+ return entries[i+1];
+ }
+
+ /** Return the capacity (NOT the number of elements) of the stack. */
+ int capacity() {return kapacity; }
+private:
+ int kapacity;
+ Type *entries;
+ Type *cursor;
+};
+
+template <class Type>
+KStack<Type>::KStack()
+{
+ kapacity = 0;
+ entries = 0;
+ cursor = 0;
+}
+
+template <class Type>
+KStack<Type>::KStack(int k)
+{
+ assert(k > 0);
+ kapacity = k;
+ entries = (Type*)malloc((k+1) * sizeof(Type));
+ cursor = entries;
+}
+
+template <class Type>
+void KStack<Type>::init(int k)
+{
+ assert(k > 0);
+ if(entries)
+ free(entries);
+ kapacity = k;
+ entries = (Type*)malloc((k+1) * sizeof(Type));
+ cursor = entries;
+}
+
+template <class Type>
+KStack<Type>::~KStack()
+{
+ free(entries);
+}
+
+} // namespace bliss
+
+#endif
diff --git a/src/bliss_orbit.cc b/src/bliss/orbit.cc
similarity index 59%
rename from src/bliss_orbit.cc
rename to src/bliss/orbit.cc
index 1c19459..9d6d706 100644
--- a/src/bliss_orbit.cc
+++ b/src/bliss/orbit.cc
@@ -1,30 +1,28 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
+#include <stdlib.h>
+#include <assert.h>
+#include "defs.hh"
+#include "orbit.hh"
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
*/
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include <cstdlib>
-#include <cassert>
-#include "bliss_defs.hh"
-#include "bliss_orbit.hh"
-
-using namespace std;
-
-namespace igraph {
+namespace bliss {
Orbit::Orbit()
{
@@ -81,9 +79,6 @@ void Orbit::reset()
void Orbit::merge_orbits(OrbitEntry *orbit1, OrbitEntry *orbit2)
{
- DEBUG_ASSERT((orbit1 == orbit2) == (orbit1->element == orbit2->element));
- DEBUG_ASSERT(orbit1->element < nof_elements);
- DEBUG_ASSERT(orbit2->element < nof_elements);
if(orbit1 != orbit2)
{
@@ -119,35 +114,31 @@ void Orbit::merge_orbits(OrbitEntry *orbit1, OrbitEntry *orbit2)
void Orbit::merge_orbits(unsigned int e1, unsigned int e2)
{
- DEBUG_ASSERT(e1 < nof_elements);
- DEBUG_ASSERT(e2 < nof_elements);
merge_orbits(in_orbit[e1], in_orbit[e2]);
}
-bool Orbit::is_minimal_representative(unsigned int element)
+bool Orbit::is_minimal_representative(unsigned int element) const
{
return(get_minimal_representative(element) == element);
}
-unsigned int Orbit::get_minimal_representative(unsigned int element)
+unsigned int Orbit::get_minimal_representative(unsigned int element) const
{
- DEBUG_ASSERT(element < nof_elements);
OrbitEntry * const orbit = in_orbit[element];
- DEBUG_ASSERT(orbit->element <= element);
return(orbit->element);
}
-unsigned int Orbit::orbit_size(unsigned int element)
+unsigned int Orbit::orbit_size(unsigned int element) const
{
- DEBUG_ASSERT(element < nof_elements);
return(in_orbit[element]->size);
}
-}
+
+} // namespace bliss
diff --git a/src/bliss/orbit.hh b/src/bliss/orbit.hh
new file mode 100644
index 0000000..fa1be12
--- /dev/null
+++ b/src/bliss/orbit.hh
@@ -0,0 +1,111 @@
+#ifndef BLISS_ORBIT_HH
+#define BLISS_ORBIT_HH
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+/** \internal
+ * \brief A class for representing orbit information.
+ *
+ * Given a set {0,...,N-1} of N elements, represent equivalence
+ * classes (that is, unordered partitions) of the elements.
+ * Supports only equivalence class merging, not splitting.
+ * Merging two classes requires time O(k), where k is the number of
+ * the elements in the smaller of the merged classes.
+ * Getting the smallest representative in a class (and thus testing
+ * whether two elements belong to the same class) is a constant time operation.
+ */
+class Orbit
+{
+ class OrbitEntry
+ {
+ public:
+ unsigned int element;
+ OrbitEntry *next;
+ unsigned int size;
+ };
+
+ OrbitEntry *orbits;
+ OrbitEntry **in_orbit;
+ unsigned int nof_elements;
+ unsigned int _nof_orbits;
+ void merge_orbits(OrbitEntry *o1, OrbitEntry *o2);
+
+public:
+ /**
+ * Create a new orbit information object.
+ * The init() function must be called next to actually initialize
+ * the object.
+ */
+ Orbit();
+ ~Orbit();
+
+ /**
+ * Initialize the orbit information to consider sets of \a N elements.
+ * It is required that \a N > 0.
+ * The orbit information is reset so that each element forms
+ * an orbit of its own.
+ * Time complexity is O(N).
+ * \sa reset()
+ */
+ void init(const unsigned int N);
+
+ /**
+ * Reset the orbits so that each element forms an orbit of its own.
+ * Time complexity is O(N).
+ */
+ void reset();
+
+ /**
+ * Merge the orbits of the elements \a e1 and \a e2.
+ * Time complexity is O(k), where k is the number of elements in
+ * the smaller of the merged orbits.
+ */
+ void merge_orbits(unsigned int e1, unsigned int e2);
+
+ /**
+ * Is the element \a e the smallest element in its orbit?
+ * Time complexity is O(1).
+ */
+ bool is_minimal_representative(unsigned int e) const;
+
+ /**
+ * Get the smallest element in the orbit of the element \a e.
+ * Time complexity is O(1).
+ */
+ unsigned int get_minimal_representative(unsigned int e) const;
+
+ /**
+ * Get the number of elements in the orbit of the element \a e.
+ * Time complexity is O(1).
+ */
+ unsigned int orbit_size(unsigned int e) const;
+
+ /**
+ * Get the number of orbits.
+ * Time complexity is O(1).
+ */
+ unsigned int nof_orbits() const {return _nof_orbits; }
+};
+
+} // namespace bliss
+
+#endif
diff --git a/src/bliss/partition.cc b/src/bliss/partition.cc
new file mode 100644
index 0000000..5dcbe16
--- /dev/null
+++ b/src/bliss/partition.cc
@@ -0,0 +1,1143 @@
+#include <assert.h>
+#include <vector>
+#include <list>
+#include "graph.hh"
+#include "partition.hh"
+
+/* use 'and' instead of '&&' */
+#if _MSC_VER
+#include <ciso646>
+#endif
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+Partition::Partition()
+{
+ N = 0;
+ elements = 0;
+ in_pos = 0;
+ invariant_values = 0;
+ cells = 0;
+ free_cells = 0;
+ element_to_cell_map = 0;
+ graph = 0;
+ discrete_cell_count = 0;
+ /* Initialize a distribution count sorting array. */
+ for(unsigned int i = 0; i < 256; i++)
+ dcs_count[i] = 0;
+
+ cr_enabled = false;
+ cr_cells = 0;
+ cr_levels = 0;
+}
+
+
+
+Partition::~Partition()
+{
+ if(elements) {free(elements); elements = 0; }
+ if(cells) {free(cells); cells = 0; }
+ if(element_to_cell_map) {free(element_to_cell_map); element_to_cell_map = 0; }
+ if(in_pos) {free(in_pos); in_pos = 0; }
+ if(invariant_values) {free(invariant_values); invariant_values = 0; }
+ N = 0;
+}
+
+
+
+void Partition::init(const unsigned int M)
+{
+ assert(M > 0);
+ N = M;
+
+ if(elements)
+ free(elements);
+ elements = (unsigned int*)malloc(N * sizeof(unsigned int));
+ for(unsigned int i = 0; i < N; i++)
+ elements[i] = i;
+
+ if(in_pos)
+ free(in_pos);
+ in_pos = (unsigned int**)malloc(N * sizeof(unsigned int*));
+ for(unsigned int i = 0; i < N; i++)
+ in_pos[i] = elements + i;
+
+ if(invariant_values)
+ free(invariant_values);
+ invariant_values = (unsigned int*)malloc(N * sizeof(unsigned int));
+ for(unsigned int i = 0; i < N; i++)
+ invariant_values[i] = 0;
+
+ if(cells)
+ free(cells);
+ cells = (Cell*)malloc(N * sizeof(Cell));
+
+ cells[0].first = 0;
+ cells[0].length = N;
+ cells[0].max_ival = 0;
+ cells[0].max_ival_count = 0;
+ cells[0].in_splitting_queue = false;
+ cells[0].in_neighbour_heap = false;
+ cells[0].prev = 0;
+ cells[0].next = 0;
+ cells[0].next_nonsingleton = 0;
+ cells[0].prev_nonsingleton = 0;
+ cells[0].split_level = 0;
+ first_cell = &cells[0];
+ if(N == 1)
+ {
+ first_nonsingleton_cell = 0;
+ discrete_cell_count = 1;
+ }
+ else
+ {
+ first_nonsingleton_cell = &cells[0];
+ discrete_cell_count = 0;
+ }
+
+ for(unsigned int i = 1; i < N; i++)
+ {
+ cells[i].first = 0;
+ cells[i].length = 0;
+ cells[i].max_ival = 0;
+ cells[i].max_ival_count = 0;
+ cells[i].in_splitting_queue = false;
+ cells[i].in_neighbour_heap = false;
+ cells[i].prev = 0;
+ cells[i].next = (i < N-1)?&cells[i+1]:0;
+ cells[i].next_nonsingleton = 0;
+ cells[i].prev_nonsingleton = 0;
+ }
+ if(N > 1)
+ free_cells = &cells[1];
+ else
+ free_cells = 0;
+
+ if(element_to_cell_map)
+ free(element_to_cell_map);
+ element_to_cell_map = (Cell **)malloc(N * sizeof(Cell *));
+ for(unsigned int i = 0; i < N; i++)
+ element_to_cell_map[i] = first_cell;
+
+ splitting_queue.init(N);
+ refinement_stack.init(N);
+
+ /* Reset the main backtracking stack */
+ bt_stack.clear();
+}
+
+
+
+
+
+
+Partition::BacktrackPoint
+Partition::set_backtrack_point()
+{
+ BacktrackInfo info;
+ info.refinement_stack_size = refinement_stack.size();
+ if(cr_enabled)
+ info.cr_backtrack_point = cr_get_backtrack_point();
+ BacktrackPoint p = bt_stack.size();
+ bt_stack.push_back(info);
+ return p;
+}
+
+
+
+void
+Partition::goto_backtrack_point(BacktrackPoint p)
+{
+ BacktrackInfo info = bt_stack[p];
+ bt_stack.resize(p);
+
+ if(cr_enabled)
+ cr_goto_backtrack_point(info.cr_backtrack_point);
+
+ const unsigned int dest_refinement_stack_size = info.refinement_stack_size;
+
+ assert(refinement_stack.size() >= dest_refinement_stack_size);
+ while(refinement_stack.size() > dest_refinement_stack_size)
+ {
+ RefInfo i = refinement_stack.pop();
+ const unsigned int first = i.split_cell_first;
+ Cell* cell = get_cell(elements[first]);
+
+ if(cell->first != first)
+ {
+ assert(cell->first < first);
+ assert(cell->split_level <= dest_refinement_stack_size);
+ goto done;
+ }
+ assert(cell->split_level > dest_refinement_stack_size);
+
+ while(cell->split_level > dest_refinement_stack_size)
+ {
+ assert(cell->prev);
+ cell = cell->prev;
+ }
+ while(cell->next and
+ cell->next->split_level > dest_refinement_stack_size)
+ {
+ /* Merge next cell */
+ Cell* const next_cell = cell->next;
+ if(cell->length == 1)
+ discrete_cell_count--;
+ if(next_cell->length == 1)
+ discrete_cell_count--;
+ /* Update element_to_cell_map values of elements added in cell */
+ unsigned int* ep = elements + next_cell->first;
+ unsigned int* const lp = ep + next_cell->length;
+ for( ; ep < lp; ep++)
+ element_to_cell_map[*ep] = cell;
+ /* Update cell parameters */
+ cell->length += next_cell->length;
+ if(next_cell->next)
+ next_cell->next->prev = cell;
+ cell->next = next_cell->next;
+ /* (Pseudo)free next_cell */
+ next_cell->first = 0;
+ next_cell->length = 0;
+ next_cell->prev = 0;
+ next_cell->next = free_cells;
+ free_cells = next_cell;
+ }
+
+ done:
+ if(i.prev_nonsingleton_first >= 0)
+ {
+ Cell* const prev_cell = get_cell(elements[i.prev_nonsingleton_first]);
+ cell->prev_nonsingleton = prev_cell;
+ prev_cell->next_nonsingleton = cell;
+ }
+ else
+ {
+ //assert(cell->prev_nonsingleton == 0);
+ cell->prev_nonsingleton = 0;
+ first_nonsingleton_cell = cell;
+ }
+
+ if(i.next_nonsingleton_first >= 0)
+ {
+ Cell* const next_cell = get_cell(elements[i.next_nonsingleton_first]);
+ cell->next_nonsingleton = next_cell;
+ next_cell->prev_nonsingleton = cell;
+ }
+ else
+ {
+ //assert(cell->next_nonsingleton == 0);
+ cell->next_nonsingleton = 0;
+ }
+ }
+
+}
+
+
+
+Partition::Cell*
+Partition::individualize(Partition::Cell * const cell,
+ const unsigned int element)
+{
+
+ unsigned int * const pos = in_pos[element];
+
+ const unsigned int last = cell->first + cell->length - 1;
+ *pos = elements[last];
+ in_pos[*pos] = pos;
+ elements[last] = element;
+ in_pos[element] = elements + last;
+
+ Partition::Cell * const new_cell = aux_split_in_two(cell, cell->length-1);
+ element_to_cell_map[element] = new_cell;
+
+ return new_cell;
+}
+
+
+
+Partition::Cell*
+Partition::aux_split_in_two(Partition::Cell* const cell,
+ const unsigned int first_half_size)
+{
+ RefInfo i;
+
+
+ /* (Pseudo)allocate new cell */
+ Cell * const new_cell = free_cells;
+ free_cells = new_cell->next;
+ /* Update new cell parameters */
+ new_cell->first = cell->first + first_half_size;
+ new_cell->length = cell->length - first_half_size;
+ new_cell->next = cell->next;
+ if(new_cell->next)
+ new_cell->next->prev = new_cell;
+ new_cell->prev = cell;
+ new_cell->split_level = refinement_stack.size()+1;
+ /* Update old, splitted cell parameters */
+ cell->length = first_half_size;
+ cell->next = new_cell;
+ /* CR */
+ if(cr_enabled)
+ cr_create_at_level_trailed(new_cell->first, cr_get_level(cell->first));
+
+ /* Add cell in refinement_stack for backtracking */
+ i.split_cell_first = new_cell->first;
+ if(cell->prev_nonsingleton)
+ i.prev_nonsingleton_first = cell->prev_nonsingleton->first;
+ else
+ i.prev_nonsingleton_first = -1;
+ if(cell->next_nonsingleton)
+ i.next_nonsingleton_first = cell->next_nonsingleton->first;
+ else
+ i.next_nonsingleton_first = -1;
+ refinement_stack.push(i);
+
+ /* Modify nonsingleton cell list */
+ if(new_cell->length > 1)
+ {
+ new_cell->prev_nonsingleton = cell;
+ new_cell->next_nonsingleton = cell->next_nonsingleton;
+ if(new_cell->next_nonsingleton)
+ new_cell->next_nonsingleton->prev_nonsingleton = new_cell;
+ cell->next_nonsingleton = new_cell;
+ }
+ else
+ {
+ new_cell->next_nonsingleton = 0;
+ new_cell->prev_nonsingleton = 0;
+ discrete_cell_count++;
+ }
+
+ if(cell->is_unit())
+ {
+ if(cell->prev_nonsingleton)
+ cell->prev_nonsingleton->next_nonsingleton = cell->next_nonsingleton;
+ else
+ first_nonsingleton_cell = cell->next_nonsingleton;
+ if(cell->next_nonsingleton)
+ cell->next_nonsingleton->prev_nonsingleton = cell->prev_nonsingleton;
+ cell->next_nonsingleton = 0;
+ cell->prev_nonsingleton = 0;
+ discrete_cell_count++;
+ }
+
+ return new_cell;
+}
+
+
+
+size_t
+Partition::print(FILE* const fp, const bool add_newline) const
+{
+ size_t r = 0;
+ const char* cell_sep = "";
+ r += fprintf(fp, "[");
+ for(Cell* cell = first_cell; cell; cell = cell->next)
+ {
+ /* Print cell */
+ r += fprintf(fp, "%s{", cell_sep);
+ cell_sep = ",";
+ const char* elem_sep = "";
+ for(unsigned int i = 0; i < cell->length; i++)
+ {
+ r += fprintf(fp, "%s%u", elem_sep, elements[cell->first + i]);
+ elem_sep = ",";
+ }
+ r += fprintf(fp, "}");
+ }
+ r += fprintf(fp, "]");
+ if(add_newline) r += fprintf(fp, "\n");
+ return r;
+}
+
+
+
+size_t
+Partition::print_signature(FILE* const fp, const bool add_newline) const
+{
+ size_t r = 0;
+ const char* cell_sep = "";
+ r += fprintf(fp, "[");
+ for(Cell* cell = first_cell; cell; cell = cell->next)
+ {
+ if(cell->is_unit()) continue;
+ //fprintf(fp, "%s%u", cell_sep, cr_cells[cell->first].level);
+ r += fprintf(fp, "%s%u", cell_sep, cell->length);
+ cell_sep = ",";
+ }
+ r += fprintf(fp, "]");
+ if(add_newline) r += fprintf(fp, "\n");
+ return r;
+}
+
+
+
+void
+Partition::splitting_queue_add(Cell* const cell)
+{
+ static const unsigned int smallish_cell_threshold = 1;
+ cell->in_splitting_queue = true;
+ if(cell->length <= smallish_cell_threshold)
+ splitting_queue.push_front(cell);
+ else
+ splitting_queue.push_back(cell);
+}
+
+
+
+void
+Partition::splitting_queue_clear()
+{
+ while(!splitting_queue_is_empty())
+ splitting_queue_pop();
+}
+
+
+
+
+
+/*
+ * Assumes that the invariant values are NOT the same
+ * and that the cell contains more than one element
+ */
+Partition::Cell*
+Partition::sort_and_split_cell1(Partition::Cell* const cell)
+{
+#if defined(BLISS_EXPENSIVE_CONSISTENCY_CHECKS)
+ assert(cell->length > 1);
+ assert(cell->first + cell->length <= N);
+ unsigned int nof_0_found = 0;
+ unsigned int nof_1_found = 0;
+ for(unsigned int i = cell->first; i < cell->first + cell->length; i++)
+ {
+ const unsigned int ival = invariant_values[elements[i]];
+ assert(ival == 0 or ival == 1);
+ if(ival == 0) nof_0_found++;
+ else nof_1_found++;
+ }
+ assert(nof_0_found > 0);
+ assert(nof_1_found > 0);
+ assert(nof_1_found == cell->max_ival_count);
+ assert(nof_0_found + nof_1_found == cell->length);
+ assert(cell->max_ival == 1);
+#endif
+
+
+ /* (Pseudo)allocate new cell */
+ Cell* const new_cell = free_cells;
+ free_cells = new_cell->next;
+
+#define NEW_SORT1
+#ifdef NEW_SORT1
+ unsigned int *ep0 = elements + cell->first;
+ unsigned int *ep1 = ep0 + cell->length - cell->max_ival_count;
+ if(cell->max_ival_count > cell->length / 2)
+ {
+ /* There are more ones than zeros, only move zeros */
+ unsigned int * const end = ep0 + cell->length;
+ while(ep1 < end)
+ {
+ while(invariant_values[*ep1] == 0)
+ {
+ const unsigned int tmp = *ep1;
+ *ep1 = *ep0;
+ *ep0 = tmp;
+ in_pos[tmp] = ep0;
+ in_pos[*ep1] = ep1;
+ ep0++;
+ }
+ element_to_cell_map[*ep1] = new_cell;
+ invariant_values[*ep1] = 0;
+ ep1++;
+ }
+ }
+ else
+ {
+ /* There are more zeros than ones, only move ones */
+ unsigned int * const end = ep1;
+ while(ep0 < end)
+ {
+ while(invariant_values[*ep0] != 0)
+ {
+ const unsigned int tmp = *ep0;
+ *ep0 = *ep1;
+ *ep1 = tmp;
+ in_pos[tmp] = ep1;
+ in_pos[*ep0] = ep0;
+ ep1++;
+ }
+ ep0++;
+ }
+ ep1 = end;
+ while(ep1 < elements + cell->first + cell->length)
+ {
+ element_to_cell_map[*ep1] = new_cell;
+ invariant_values[*ep1] = 0;
+ ep1++;
+ }
+ }
+ /* Update new cell parameters */
+ new_cell->first = cell->first + cell->length - cell->max_ival_count;
+ new_cell->length = cell->length - (new_cell->first - cell->first);
+ new_cell->next = cell->next;
+ if(new_cell->next)
+ new_cell->next->prev = new_cell;
+ new_cell->prev = cell;
+ new_cell->split_level = refinement_stack.size()+1;
+ /* Update old, splitted cell parameters */
+ cell->length = new_cell->first - cell->first;
+ cell->next = new_cell;
+ /* CR */
+ if(cr_enabled)
+ cr_create_at_level_trailed(new_cell->first, cr_get_level(cell->first));
+
+#else
+ /* Sort vertices in the cell according to the invariant values */
+ unsigned int *ep0 = elements + cell->first;
+ unsigned int *ep1 = ep0 + cell->length;
+ while(ep1 > ep0)
+ {
+ const unsigned int element = *ep0;
+ const unsigned int ival = invariant_values[element];
+ invariant_values[element] = 0;
+ if(ival == 0)
+ {
+ ep0++;
+ }
+ else
+ {
+ ep1--;
+ *ep0 = *ep1;
+ *ep1 = element;
+ element_to_cell_map[element] = new_cell;
+ in_pos[element] = ep1;
+ in_pos[*ep0] = ep0;
+ }
+ }
+
+
+ /* Update new cell parameters */
+ new_cell->first = ep1 - elements;
+ new_cell->length = cell->length - (new_cell->first - cell->first);
+ new_cell->next = cell->next;
+ if(new_cell->next)
+ new_cell->next->prev = new_cell;
+ new_cell->prev = cell;
+ new_cell->split_level = cell->split_level;
+ /* Update old, splitted cell parameters */
+ cell->length = new_cell->first - cell->first;
+ cell->next = new_cell;
+ cell->split_level = refinement_stack.size()+1;
+ /* CR */
+ if(cr_enabled)
+ cr_create_at_level_trailed(new_cell->first, cr_get_level(cell->first));
+
+#endif /* ifdef NEW_SORT1*/
+
+ /* Add cell in refinement stack for backtracking */
+ {
+ RefInfo i;
+ i.split_cell_first = new_cell->first;
+ if(cell->prev_nonsingleton)
+ i.prev_nonsingleton_first = cell->prev_nonsingleton->first;
+ else
+ i.prev_nonsingleton_first = -1;
+ if(cell->next_nonsingleton)
+ i.next_nonsingleton_first = cell->next_nonsingleton->first;
+ else
+ i.next_nonsingleton_first = -1;
+ /* Modify nonsingleton cell list */
+ if(new_cell->length > 1)
+ {
+ new_cell->prev_nonsingleton = cell;
+ new_cell->next_nonsingleton = cell->next_nonsingleton;
+ if(new_cell->next_nonsingleton)
+ new_cell->next_nonsingleton->prev_nonsingleton = new_cell;
+ cell->next_nonsingleton = new_cell;
+ }
+ else
+ {
+ new_cell->next_nonsingleton = 0;
+ new_cell->prev_nonsingleton = 0;
+ discrete_cell_count++;
+ }
+ if(cell->is_unit())
+ {
+ if(cell->prev_nonsingleton)
+ cell->prev_nonsingleton->next_nonsingleton = cell->next_nonsingleton;
+ else
+ first_nonsingleton_cell = cell->next_nonsingleton;
+ if(cell->next_nonsingleton)
+ cell->next_nonsingleton->prev_nonsingleton = cell->prev_nonsingleton;
+ cell->next_nonsingleton = 0;
+ cell->prev_nonsingleton = 0;
+ discrete_cell_count++;
+ }
+ refinement_stack.push(i);
+ }
+
+
+ /* Add cells in splitting queue */
+ if(cell->in_splitting_queue) {
+ /* Both cells must be included in splitting_queue in order to have
+ refinement to equitable partition */
+ splitting_queue_add(new_cell);
+ } else {
+ Cell *min_cell, *max_cell;
+ if(cell->length <= new_cell->length) {
+ min_cell = cell;
+ max_cell = new_cell;
+ } else {
+ min_cell = new_cell;
+ max_cell = cell;
+ }
+ /* Put the smaller cell in splitting_queue */
+ splitting_queue_add(min_cell);
+ if(max_cell->is_unit()) {
+ /* Put the "larger" cell also in splitting_queue */
+ splitting_queue_add(max_cell);
+ }
+ }
+
+
+ return new_cell;
+}
+
+
+
+
+
+/**
+ * An auxiliary function for distribution count sorting.
+ * Build start array so that
+ * dcs_start[0] = 0 and dcs_start[i+1] = dcs_start[i] + dcs_count[i].
+ */
+void
+Partition::dcs_cumulate_count(const unsigned int max)
+{
+ unsigned int* count_p = dcs_count;
+ unsigned int* start_p = dcs_start;
+ unsigned int sum = 0;
+ for(unsigned int i = max+1; i > 0; i--)
+ {
+ *start_p = sum;
+ start_p++;
+ sum += *count_p;
+ count_p++;
+ }
+}
+
+
+/**
+ * Distribution count sorting of cells with invariant values less than 256.
+ */
+Partition::Cell*
+Partition::sort_and_split_cell255(Partition::Cell* const cell,
+ const unsigned int max_ival)
+{
+
+ if(cell->is_unit())
+ {
+ /* Reset invariant value */
+ invariant_values[elements[cell->first]] = 0;
+ return cell;
+ }
+
+#ifdef BLISS_CONSISTENCY_CHECKS
+ for(unsigned int i = 0; i < 256; i++)
+ assert(dcs_count[i] == 0);
+#endif
+
+ /*
+ * Compute the distribution of invariant values to the count array
+ */
+ {
+ const unsigned int *ep = elements + cell->first;
+ const unsigned int ival = invariant_values[*ep];
+ dcs_count[ival]++;
+ ep++;
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ bool equal_invariant_values = true;
+#endif
+ for(unsigned int i = cell->length - 1; i != 0; i--)
+ {
+ const unsigned int ival2 = invariant_values[*ep];
+ dcs_count[ival2]++;
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ if(ival2 != ival) {
+ equal_invariant_values = false;
+ }
+#endif
+ ep++;
+ }
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ assert(!equal_invariant_values);
+ if(equal_invariant_values) {
+ assert(dcs_count[ival] == cell->length);
+ dcs_count[ival] = 0;
+ clear_ivs(cell);
+ return cell;
+ }
+#endif
+ }
+
+ /* Build start array */
+ dcs_cumulate_count(max_ival);
+
+
+ /* Do the sorting */
+ for(unsigned int i = 0; i <= max_ival; i++)
+ {
+ unsigned int *ep = elements + cell->first + dcs_start[i];
+ for(unsigned int j = dcs_count[i]; j > 0; j--)
+ {
+ while(true)
+ {
+ const unsigned int element = *ep;
+ const unsigned int ival = invariant_values[element];
+ if(ival == i)
+ break;
+ *ep = elements[cell->first + dcs_start[ival]];
+ elements[cell->first + dcs_start[ival]] = element;
+ dcs_start[ival]++;
+ dcs_count[ival]--;
+ }
+ ep++;
+ }
+ dcs_count[i] = 0;
+ }
+
+#if defined(BLISS_CONSISTENCY_CHECKS)
+ for(unsigned int i = 0; i < 256; i++)
+ assert(dcs_count[i] == 0);
+#endif
+
+ /* split cell */
+ Cell* const new_cell = split_cell(cell);
+ return new_cell;
+}
+
+
+
+/*
+ * Sort the elements in a cell according to their invariant values.
+ * The invariant values are not cleared.
+ * Warning: the in_pos array is left in incorrect state.
+ */
+bool
+Partition::shellsort_cell(Partition::Cell* const cell)
+{
+ unsigned int h;
+ unsigned int* ep;
+
+
+ if(cell->is_unit())
+ return false;
+
+ /* Check whether all the elements have the same invariant value */
+ bool equal_invariant_values = true;
+ {
+ ep = elements + cell->first;
+ const unsigned int ival = invariant_values[*ep];
+ ep++;
+ for(unsigned int i = cell->length - 1; i > 0; i--)
+ {
+ if(invariant_values[*ep] != ival) {
+ equal_invariant_values = false;
+ break;
+ }
+ ep++;
+ }
+ }
+ if(equal_invariant_values)
+ return false;
+
+ ep = elements + cell->first;
+
+ for(h = 1; h <= cell->length/9; h = 3*h + 1)
+ ;
+ for( ; h > 0; h = h/3) {
+ for(unsigned int i = h; i < cell->length; i++) {
+ const unsigned int element = ep[i];
+ const unsigned int ival = invariant_values[element];
+ unsigned int j = i;
+ while(j >= h and invariant_values[ep[j-h]] > ival) {
+ ep[j] = ep[j-h];
+ j -= h;
+ }
+ ep[j] = element;
+ }
+ }
+ return true;
+}
+
+
+
+void
+Partition::clear_ivs(Cell* const cell)
+{
+ unsigned int* ep = elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--, ep++)
+ invariant_values[*ep] = 0;
+}
+
+
+/*
+ * Assumes that the elements in the cell are sorted according to their
+ * invariant values.
+ */
+Partition::Cell*
+Partition::split_cell(Partition::Cell* const original_cell)
+{
+ Cell* cell = original_cell;
+ const bool original_cell_was_in_splitting_queue =
+ original_cell->in_splitting_queue;
+ Cell* largest_new_cell = 0;
+
+ while(true)
+ {
+ unsigned int* ep = elements + cell->first;
+ const unsigned int* const lp = ep + cell->length;
+ const unsigned int ival = invariant_values[*ep];
+ invariant_values[*ep] = 0;
+ element_to_cell_map[*ep] = cell;
+ in_pos[*ep] = ep;
+ ep++;
+ while(ep < lp)
+ {
+ const unsigned int e = *ep;
+ if(invariant_values[e] != ival)
+ break;
+ invariant_values[e] = 0;
+ in_pos[e] = ep;
+ ep++;
+ element_to_cell_map[e] = cell;
+ }
+ if(ep == lp)
+ break;
+
+ Cell* const new_cell = aux_split_in_two(cell,
+ (ep - elements) - cell->first);
+
+ if(graph and graph->compute_eqref_hash)
+ {
+ graph->eqref_hash.update(new_cell->first);
+ graph->eqref_hash.update(new_cell->length);
+ graph->eqref_hash.update(ival);
+ }
+
+ /* Add cells in splitting_queue */
+ assert(!new_cell->is_in_splitting_queue());
+ if(original_cell_was_in_splitting_queue)
+ {
+ /* In this case, all new cells are inserted in splitting_queue */
+ assert(cell->is_in_splitting_queue());
+ splitting_queue_add(new_cell);
+ }
+ else
+ {
+ /* Otherwise, we can omit one new cell from splitting_queue */
+ assert(!cell->is_in_splitting_queue());
+ if(largest_new_cell == 0) {
+ largest_new_cell = cell;
+ } else {
+ assert(!largest_new_cell->is_in_splitting_queue());
+ if(cell->length > largest_new_cell->length) {
+ splitting_queue_add(largest_new_cell);
+ largest_new_cell = cell;
+ } else {
+ splitting_queue_add(cell);
+ }
+ }
+ }
+ /* Process the rest of the cell */
+ cell = new_cell;
+ }
+
+
+ if(original_cell == cell) {
+ /* All the elements in cell had the same invariant value */
+ return cell;
+ }
+
+ /* Add cells in splitting_queue */
+ if(!original_cell_was_in_splitting_queue)
+ {
+ /* Also consider the last new cell */
+ assert(largest_new_cell);
+ if(cell->length > largest_new_cell->length)
+ {
+ splitting_queue_add(largest_new_cell);
+ largest_new_cell = cell;
+ }
+ else
+ {
+ splitting_queue_add(cell);
+ }
+ if(largest_new_cell->is_unit())
+ {
+ /* Needed in certificate computation */
+ splitting_queue_add(largest_new_cell);
+ }
+ }
+
+ return cell;
+}
+
+
+Partition::Cell*
+Partition::zplit_cell(Partition::Cell* const cell,
+ const bool max_ival_info_ok)
+{
+
+ Cell* last_new_cell = cell;
+
+ if(!max_ival_info_ok)
+ {
+ /* Compute max_ival info */
+ assert(cell->max_ival == 0);
+ assert(cell->max_ival_count == 0);
+ unsigned int *ep = elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--, ep++)
+ {
+ const unsigned int ival = invariant_values[*ep];
+ if(ival > cell->max_ival)
+ {
+ cell->max_ival = ival;
+ cell->max_ival_count = 1;
+ }
+ else if(ival == cell->max_ival)
+ {
+ cell->max_ival_count++;
+ }
+ }
+ }
+
+#ifdef BLISS_CONSISTENCY_CHECKS
+ /* Verify max_ival info */
+ {
+ unsigned int nof_zeros = 0;
+ unsigned int max_ival = 0;
+ unsigned int max_ival_count = 0;
+ unsigned int *ep = elements + cell->first;
+ for(unsigned int i = cell->length; i > 0; i--, ep++)
+ {
+ const unsigned int ival = invariant_values[*ep];
+ if(ival == 0)
+ nof_zeros++;
+ if(ival > max_ival)
+ {
+ max_ival = ival;
+ max_ival_count = 1;
+ }
+ else if(ival == max_ival)
+ max_ival_count++;
+ }
+ assert(max_ival == cell->max_ival);
+ assert(max_ival_count == cell->max_ival_count);
+ }
+#endif
+
+ /* max_ival info has been computed */
+
+ if(cell->max_ival_count == cell->length)
+ {
+ /* All invariant values are the same, clear 'em */
+ if(cell->max_ival > 0)
+ clear_ivs(cell);
+ }
+ else
+ {
+ /* All invariant values are not the same */
+ if(cell->max_ival == 1)
+ {
+ /* Specialized splitting for cells with binary invariant values */
+ last_new_cell = sort_and_split_cell1(cell);
+ }
+ else if(cell->max_ival < 256)
+ {
+ /* Specialized splitting for cells with invariant values < 256 */
+ last_new_cell = sort_and_split_cell255(cell, cell->max_ival);
+ }
+ else
+ {
+ /* Generic sorting and splitting */
+ const bool sorted = shellsort_cell(cell);
+ assert(sorted);
+ last_new_cell = split_cell(cell);
+ }
+ }
+ cell->max_ival = 0;
+ cell->max_ival_count = 0;
+ return last_new_cell;
+}
+
+
+
+/*
+ *
+ * Component recursion specific code
+ *
+ */
+void
+Partition::cr_init()
+{
+ assert(bt_stack.empty());
+
+ cr_enabled = true;
+
+ if(cr_cells) free(cr_cells);
+ cr_cells = (CRCell*)malloc(N * sizeof(CRCell));
+ if(!cr_cells) {assert(false && "Mem out"); }
+
+ if(cr_levels) free(cr_levels);
+ cr_levels = (CRCell**)malloc(N * sizeof(CRCell*));
+ if(!cr_levels) {assert(false && "Mem out"); }
+
+ for(unsigned int i = 0; i < N; i++) {
+ cr_levels[i] = 0;
+ cr_cells[i].level = UINT_MAX;
+ cr_cells[i].next = 0;
+ cr_cells[i].prev_next_ptr = 0;
+ }
+
+ for(const Cell *cell = first_cell; cell; cell = cell->next)
+ cr_create_at_level_trailed(cell->first, 0);
+
+ cr_max_level = 0;
+}
+
+
+void
+Partition::cr_free()
+{
+ if(cr_cells) {free(cr_cells); cr_cells = 0; }
+ if(cr_levels) {free(cr_levels); cr_levels = 0; }
+
+ cr_created_trail.clear();
+ cr_splitted_level_trail.clear();
+ cr_bt_info.clear();
+ cr_max_level = 0;
+
+ cr_enabled = false;
+}
+
+
+unsigned int
+Partition::cr_split_level(const unsigned int level,
+ const std::vector<unsigned int>& splitted_cells)
+{
+ assert(cr_enabled);
+ assert(level <= cr_max_level);
+ cr_levels[++cr_max_level] = 0;
+ cr_splitted_level_trail.push_back(level);
+
+ for(unsigned int i = 0; i < splitted_cells.size(); i++)
+ {
+ const unsigned int cell_index = splitted_cells[i];
+ assert(cell_index < N);
+ CRCell& cr_cell = cr_cells[cell_index];
+ assert(cr_cell.level == level);
+ cr_cell.detach();
+ cr_create_at_level(cell_index, cr_max_level);
+ }
+
+ return cr_max_level;
+}
+
+
+unsigned int
+Partition::cr_get_backtrack_point()
+{
+ assert(cr_enabled);
+ CR_BTInfo info;
+ info.created_trail_index = cr_created_trail.size();
+ info.splitted_level_trail_index = cr_splitted_level_trail.size();
+ cr_bt_info.push_back(info);
+ return cr_bt_info.size()-1;
+}
+
+
+void
+Partition::cr_goto_backtrack_point(const unsigned int btpoint)
+{
+ assert(cr_enabled);
+ assert(btpoint < cr_bt_info.size());
+ while(cr_created_trail.size() > cr_bt_info[btpoint].created_trail_index)
+ {
+ const unsigned int cell_index = cr_created_trail.back();
+ cr_created_trail.pop_back();
+ CRCell& cr_cell = cr_cells[cell_index];
+ assert(cr_cell.level != UINT_MAX);
+ assert(cr_cell.prev_next_ptr);
+ cr_cell.detach();
+ }
+
+ while(cr_splitted_level_trail.size() >
+ cr_bt_info[btpoint].splitted_level_trail_index)
+ {
+ const unsigned int dest_level = cr_splitted_level_trail.back();
+ cr_splitted_level_trail.pop_back();
+ assert(cr_max_level > 0);
+ assert(dest_level < cr_max_level);
+ while(cr_levels[cr_max_level]) {
+ CRCell *cr_cell = cr_levels[cr_max_level];
+ cr_cell->detach();
+ cr_create_at_level(cr_cell - cr_cells, dest_level);
+ }
+ cr_max_level--;
+ }
+ cr_bt_info.resize(btpoint);
+}
+
+
+void
+Partition::cr_create_at_level(const unsigned int cell_index,
+ const unsigned int level)
+{
+ assert(cr_enabled);
+ assert(cell_index < N);
+ assert(level < N);
+ CRCell& cr_cell = cr_cells[cell_index];
+ assert(cr_cell.level == UINT_MAX);
+ assert(cr_cell.next == 0);
+ assert(cr_cell.prev_next_ptr == 0);
+ if(cr_levels[level])
+ cr_levels[level]->prev_next_ptr = &(cr_cell.next);
+ cr_cell.next = cr_levels[level];
+ cr_levels[level] = &cr_cell;
+ cr_cell.prev_next_ptr = &cr_levels[level];
+ cr_cell.level = level;
+}
+
+
+void
+Partition::cr_create_at_level_trailed(const unsigned int cell_index,
+ const unsigned int level)
+{
+ assert(cr_enabled);
+ cr_create_at_level(cell_index, level);
+ cr_created_trail.push_back(cell_index);
+}
+
+
+} // namespace bliss
diff --git a/src/bliss/partition.hh b/src/bliss/partition.hh
new file mode 100644
index 0000000..6316f0c
--- /dev/null
+++ b/src/bliss/partition.hh
@@ -0,0 +1,308 @@
+#ifndef BLISS_PARTITION_HH
+#define BLISS_PARTITION_HH
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+ class Partition;
+}
+
+#include <cstdlib>
+#include <cstdio>
+#include <climits>
+#include "kstack.hh"
+#include "kqueue.hh"
+#include "heap.hh"
+#include "orbit.hh"
+#include "graph.hh"
+
+
+namespace bliss {
+
+/** \internal
+ * \brief A class for refinable, backtrackable ordered partitions.
+ *
+ * This is rather a data structure with some helper functions than
+ * a proper self-contained class.
+ * That is, for efficiency reasons the fields of this class are directly
+ * manipulated from bliss::AbstractGraph and its subclasses.
+ * Conversely, some methods of this class modify the fields of
+ * bliss::AbstractGraph, too.
+ */
+class Partition
+{
+public:
+ /**
+ * \brief Data structure for holding information about a cell in a Partition.
+ */
+ class Cell
+ {
+ friend class Partition;
+ public:
+ unsigned int length;
+ /* Index of the first element of the cell in
+ the Partition::elements array */
+ unsigned int first;
+ unsigned int max_ival;
+ unsigned int max_ival_count;
+ private:
+ bool in_splitting_queue;
+ public:
+ bool in_neighbour_heap;
+ /* Pointer to the next cell, null if this is the last one. */
+ Cell* next;
+ Cell* prev;
+ Cell* next_nonsingleton;
+ Cell* prev_nonsingleton;
+ unsigned int split_level;
+ /** Is this a unit cell? */
+ bool is_unit() const {return(length == 1); }
+ /** Is this cell in splitting queue? */
+ bool is_in_splitting_queue() const {return(in_splitting_queue); }
+ };
+
+
+private:
+
+ /** \internal
+ * Data structure for remembering information about splits in order to
+ * perform efficient backtracking over the splits.
+ */
+ class RefInfo {
+ public:
+ unsigned int split_cell_first;
+ int prev_nonsingleton_first;
+ int next_nonsingleton_first;
+ };
+ /** \internal
+ * A stack for remembering the splits, used for backtracking.
+ */
+ KStack<RefInfo> refinement_stack;
+
+ class BacktrackInfo {
+ public:
+ unsigned int refinement_stack_size;
+ unsigned int cr_backtrack_point;
+ };
+
+ /** \internal
+ * The main stack for enabling backtracking.
+ */
+ std::vector<BacktrackInfo> bt_stack;
+
+public:
+ AbstractGraph* graph;
+
+ /* Used during equitable partition refinement */
+ KQueue<Cell*> splitting_queue;
+ void splitting_queue_add(Cell* const cell);
+ Cell* splitting_queue_pop();
+ bool splitting_queue_is_empty() const;
+ void splitting_queue_clear();
+
+
+ /** Type for backtracking points. */
+ typedef unsigned int BacktrackPoint;
+
+ /**
+ * Get a new backtrack point for the current partition
+ */
+ BacktrackPoint set_backtrack_point();
+
+ /**
+ * Backtrack to the point \a p and remove it.
+ */
+ void goto_backtrack_point(BacktrackPoint p);
+
+ /**
+ * Split the non-unit Cell \a cell = {\a element,e1,e2,...,en} containing
+ * the element \a element in two:
+ * \a cell = {e1,...,en} and \a newcell = {\a element}.
+ * @param cell a non-unit Cell
+ * @param element an element in \a cell
+ * @return the new unit Cell \a newcell
+ */
+ Cell* individualize(Cell* const cell,
+ const unsigned int element);
+
+ Cell* aux_split_in_two(Cell* const cell,
+ const unsigned int first_half_size);
+
+
+private:
+ unsigned int N;
+ Cell* cells;
+ Cell* free_cells;
+ unsigned int discrete_cell_count;
+public:
+ Cell* first_cell;
+ Cell* first_nonsingleton_cell;
+ unsigned int *elements;
+ /* invariant_values[e] gives the invariant value of the element e */
+ unsigned int *invariant_values;
+ /* element_to_cell_map[e] gives the cell of the element e */
+ Cell **element_to_cell_map;
+ /** Get the cell of the element \a e */
+ Cell* get_cell(const unsigned int e) const {
+ return element_to_cell_map[e];
+ }
+ /* in_pos[e] points to the elements array s.t. *in_pos[e] = e */
+ unsigned int **in_pos;
+
+ Partition();
+ ~Partition();
+
+ /**
+ * Initialize the partition to the unit partition (all elements in one cell)
+ * over the \a N > 0 elements {0,...,\a N-1}.
+ */
+ void init(const unsigned int N);
+
+ /**
+ * Returns true iff the partition is discrete, meaning that all
+ * the elements are in their own cells.
+ */
+ bool is_discrete() const {return(free_cells == 0); }
+
+ unsigned int nof_discrete_cells() const {return(discrete_cell_count); }
+
+ /**
+ * Print the partition into the file stream \a fp.
+ */
+ size_t print(FILE* const fp, const bool add_newline = true) const;
+
+ /**
+ * Print the partition cell sizes into the file stream \a fp.
+ */
+ size_t print_signature(FILE* const fp, const bool add_newline = true) const;
+
+ /*
+ * Splits the Cell \a cell into [cell_1,...,cell_n]
+ * according to the invariant_values of the elements in \a cell.
+ * After splitting, cell_1 == \a cell.
+ * Returns the pointer to the Cell cell_n;
+ * cell_n != cell iff the Cell \a cell was actually splitted.
+ * The flag \a max_ival_info_ok indicates whether the max_ival and
+ * max_ival_count fields of the Cell \a cell have consistent values
+ * when the method is called.
+ * Clears the invariant values of elements in the Cell \a cell as well as
+ * the max_ival and max_ival_count fields of the Cell \a cell.
+ */
+ Cell *zplit_cell(Cell * const cell, const bool max_ival_info_ok);
+
+ /*
+ * Routines for component recursion
+ */
+ void cr_init();
+ void cr_free();
+ unsigned int cr_get_level(const unsigned int cell_index) const;
+ unsigned int cr_split_level(const unsigned int level,
+ const std::vector<unsigned int>& cells);
+
+ /** Clear the invariant_values of the elements in the Cell \a cell. */
+ void clear_ivs(Cell* const cell);
+
+private:
+ /*
+ * Component recursion data structures
+ */
+
+ /* Is component recursion support in use? */
+ bool cr_enabled;
+
+ class CRCell {
+ public:
+ unsigned int level;
+ CRCell* next;
+ CRCell** prev_next_ptr;
+ void detach() {
+ if(next)
+ next->prev_next_ptr = prev_next_ptr;
+ *(prev_next_ptr) = next;
+ level = UINT_MAX;
+ next = 0;
+ prev_next_ptr = 0;
+ }
+ };
+ CRCell* cr_cells;
+ CRCell** cr_levels;
+ class CR_BTInfo {
+ public:
+ unsigned int created_trail_index;
+ unsigned int splitted_level_trail_index;
+ };
+ std::vector<unsigned int> cr_created_trail;
+ std::vector<unsigned int> cr_splitted_level_trail;
+ std::vector<CR_BTInfo> cr_bt_info;
+ unsigned int cr_max_level;
+ void cr_create_at_level(const unsigned int cell_index, unsigned int level);
+ void cr_create_at_level_trailed(const unsigned int cell_index, unsigned int level);
+ unsigned int cr_get_backtrack_point();
+ void cr_goto_backtrack_point(const unsigned int btpoint);
+
+
+ /*
+ *
+ * Auxiliary routines for sorting and splitting cells
+ *
+ */
+ Cell* sort_and_split_cell1(Cell* cell);
+ Cell* sort_and_split_cell255(Cell* const cell, const unsigned int max_ival);
+ bool shellsort_cell(Cell* cell);
+ Cell* split_cell(Cell* const cell);
+
+ /*
+ * Some auxiliary stuff needed for distribution count sorting.
+ * To make the code thread-safe (modulo the requirement that each graph is
+ * only accessed in one thread at a time), the arrays are owned by
+ * the partition instance, not statically defined.
+ */
+ unsigned int dcs_count[256];
+ unsigned int dcs_start[256];
+ void dcs_cumulate_count(const unsigned int max);
+};
+
+
+inline Partition::Cell*
+Partition::splitting_queue_pop()
+{
+ Cell* const cell = splitting_queue.pop_front();
+ cell->in_splitting_queue = false;
+ return cell;
+}
+
+inline bool
+Partition::splitting_queue_is_empty() const
+{
+ return splitting_queue.is_empty();
+}
+
+
+inline unsigned int
+Partition::cr_get_level(const unsigned int cell_index) const
+{
+ return(cr_cells[cell_index].level);
+}
+
+
+
+} // namespace bliss
+
+#endif
diff --git a/src/bliss_eqrefhash.cc b/src/bliss/uintseqhash.cc
similarity index 67%
rename from src/bliss_eqrefhash.cc
rename to src/bliss/uintseqhash.cc
index cf3d557..21b1a17 100644
--- a/src/bliss_eqrefhash.cc
+++ b/src/bliss/uintseqhash.cc
@@ -1,33 +1,31 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
+#include "uintseqhash.hh"
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
*/
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include "bliss_eqrefhash.hh"
-
-using namespace std;
-
-namespace igraph {
+namespace bliss {
/*
* Random bits generated by
* http://www.fourmilab.ch/hotbits/
*/
-const static unsigned int rtab[256] = {
+static unsigned int rtab[256] = {
0xAEAA35B8, 0x65632E16, 0x155EDBA9, 0x01349B39,
0x8EB8BD97, 0x8E4C5367, 0x8EA78B35, 0x2B1B4072,
0xC1163893, 0x269A8642, 0xC79D7F6D, 0x6A32DEA0,
@@ -95,49 +93,25 @@ const static unsigned int rtab[256] = {
};
-void BuzzHash::update(unsigned int i)
+void UintSeqHash::update(unsigned int i)
{
i++;
- while(i > 0) {
- h ^= rtab[i & 0xff];
- const unsigned int b = h & 0x80000000;
- h = h << 1;
- if(b != 0)
- h++;
- i = i >> 8;
- }
-}
-
-int BuzzHash::cmp(const BuzzHash &other)
-{
- if(h < other.h)
- return -1;
- if(h == other.h)
- return 0;
- return 1;
-}
-
-
-int PerfectHash::cmp(const PerfectHash &other)
-{
- if(h.size() < other.h.size())
- return -1;
- if(h.size() > other.h.size())
- return 1;
- std::vector<unsigned int>::const_iterator i1 = h.begin();
- std::vector<unsigned int>::const_iterator i2 = other.h.begin();
- while(i1 != h.end())
+ while(i > 0)
{
- const unsigned int v1 = *i1;
- const unsigned int v2 = *i2;
- if(v1 < v2)
- return -1;
- if(v1 > v2)
- return 1;
- i1++;
- i2++;
+ h ^= rtab[i & 0xff];
+#if 1
+ const unsigned int b = (h & 0x80000000) >> 31;
+ i = i >> 8;
+ h = (h << 1) | b;
+#else
+ const unsigned int b = h & 0x80000000;
+ h = h << 1;
+ if(b != 0)
+ h++;
+ i = i >> 8;
+#endif
}
- return 0;
}
-}
+
+} // namespace bliss
diff --git a/src/bliss/uintseqhash.hh b/src/bliss/uintseqhash.hh
new file mode 100644
index 0000000..6b9bfca
--- /dev/null
+++ b/src/bliss/uintseqhash.hh
@@ -0,0 +1,65 @@
+#ifndef BLISS_UINTSEQHASH_HH
+#define BLISS_UINTSEQHASH_HH
+
+#include <cstdio>
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+/** \internal
+ * \brief A hash for sequences of unsigned ints.
+ */
+class UintSeqHash
+{
+protected:
+ unsigned int h;
+public:
+ UintSeqHash() {h = 0; }
+ UintSeqHash(const UintSeqHash &other) {h = other.h; }
+ UintSeqHash& operator=(const UintSeqHash &other) {h = other.h; return *this; }
+
+ /** Reset the hash value. */
+ void reset() {h = 0; }
+
+ /** Add the unsigned int \a n to the sequence. */
+ void update(unsigned int n);
+
+ /** Get the hash value of the sequence seen so far. */
+ unsigned int get_value() const {return h; }
+
+ /** Compare the hash values of this and \a other.
+ * Return -1/0/1 if the value of this is smaller/equal/greater than
+ * that of \a other. */
+ int cmp(const UintSeqHash &other) const {
+ return (h < other.h)?-1:((h == other.h)?0:1);
+ }
+ /** An abbreviation for cmp(other) < 0 */
+ bool is_lt(const UintSeqHash &other) const {return(cmp(other) < 0); }
+ /** An abbreviation for cmp(other) <= 0 */
+ bool is_le(const UintSeqHash &other) const {return(cmp(other) <= 0); }
+ /** An abbreviation for cmp(other) == 0 */
+ bool is_equal(const UintSeqHash &other) const {return(cmp(other) == 0); }
+};
+
+
+} // namespace bliss
+
+#endif
diff --git a/src/bliss/utils.cc b/src/bliss/utils.cc
new file mode 100644
index 0000000..548f500
--- /dev/null
+++ b/src/bliss/utils.cc
@@ -0,0 +1,122 @@
+#include <cassert>
+#include <vector>
+#include "utils.hh"
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+namespace bliss {
+
+void
+print_permutation(FILE* const fp,
+ const unsigned int N,
+ const unsigned int* perm,
+ const unsigned int offset)
+{
+ assert(N > 0);
+ assert(perm);
+ for(unsigned int i = 0; i < N; i++) {
+ unsigned int j = perm[i];
+ if(j == i)
+ continue;
+ bool is_first = true;
+ while(j != i) {
+ if(j < i) {
+ is_first = false;
+ break;
+ }
+ j = perm[j];
+ }
+ if(!is_first)
+ continue;
+ fprintf(fp, "(%u,", i+offset);
+ j = perm[i];
+ while(j != i) {
+ fprintf(fp, "%u", j+offset);
+ j = perm[j];
+ if(j != i)
+ fprintf(fp, ",");
+ }
+ fprintf(fp, ")");
+ }
+}
+
+void
+print_permutation(FILE* const fp,
+ const std::vector<unsigned int>& perm,
+ const unsigned int offset)
+{
+ const unsigned int N = perm.size();
+ for(unsigned int i = 0; i < N; i++) {
+ unsigned int j = perm[i];
+ if(j == i)
+ continue;
+ bool is_first = true;
+ while(j != i) {
+ if(j < i) {
+ is_first = false;
+ break;
+ }
+ j = perm[j];
+ }
+ if(!is_first)
+ continue;
+ fprintf(fp, "(%u,", i+offset);
+ j = perm[i];
+ while(j != i) {
+ fprintf(fp, "%u", j+offset);
+ j = perm[j];
+ if(j != i)
+ fprintf(fp, ",");
+ }
+ fprintf(fp, ")");
+ }
+}
+
+bool
+is_permutation(const unsigned int N, const unsigned int* perm)
+{
+ if(N == 0)
+ return true;
+ std::vector<bool> m(N, false);
+ for(unsigned int i = 0; i < N; i++) {
+ if(perm[i] >= N) return false;
+ if(m[perm[i]]) return false;
+ m[perm[i]] = true;
+ }
+ return true;
+}
+
+bool
+is_permutation(const std::vector<unsigned int>& perm)
+{
+ const unsigned int N = perm.size();
+ if(N == 0)
+ return true;
+ std::vector<bool> m(N, false);
+ for(unsigned int i = 0; i < N; i++) {
+ if(perm[i] >= N) return false;
+ if(m[perm[i]]) return false;
+ m[perm[i]] = true;
+ }
+ return true;
+}
+
+
+} // namespace bliss
diff --git a/src/bliss/utils.hh b/src/bliss/utils.hh
new file mode 100644
index 0000000..99f2fde
--- /dev/null
+++ b/src/bliss/utils.hh
@@ -0,0 +1,69 @@
+#ifndef BLISS_UTILS_HH
+#define BLISS_UTILS_HH
+
+/*
+ Copyright (c) 2003-2015 Tommi Junttila
+ Released under the GNU Lesser General Public License version 3.
+
+ This file is part of bliss.
+
+ bliss is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License as published by
+ the Free Software Foundation, version 3 of the License.
+
+ bliss is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with bliss. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * \file
+ * \brief Some small utilities.
+ *
+ */
+
+#include <cstdio>
+using namespace std;
+
+namespace bliss {
+
+/**
+ * Print the permutation \a perm of {0,...,N-1} in the cycle format
+ * in the file stream \a fp.
+ * The amount \a offset is added to each element before printing,
+ * e.g. the permutation (2 4) is printed as (3 5) when \a offset is 1.
+ */
+void print_permutation(FILE* fp,
+ const unsigned int N,
+ const unsigned int* perm,
+ const unsigned int offset = 0);
+
+/**
+ * Print the permutation \a perm of {0,...,N-1} in the cycle format
+ * in the file stream \a fp.
+ * The amount \a offset is added to each element before printing,
+ * e.g. the permutation (2 4) is printed as (3 5) when \a offset is 1.
+ */
+void print_permutation(FILE* fp,
+ const std::vector<unsigned int>& perm,
+ const unsigned int offset = 0);
+
+/**
+ * Check whether \a perm is a valid permutation on {0,...,N-1}.
+ * Slow, mainly for debugging and validation purposes.
+ */
+bool is_permutation(const unsigned int N, const unsigned int* perm);
+
+/**
+ * Check whether \a perm is a valid permutation on {0,...,N-1}.
+ * Slow, mainly for debugging and validation purposes.
+ */
+bool is_permutation(const std::vector<unsigned int>& perm);
+
+} // namespace bliss
+
+#endif
diff --git a/src/bliss_bignum.hh b/src/bliss_bignum.hh
deleted file mode 100644
index ddc65c2..0000000
--- a/src/bliss_bignum.hh
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_BIGNUM_HH
-#define BLISS_BIGNUM_HH
-
-#include <cstdlib>
-#include <cmath>
-#include <sstream>
-#include "bliss_defs.hh"
-#include "igraph_math.h"
-
-#include "igraph_memory.h"
-#include "igraph_error.h"
-
-/*
- * Simple class for big integers (or approximation of such) in order
- * compute group sizes.
- * Set BLISS_USE_GMP in defs.hh to use the GMP library.
- */
-
-
-#if defined(BLISS_USE_GMP)
-
-#include <gmp.h>
-
-namespace igraph {
-
-class BigNum
-{
- mpz_t v;
-public:
- BigNum() {mpz_init(v); }
- ~BigNum() {mpz_clear(v); }
- void assign(const int n) {mpz_set_si(v, n); }
- void multiply(const int n) {mpz_mul_si(v, v, n); }
- int tostring(char **str);
-};
-
-}
-
-#else
-
-namespace igraph {
-
-class BigNum
-{
- long double v;
-public:
- BigNum(): v(0.0) {}
- void assign(const int n) {v = (long double)n; }
- void multiply(const int n) {v *= (long double)n; }
- int tostring(char **str);
-};
-
-}
-
-#endif
-
-#endif
diff --git a/src/bliss_defs.hh b/src/bliss_defs.hh
deleted file mode 100644
index da10e9f..0000000
--- a/src/bliss_defs.hh
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_DEFS_HH
-#define BLISS_DEFS_HH
-
-#include "config.h"
-#include <cassert>
-
-/* Define this if you have gmp and want to have exact group sizes.
- * Remember to include -lgmp in LIB in Makefile. */
-#if HAVE_GMP == 1
-# define BLISS_USE_GMP
-#endif
-
-#if defined(DEBUG)
-#define CONSISTENCY_CHECKS
-#define EXPENSIVE_CONSISTENCY_CHECKS
-#endif
-//#define PRINT_SEARCH_TREE_DOT
-
-/* Force a check that the found automorphisms are valid */
-#if defined(CONSISTENCY_CHECKS)
-#define VERIFY_AUTOMORPHISMS
-/* Force a check that the generated partitions are equitable */
-#define VERIFY_EQUITABLEDNESS
-#endif
-
-
-#if defined(CONSISTENCY_CHECKS)
-#define DEBUG_ASSERT(a) assert(a)
-#else
-#define DEBUG_ASSERT(a) ;
-#endif
-
-#endif
diff --git a/src/bliss_eqrefhash.hh b/src/bliss_eqrefhash.hh
deleted file mode 100644
index 1e215e8..0000000
--- a/src/bliss_eqrefhash.hh
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_EQREFHASH_HH
-#define BLISS_EQREFHASH_HH
-
-#include <vector>
-
-#define EqrefHash BuzzHash
-//#define EqrefHash PerfectHash
-
-namespace igraph {
-
-class BuzzHash
-{
-protected:
- unsigned int h;
-public:
- void reset() {h = 0; }
- void update(unsigned int);
- int cmp(const BuzzHash &other);
- bool is_lt(const BuzzHash &other) {return(cmp(other) < 0); }
- bool is_le(const BuzzHash &other) {return(cmp(other) <= 0); }
- bool is_equal(const BuzzHash &other) {return(cmp(other) == 0); }
-};
-
-class PerfectHash
-{
-protected:
- std::vector<unsigned int> h;
-public:
- void reset() {h.clear(); }
- void update(unsigned int i) {h.push_back(i); }
- int cmp(const PerfectHash &other);
- bool is_lt(const PerfectHash &other) {return(cmp(other) < 0); }
- bool is_le(const PerfectHash &other) {return(cmp(other) <= 0); }
- bool is_equal(const PerfectHash &other) {return(cmp(other) == 0); }
-};
-
-}
-
-#endif
diff --git a/src/bliss_graph.cc b/src/bliss_graph.cc
deleted file mode 100644
index 4a3c5fe..0000000
--- a/src/bliss_graph.cc
+++ /dev/null
@@ -1,2495 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include <cstdio>
-#include <cassert>
-#include <cctype>
-#include <set>
-#include <list>
-#include <algorithm>
-#include "bliss_defs.hh"
-#include "bliss_timer.hh"
-#include "bliss_graph.hh"
-#include "bliss_partition.hh"
-#include <climits> // INT_MAX, etc
-
-#include "igraph_datatype.h"
-#include "igraph_interface.h"
-#include "igraph_topology.h"
-#include "igraph_statusbar.h"
-
-using namespace std;
-
-extern bool bliss_verbose;
-// extern FILE *bliss_verbstr;
-
-namespace igraph {
-
-static const bool should_not_happen = false;
-
-/*-------------------------------------------------------------------------
- *
- * Constructor and destructor routines for the abstract graph class
- *
- *-------------------------------------------------------------------------*/
-
-
-AbstractGraph::AbstractGraph()
-{
- /* Initialize stuff */
- first_path_labeling = 0;
- first_path_labeling_inv = 0;
- best_path_labeling = 0;
- best_path_labeling_inv = 0;
- first_path_automorphism = 0;
- best_path_automorphism = 0;
- //certificate = 0;
- in_search = false;
-}
-
-
-AbstractGraph::~AbstractGraph()
-{
- if(first_path_labeling) {
- free(first_path_labeling); first_path_labeling = 0; }
- if(first_path_labeling_inv) {
- free(first_path_labeling_inv); first_path_labeling_inv = 0; }
- if(best_path_labeling) {
- free(best_path_labeling); best_path_labeling = 0; }
- if(best_path_labeling_inv) {
- free(best_path_labeling_inv); best_path_labeling_inv = 0; }
- if(first_path_automorphism) {
- free(first_path_automorphism); first_path_automorphism = 0; }
- if(best_path_automorphism) {
- free(best_path_automorphism); best_path_automorphism = 0; }
- //if(certificate) {
- // free(certificate); certificate = 0; }
- while(!long_prune_fixed.empty())
- {
- delete long_prune_fixed.back();
- long_prune_fixed.pop_back();
- }
- while(!long_prune_mcrs.empty())
- {
- delete long_prune_mcrs.back();
- long_prune_mcrs.pop_back();
- }
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Routines for refinement to equitable partition
- *
- *-------------------------------------------------------------------------*/
-
-
-void AbstractGraph::refine_to_equitable()
-{
- assert(p.splitting_queue.is_empty());
-
- for(Cell *cell = p.first_cell; cell; cell = cell->next)
- {
- p.add_in_splitting_queue(cell);
- }
-
- return do_refine_to_equitable();
-}
-
-
-void AbstractGraph::refine_to_equitable(Cell *cell1)
-{
- DEBUG_ASSERT(cell1->length == 1);
-
-#ifdef EXPENSIVE_CONSISTENCY_CHECKS
- for(Cell *cell = p.first_cell; cell; cell = cell->next) {
- assert(cell->in_splitting_queue == false);
- assert(cell->in_neighbour_heap == false);
- }
-#endif
-
- assert(p.splitting_queue.is_empty());
-
- p.add_in_splitting_queue(cell1);
-
- return do_refine_to_equitable();
-}
-
-
-void AbstractGraph::refine_to_equitable(Cell *cell1, Cell *cell2)
-{
- DEBUG_ASSERT(cell1->length == 1);
- DEBUG_ASSERT(cell2->length == 1);
-
-#ifdef EXPENSIVE_CONSISTENCY_CHECKS
- for(Cell *cell = p.first_cell; cell; cell = cell->next) {
- assert(cell->in_splitting_queue == false);
- assert(cell->in_neighbour_heap == false);
- }
-#endif
-
- assert(p.splitting_queue.is_empty());
-
- p.add_in_splitting_queue(cell1);
- p.add_in_splitting_queue(cell2);
-
- return do_refine_to_equitable();
-}
-
-
-void AbstractGraph::do_refine_to_equitable()
-{
- assert(!p.splitting_queue.is_empty());
- assert(neighbour_heap.is_empty());
-
- eqref_hash.reset();
-
- while(!p.splitting_queue.is_empty())
- {
- Cell *cell = p.splitting_queue.pop_front();
- DEBUG_ASSERT(cell->in_splitting_queue);
- cell->in_splitting_queue = false;
-
- if(cell->length == 1)
- {
- if(in_search) {
- if(first_path_automorphism) {
- /* Build the (potential) automorphism on-the-fly */
- assert(first_path_labeling_inv);
- first_path_automorphism[first_path_labeling_inv[cell->first]] =
- p.elements[cell->first];
- }
- if(best_path_automorphism)
- {
- /* Build the (potential) automorphism on-the-fly */
- assert(best_path_labeling_inv);
- best_path_automorphism[best_path_labeling_inv[cell->first]] =
- p.elements[cell->first];
- }
- }
-
- bool worse = split_neighbourhood_of_unit_cell(cell);
- if(in_search && worse)
- goto worse_exit;
- }
- else
- {
- split_neighbourhood_of_cell(cell);
- }
- }
-
- eqref_worse_than_certificate = false;
- return;
-
- worse_exit:
- /* Clear splitting_queue */
- p.clear_splitting_queue();
- eqref_worse_than_certificate = true;
- return;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Routines for handling the canonical labeling
- *
- *-------------------------------------------------------------------------*/
-
-
-void AbstractGraph::update_labeling(unsigned int * const labeling)
-{
- const unsigned int N = get_nof_vertices();
- unsigned int *ep = p.elements;
- for(unsigned int i = 0; i < N; i++, ep++)
- labeling[*ep] = i;
-}
-
-
-void AbstractGraph::update_labeling_and_its_inverse(unsigned int * const labeling,
- unsigned int * const labeling_inv)
-{
- const unsigned int N = get_nof_vertices();
- unsigned int *ep = p.elements;
- unsigned int *clip = labeling_inv;
-
- for(unsigned int i = 0; i < N; ) {
- labeling[*ep] = i;
- i++;
- *clip = *ep;
- ep++;
- clip++;
- }
-}
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Routines for handling automorphisms
- *
- *-------------------------------------------------------------------------*/
-
-
-void AbstractGraph::reset_permutation(unsigned int *perm)
-{
- const unsigned int N = get_nof_vertices();
- for(unsigned int i = 0; i < N; i++, perm++)
- *perm = i;
-}
-
-
-bool AbstractGraph::is_automorphism(unsigned int * const perm)
-{
- IGRAPH_UNUSED(perm);
- assert(should_not_happen);
- return false;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Long prune code
- *
- *-------------------------------------------------------------------------*/
-
-void AbstractGraph::long_prune_init()
-{
- const unsigned int N = get_nof_vertices();
- long_prune_temp.clear();
- long_prune_temp.resize(N);
-#ifdef DEBUG
- for(unsigned int i = 0; i < N; i++)
- assert(long_prune_temp[i] == false);
-#endif
- const unsigned int nof_fitting_in_max_mem =
- (long_prune_options_max_mem * 1024 * 1024) / (((N * 2) / 8)+1);
- long_prune_max_stored_autss = long_prune_options_max_stored_auts;
- /* Had some problems with g++ in using (a<b)?a:b when constants involved,
- so had to make this in a stupid way...*/
- if(nof_fitting_in_max_mem < long_prune_options_max_stored_auts)
- long_prune_max_stored_autss = nof_fitting_in_max_mem;
-
- while(!long_prune_fixed.empty())
- {
- delete long_prune_fixed.back();
- long_prune_fixed.pop_back();
- }
- while(!long_prune_mcrs.empty())
- {
- delete long_prune_mcrs.back();
- long_prune_mcrs.pop_back();
- }
- for(unsigned int i = 0; i < long_prune_max_stored_autss; i++)
- {
- long_prune_fixed.push_back(new std::vector<bool>(N));
- long_prune_mcrs.push_back(new std::vector<bool>(N));
- }
- long_prune_begin = 0;
- long_prune_end = 0;
-}
-
-void AbstractGraph::long_prune_swap(const unsigned int i, const unsigned int j)
-{
- assert(long_prune_begin <= long_prune_end);
- assert(i >= long_prune_begin);
- assert(i < long_prune_end);
- assert(j >= long_prune_begin);
- assert(j < long_prune_end);
- const unsigned int real_i = i % long_prune_max_stored_autss;
- const unsigned int real_j = j % long_prune_max_stored_autss;
- std::vector<bool> * tmp = long_prune_fixed[real_i];
- long_prune_fixed[real_i] = long_prune_fixed[real_j];
- long_prune_fixed[real_j] = tmp;
- tmp = long_prune_mcrs[real_i];
- long_prune_mcrs[real_i] = long_prune_mcrs[real_j];
- long_prune_mcrs[real_j] = tmp;
-}
-
-std::vector<bool> &AbstractGraph::long_prune_get_fixed(const unsigned int index)
-{
- assert(long_prune_begin <= long_prune_end);
- assert(index >= long_prune_begin);
- assert(index < long_prune_end);
- return *long_prune_fixed[index % long_prune_max_stored_autss];
-}
-
-std::vector<bool> &AbstractGraph::long_prune_get_mcrs(const unsigned int index)
-{
- assert(long_prune_begin <= long_prune_end);
- assert(index >= long_prune_begin);
- assert(index < long_prune_end);
- return *long_prune_mcrs[index % long_prune_max_stored_autss];
-}
-
-
-void AbstractGraph::long_prune_add_automorphism(const unsigned int *aut)
-{
- if(long_prune_max_stored_autss == 0)
- return;
-
- const unsigned int N = get_nof_vertices();
-
-#ifdef DEBUG
- assert(long_prune_temp.size() == N);
- for(unsigned int i = 0; i < N; i++)
- assert(long_prune_temp[i] == false);
-#endif
-
- DEBUG_ASSERT(long_prune_fixed.size() == long_prune_mcrs.size());
- assert(long_prune_begin <= long_prune_end);
- if(long_prune_end - long_prune_begin == long_prune_max_stored_autss)
- {
- long_prune_begin++;
- }
- long_prune_end++;
- std::vector<bool> &fixed = long_prune_get_fixed(long_prune_end-1);
- std::vector<bool> &mcrs = long_prune_get_mcrs(long_prune_end-1);
-
- for(unsigned int i = 0; i < N; i++)
- {
- fixed[i] = (aut[i] == i);
- if(!long_prune_temp[i])
- {
- mcrs[i] = true;
- unsigned int j = aut[i];
- while(j != i)
- {
- assert(i <= j);
- long_prune_temp[j] = true;
- j = aut[j];
- }
- }
- else
- {
- mcrs[i] = false;
- }
- long_prune_temp[i] = false;
- }
-
-
-#ifdef DEBUG
- for(unsigned int i = 0; i < N; i++)
- assert(long_prune_temp[i] == false);
-#endif
-}
-
-
-/*-------------------------------------------------------------------------
- *
- * Routines for handling orbit information
- *
- *-------------------------------------------------------------------------*/
-
-
-void AbstractGraph::update_orbit_information(Orbit &o, const unsigned int *p)
-{
- const unsigned int N = get_nof_vertices();
- for(unsigned int i = 0; i < N; i++)
- if(p[i] != i)
- o.merge_orbits(i, p[i]);
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Print a permutation in cycle notation
- *
- *-------------------------------------------------------------------------*/
-
-
-void AbstractGraph::print_permutation(FILE *fp, const unsigned int *perm)
-{
- const unsigned int N = get_nof_vertices();
- for(unsigned int i = 0; i < N; i++) {
- unsigned int j = perm[i];
- if(j == i)
- continue;
- bool is_first = true;
- while(j != i) {
- if(j < i) {
- is_first = false;
- break;
- }
- j = perm[j];
- }
- if(!is_first)
- continue;
- fprintf(fp, "(%u,", i);
- j = perm[i];
- while(j != i) {
- fprintf(fp, "%u", j);
- j = perm[j];
- if(j != i)
- fprintf(fp, ",");
- }
- fprintf(fp, ")");
- }
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * The actual backtracking search
- *
- *-------------------------------------------------------------------------*/
-
-
-typedef struct {
- int split_element;
- unsigned int split_cell_first;
- unsigned int refinement_stack_size;
- unsigned int certificate_index;
-
- bool in_first_path;
- bool in_best_path;
- bool equal_to_first_path;
- int cmp_to_best_path;
-
- bool needs_long_prune;
- unsigned int long_prune_begin;
- std::set<unsigned int, std::less<unsigned int> > long_prune_redundant;
-
- EqrefHash eqref_hash;
- unsigned int subcertificate_length;
-} LevelInfo;
-
-
-
-typedef struct t_path_info {
- unsigned int splitting_element;
- unsigned int certificate_index;
- unsigned int subcertificate_length;
- EqrefHash eqref_hash;
-} PathInfo;
-
-
-void AbstractGraph::search(const bool canonical, Stats &stats)
-{
- const unsigned int N = get_nof_vertices();
-
- // const bool write_automorphisms = 0;
-
- unsigned int all_same_level = UINT_MAX;
-
- p.graph = this;
-
- /*
- * Must be done!
- */
- remove_duplicate_edges();
-
- /*
- * Reset search statistics
- */
- stats.group_size.assign(1);
- stats.nof_nodes = 1;
- stats.nof_leaf_nodes = 1;
- stats.nof_bad_nodes = 0;
- stats.nof_canupdates = 0;
- stats.nof_generators = 0;
- stats.max_level = 0;
-
- if(first_path_labeling)
- {
- free(first_path_labeling);
- first_path_labeling = 0;
- }
- if(first_path_labeling_inv)
- {
- free(first_path_labeling_inv);
- first_path_labeling_inv = 0;
- }
- if(first_path_automorphism)
- {
- free(first_path_automorphism);
- first_path_automorphism = 0;
- }
-
- if(best_path_labeling)
- {
- free(best_path_labeling);
- best_path_labeling = 0;
- }
- if(best_path_labeling_inv)
- {
- free(best_path_labeling_inv);
- best_path_labeling_inv = 0;
- }
- if(best_path_automorphism)
- {
- free(best_path_automorphism);
- best_path_automorphism = 0;
- }
-
- if(N == 0)
- return;
-
- p.init(N);
- neighbour_heap.init(N);
-
- in_search = false;
-
- p.level = 0;
-
- Timer t1;
- t1.start();
-
- make_initial_equitable_partition();
-
-#if defined(VERIFY_EQUITABLEDNESS)
- assert(is_equitable());
-#endif
-
- t1.stop();
-
- igraph_statusf("Initial partition computed in %.2fs", 0,
- t1.get_duration());
-
- /*
- * Allocate space for the labelings
- */
- if(first_path_labeling)
- free(first_path_labeling);
- first_path_labeling = (unsigned int*)calloc(N, sizeof(unsigned int));
- if(best_path_labeling)
- free(best_path_labeling);
- best_path_labeling = (unsigned int*)calloc(N, sizeof(unsigned int));
-
- /*
- * Are there any non-singleton cells?
- */
- if(p.is_discrete())
- {
- update_labeling(best_path_labeling);
- return;
- }
-
- //p.print_signature(stderr); fprintf(stderr, "\n");
-
- /*
- * Allocate space for the inverses of the labelings
- */
- if(first_path_labeling_inv)
- free(first_path_labeling_inv);
- first_path_labeling_inv = (unsigned int*)calloc(N, sizeof(unsigned int));
- if(best_path_labeling_inv)
- free(best_path_labeling_inv);
- best_path_labeling_inv = (unsigned int*)calloc(N, sizeof(unsigned int));
-
-
- /*
- * Allocate space for the automorphisms
- */
- if(first_path_automorphism) free(first_path_automorphism);
- first_path_automorphism = (unsigned int*)malloc(N * sizeof(unsigned int));
- if(best_path_automorphism) free(best_path_automorphism);
- best_path_automorphism = (unsigned int*)malloc(N * sizeof(unsigned int));
-
-
- /*
- * Initialize orbit information
- */
- first_path_orbits.init(N);
- best_path_orbits.init(N);
-
- /*
- * Initialize certificate memory
- */
- initialize_certificate();
- //assert(certificate);
- assert(certificate_index == 0);
-
- LevelInfo info;
- std::vector<LevelInfo> search_stack;
- std::vector<PathInfo> first_path_info;
- std::vector<PathInfo> best_path_info;
-
- search_stack.clear();
- p.refinement_stack.clean();
- assert(neighbour_heap.is_empty());
-
- /*
- * Initialize long prune
- */
- long_prune_init();
-
- /*
- * Build the first level info
- */
- info.split_cell_first = find_next_cell_to_be_splitted(p.first_cell)->first;
- info.split_element = -1;
- info.refinement_stack_size = p.refinement_stack.size();
- info.certificate_index = 0;
- info.in_first_path = false;
- info.in_best_path = false;
- info.long_prune_begin = 0;
- search_stack.push_back(info);
-
- /*
- * Set status and global flags for search related procedures
- */
- in_search = true;
- refine_compare_certificate = false;
- stats.nof_leaf_nodes = 0;
-
-
-#ifdef PRINT_SEARCH_TREE_DOT
- dotty_output = fopen("debug_stree.dot", "w");
- fprintf(dotty_output, "digraph stree {\n");
- fprintf(dotty_output, "\"n\" [label=\"");
- fprintf(dotty_output, "M"); //p.print(dotty_output);
- fprintf(dotty_output, "\"];\n");
-#endif
-
- p.consistency_check();
-
- /*
- * The actual backtracking search
- */
- while(!search_stack.empty())
- {
- info = search_stack.back();
- search_stack.pop_back();
-
- p.consistency_check();
-
- /*
- * Restore partition, certificate index, and split cell
- */
- p.unrefine(p.level, info.refinement_stack_size);
- assert(info.certificate_index <= certificate_size);
- certificate_index = info.certificate_index;
- certificate_current_path.resize(certificate_index);
- Cell * const cell = p.element_to_cell_map[p.elements[info.split_cell_first]];
- assert(cell->length > 1);
-
- p.consistency_check();
-
- if(p.level > 0 && !info.in_first_path)
- {
- if(info.split_element == -1)
- {
- info.needs_long_prune = true;
- }
- else if(info.needs_long_prune)
- {
- info.needs_long_prune = false;
- /* THIS IS A QUITE HORRIBLE HACK! */
- unsigned int begin = (info.long_prune_begin>long_prune_begin)?info.long_prune_begin:long_prune_begin;
- for(unsigned int i = begin; i < long_prune_end; i++)
- {
- const std::vector<bool> &fixed = long_prune_get_fixed(i);
- bool fixes_all = true;
- for(unsigned int l = 0; l < p.level; l++)
- {
- if(fixed[search_stack[l].split_element] == false)
- {
- fixes_all = false;
- break;
- }
- }
- if(!fixes_all)
- {
- long_prune_swap(begin, i);
- begin++;
- info.long_prune_begin = begin;
- continue;
- }
- const std::vector<bool> &mcrs = long_prune_get_mcrs(i);
- unsigned int *ep = p.elements + cell->first;
- for(unsigned int j = cell->length; j > 0; j--, ep++) {
- if(mcrs[*ep] == false)
- {
- info.long_prune_redundant.insert(*ep);
- }
- }
- }
- }
- }
-
- /*
- * Find the next smallest element in cell
- */
- unsigned int next_split_element = UINT_MAX;
- unsigned int *next_split_element_pos = 0;
- unsigned int *ep = p.elements + cell->first;
- if(info.in_first_path)
- {
- /* Find the next larger splitting element that is a mor */
- for(unsigned int i = cell->length; i > 0; i--, ep++) {
- if((int)(*ep) > info.split_element &&
- *ep < next_split_element &&
- first_path_orbits.is_minimal_representative(*ep)) {
- next_split_element = *ep;
- next_split_element_pos = ep;
- }
- }
- }
- else if(info.in_best_path)
- {
- /* Find the next larger splitting element that is a mor */
- for(unsigned int i = cell->length; i > 0; i--, ep++) {
- if((int)(*ep) > info.split_element &&
- *ep < next_split_element &&
- best_path_orbits.is_minimal_representative(*ep) &&
- (info.long_prune_redundant.find(*ep) ==
- info.long_prune_redundant.end())) {
- next_split_element = *ep;
- next_split_element_pos = ep;
- }
- }
- }
- else
- {
- /* Find the next larger splitting element */
- for(unsigned int i = cell->length; i > 0; i--, ep++) {
- if((int)(*ep) > info.split_element &&
- *ep < next_split_element &&
- (info.long_prune_redundant.find(*ep) ==
- info.long_prune_redundant.end())) {
- next_split_element = *ep;
- next_split_element_pos = ep;
- }
- }
- }
- if(next_split_element == UINT_MAX)
- {
- /*
- * No more splitting elements (unexplored children) in the cell
- */
- /* Update group size if required */
- if(info.in_first_path == true) {
- const unsigned int index =
- first_path_orbits.orbit_size(first_path_info[p.level].splitting_element);
- stats.group_size.multiply(index);
- /*
- * Update all_same_level
- */
- if(index == cell->length && all_same_level == p.level+1)
- all_same_level = p.level;
- igraph_statusf("Level %u: orbits=%u, index=%u/%u, "
- "all_same_level=%u", 0,
- p.level,
- first_path_orbits.nof_orbits(),
- index, cell->length,
- all_same_level);
- }
- /* Backtrack to the previous level */
- p.level--;
- continue;
- }
-
- /* Split on smallest */
- info.split_element = next_split_element;
-
- /*
- * Save the current search situation
- */
- search_stack.push_back(info);
-
- /*
- * No more in the first path
- */
- info.in_first_path = false;
- /*
- * No more in the best path
- */
- info.in_best_path = false;
-
- p.level++;
- stats.nof_nodes++;
- if(p.level > stats.max_level)
- stats.max_level = p.level;
-
- p.consistency_check();
-
- /*
- * Move the split element to be the last in the cell
- */
- *next_split_element_pos = p.elements[cell->first + cell->length - 1];
- p.in_pos[*next_split_element_pos] = next_split_element_pos;
- p.elements[cell->first + cell->length - 1] = next_split_element;
- p.in_pos[next_split_element] = p.elements+ cell->first + cell->length -1;
- /*
- * Split the cell in two:
- * the last element in the cell (split element) forms a singleton cell
- */
- Cell * const new_cell = p.aux_split_in_two(cell, cell->length - 1);
- p.element_to_cell_map[p.elements[new_cell->first]] = new_cell;
- p.consistency_check();
-
- /*
- const bool prev_equal_to_first_path = info.equal_to_first_path;
- const int prev_cmp_to_best_path = info.cmp_to_best_path;
- */
- //assert(!(!info.equal_to_first_path && info.cmp_to_best_path < 0));
-
- if(!first_path_info.empty())
- {
- refine_equal_to_first = info.equal_to_first_path;
- if(refine_equal_to_first)
- refine_first_path_subcertificate_end =
- first_path_info[p.level-1].certificate_index +
- first_path_info[p.level-1].subcertificate_length;
- if(canonical)
- {
- refine_cmp_to_best = info.cmp_to_best_path;
- if(refine_cmp_to_best == 0)
- refine_best_path_subcertificate_end =
- best_path_info[p.level-1].certificate_index +
- best_path_info[p.level-1].subcertificate_length;
- }
- else
- refine_cmp_to_best = -1;
- }
- /*
- * Refine the new partition to equitable
- */
- if(cell->length == 1)
- refine_to_equitable(cell, new_cell);
- else
- refine_to_equitable(new_cell);
-
- p.consistency_check();
-
-
-#ifdef PRINT_SEARCH_TREE_DOT
- fprintf(dotty_output, "\"n");
- for(unsigned int i = 0; i < search_stack.size(); i++) {
- fprintf(dotty_output, "%u", search_stack[i].split_element);
- if(i < search_stack.size() - 1) fprintf(dotty_output, ".");
- }
- fprintf(dotty_output, "\"");
- fprintf(dotty_output, " [label=\"");
- fprintf(dotty_output, "%u",cell->first); /*p.print(dotty_output);*/
- fprintf(dotty_output, "\"]");
- if(!first_path_info.empty() && canonical && refine_cmp_to_best > 0) {
- fprintf(dotty_output, "[color=green]");
- }
- fprintf(dotty_output, ";\n");
-
- fprintf(dotty_output, "\"n");
- for(unsigned int i = 0; i < search_stack.size() - 1; i++) {
- fprintf(dotty_output, "%u", search_stack[i].split_element);
- if(i < search_stack.size() - 2) fprintf(dotty_output, ".");
- }
- fprintf(dotty_output, "\" -> \"n");
- for(unsigned int i = 0; i < search_stack.size(); i++) {
- fprintf(dotty_output, "%u", search_stack[i].split_element);
- if(i < search_stack.size() - 1) fprintf(dotty_output, ".");
- }
- fprintf(dotty_output, "\" [label=\"%d\"];\n", next_split_element);
-#endif
-
- /*
- if(prev_cmp_to_best_path == 0 && refine_cmp_to_best < 0)
- fprintf(stderr, "BP- ");
- if(prev_cmp_to_best_path == 0 && refine_cmp_to_best > 0)
- fprintf(stderr, "BP+ ");
- */
-
- if(p.is_discrete())
- {
- /* Update statistics */
- stats.nof_leaf_nodes++;
- /*
- if(stats.nof_leaf_nodes % 100 == 0) {
- fprintf(stdout, "Nodes: %lu, Leafs: %lu, Bad: %lu\n",
- stats.nof_nodes, stats.nof_leaf_nodes,
- stats.nof_bad_nodes);
- fflush(stdout);
- }
- */
- }
-
- if(!first_path_info.empty())
- {
- /* We are no longer on the first path */
- assert(best_path_info.size() > 0);
- assert(certificate_current_path.size() >= certificate_index);
- const unsigned int subcertificate_length =
- certificate_current_path.size() - certificate_index;
- if(refine_equal_to_first)
- {
- /* Was equal to the first path so far */
- assert(first_path_info.size() >= p.level);
- PathInfo &first_pinfo = first_path_info[p.level-1];
- assert(first_pinfo.certificate_index == certificate_index);
- if(subcertificate_length != first_pinfo.subcertificate_length)
- {
- refine_equal_to_first = false;
- }
- else if(first_pinfo.eqref_hash.cmp(eqref_hash) != 0)
- {
- refine_equal_to_first = false;
- }
- }
- if(canonical && (refine_cmp_to_best == 0))
- {
- /* Was equal to the best path so far */
- assert(best_path_info.size() >= p.level);
- PathInfo &best_pinfo = best_path_info[p.level-1];
- assert(best_pinfo.certificate_index == certificate_index);
- if(subcertificate_length < best_pinfo.subcertificate_length)
- {
- refine_cmp_to_best = -1;
- //fprintf(stderr, "BSCL- ");
- }
- else if(subcertificate_length > best_pinfo.subcertificate_length)
- {
- refine_cmp_to_best = 1;
- //fprintf(stderr, "BSCL+ ");
- }
- else if(best_pinfo.eqref_hash.cmp(eqref_hash) > 0)
- {
- refine_cmp_to_best = -1;
- //fprintf(stderr, "BHL- ");
- }
- else if(best_pinfo.eqref_hash.cmp(eqref_hash) < 0)
- {
- refine_cmp_to_best = 1;
- //fprintf(stderr, "BHL+ ");
- }
- }
- if(refine_equal_to_first == false &&
- (!canonical || (refine_cmp_to_best < 0)))
- {
- /* Backtrack */
-#ifdef PRINT_SEARCH_TREE_DOT
- fprintf(dotty_output, "\"n");
- for(unsigned int i = 0; i < search_stack.size(); i++) {
- fprintf(dotty_output, "%u", search_stack[i].split_element);
- if(i < search_stack.size() - 1) fprintf(dotty_output, ".");
- }
- fprintf(dotty_output, "\" [color=red];\n");
-#endif
- stats.nof_bad_nodes++;
- if(search_stack.back().equal_to_first_path == true &&
- p.level > all_same_level)
- {
- assert(all_same_level >= 1);
- for(unsigned int i = all_same_level;
- i < search_stack.size();
- i++)
- {
- search_stack[i].equal_to_first_path = false;
- }
- }
- while(!search_stack.empty())
- {
- p.level--;
- LevelInfo &info2 = search_stack.back();
- if(!(info2.equal_to_first_path == false &&
- (!canonical || (info2.cmp_to_best_path < 0))))
- break;
- search_stack.pop_back();
- }
- continue;
- }
- }
-
-#if defined(VERIFY_EQUITABLEDNESS)
- /* The new partition should be equitable */
- assert(is_equitable());
-#endif
-
- info.equal_to_first_path = refine_equal_to_first;
- info.cmp_to_best_path = refine_cmp_to_best;
-
- certificate_index = certificate_current_path.size();
-
- search_stack.back().eqref_hash = eqref_hash;
- search_stack.back().subcertificate_length =
- certificate_index - info.certificate_index;
-
-
- if(!p.is_discrete())
- {
- /*
- * An internal, non-leaf node
- */
- /* Build the next node info */
- /* Find the next cell to be splitted */
- assert(cell == p.element_to_cell_map[p.elements[info.split_cell_first]]);
- Cell * const next_split_cell = find_next_cell_to_be_splitted(cell);
- assert(next_split_cell);
- /* Copy current info to the search stack */
- search_stack.push_back(info);
- LevelInfo &new_info = search_stack.back();
- new_info.split_cell_first = next_split_cell->first;
- new_info.split_element = -1;
- new_info.certificate_index = certificate_index;
- new_info.refinement_stack_size = p.refinement_stack.size();
- new_info.long_prune_redundant.clear();
- new_info.long_prune_begin = info.long_prune_begin;
- continue;
- }
-
- /*
- * A leaf node
- */
- assert(certificate_index == certificate_size);
-
- if(first_path_info.empty())
- {
- /* The first path, update first_path and best_path */
- //fprintf(stdout, "Level %u: FIRST\n", p.level); fflush(stdout);
- stats.nof_canupdates++;
- /*
- * Update labelings and their inverses
- */
- update_labeling_and_its_inverse(first_path_labeling,
- first_path_labeling_inv);
- update_labeling_and_its_inverse(best_path_labeling,
- best_path_labeling_inv);
- /*
- * Reset automorphism array
- */
- reset_permutation(first_path_automorphism);
- reset_permutation(best_path_automorphism);
- /*
- * Reset orbit information
- */
- first_path_orbits.reset();
- best_path_orbits.reset();
- /*
- * Reset group size
- */
- stats.group_size.assign(1);
- /*
- * Reset all_same_level
- */
- all_same_level = p.level;
- /*
- * Mark the current path to be the first and best one and save it
- */
- const unsigned int base_size = search_stack.size();
- assert(p.level == base_size);
- best_path_info.clear();
- //fprintf(stdout, " New base is: ");
- for(unsigned int i = 0; i < base_size; i++) {
- search_stack[i].in_first_path = true;
- search_stack[i].in_best_path = true;
- search_stack[i].equal_to_first_path = true;
- search_stack[i].cmp_to_best_path = 0;
- PathInfo path_info;
- path_info.splitting_element = search_stack[i].split_element;
- path_info.certificate_index = search_stack[i].certificate_index;
- path_info.eqref_hash = search_stack[i].eqref_hash;
- path_info.subcertificate_length = search_stack[i].subcertificate_length;
- first_path_info.push_back(path_info);
- best_path_info.push_back(path_info);
- //fprintf(stdout, "%u ", search_stack[i].split_element);
- }
- //fprintf(stdout, "\n"); fflush(stdout);
- certificate_first_path = certificate_current_path;
- certificate_best_path = certificate_current_path;
-
- refine_compare_certificate = true;
- /*
- * Backtrack to the previous level
- */
- p.level--;
- continue;
- }
-
- DEBUG_ASSERT(first_path_info.size() > 0);
-
- //fprintf(stdout, "Level %u: LEAF %d %d\n", p.level, info.equal_to_first_path, info.cmp_to_best_path); fflush(stdout);
-
- if(info.equal_to_first_path)
- {
- /*
- * An automorphism found: aut[i] = elements[first_path_labeling[i]]
- */
- assert(!info.in_first_path);
- //fprintf(stdout, "A"); fflush(stdout);
-
-#ifdef PRINT_SEARCH_TREE_DOT
- fprintf(dotty_output, "\"n");
- for(unsigned int i = 0; i < search_stack.size(); i++) {
- fprintf(dotty_output, "%u", search_stack[i].split_element);
- if(i < search_stack.size() - 1) fprintf(dotty_output, ".");
- }
- fprintf(dotty_output, "\" [color=blue];\n");
-#endif
-
-#if defined(DEBUG)
- /* Verify that the automorphism is correctly built */
- for(unsigned int i = 0; i < N; i++)
- assert(first_path_automorphism[i] ==
- p.elements[first_path_labeling[i]]);
-#endif
-
-#if defined(VERIFY_AUTOMORPHISMS)
- /* Verify that it really is an automorphism */
- assert(is_automorphism(first_path_automorphism));
-#endif
-
- long_prune_add_automorphism(first_path_automorphism);
-
- /*
- * Update orbit information
- */
- update_orbit_information(first_path_orbits, first_path_automorphism);
-
- /*
- * Compute backjumping level
- */
- unsigned int backjumping_level = 0;
- for(unsigned int i = search_stack.size(); i > 0; i--) {
- const unsigned int split_element =
- search_stack[backjumping_level].split_element;
- if(first_path_automorphism[split_element] != split_element)
- break;
- backjumping_level++;
- }
- assert(backjumping_level < p.level);
- /*
- * Go back to backjumping_level
- */
- p.level = backjumping_level;
- search_stack.resize(p.level + 1);
-
- // if(write_automorphisms)
- // {
- // print_permutation(stdout, first_path_automorphism);
- // fprintf(stdout, "\n");
- // }
- stats.nof_generators++;
- continue;
- }
-
- assert(canonical);
- assert(info.cmp_to_best_path >= 0);
- if(info.cmp_to_best_path > 0)
- {
- /*
- * A new, better representative found
- */
- //fprintf(stdout, "Level %u: NEW BEST\n", p.level); fflush(stdout);
- stats.nof_canupdates++;
- /*
- * Update canonical labeling and its inverse
- */
- update_labeling_and_its_inverse(best_path_labeling,
- best_path_labeling_inv);
- /* Reset best path automorphism */
- reset_permutation(best_path_automorphism);
- /* Reset best path orbit structure */
- best_path_orbits.reset();
- /*
- * Mark the current path to be the best one and save it
- */
- const unsigned int base_size = search_stack.size();
- assert(p.level == base_size);
- best_path_info.clear();
- //fprintf(stdout, " New base is: ");
- for(unsigned int i = 0; i < base_size; i++) {
- search_stack[i].cmp_to_best_path = 0;
- search_stack[i].in_best_path = true;
- PathInfo path_info;
- path_info.splitting_element = search_stack[i].split_element;
- path_info.certificate_index = search_stack[i].certificate_index;
- path_info.eqref_hash = search_stack[i].eqref_hash;
- path_info.subcertificate_length = search_stack[i].subcertificate_length;
- best_path_info.push_back(path_info);
- //fprintf(stdout, "%u ", search_stack[i].split_element);
- }
- certificate_best_path = certificate_current_path;
- //fprintf(stdout, "\n"); fflush(stdout);
- /*
- * Backtrack to the previous level
- */
- p.level--;
- continue;
- }
-
- {
- //fprintf(stderr, "BAUT ");
- /*
- * Equal to the previous best path
- */
-#if defined(DEBUG)
- /* Verify that the automorphism is correctly built */
- for(unsigned int i = 0; i < N; i++)
- assert(best_path_automorphism[i] ==
- p.elements[best_path_labeling[i]]);
-#endif
-
-#if defined(VERIFY_AUTOMORPHISMS)
- /* Verify that it really is an automorphism */
- assert(is_automorphism(best_path_automorphism));
-#endif
-
- unsigned int gca_level_with_first = 0;
- for(unsigned int i = search_stack.size(); i > 0; i--) {
- if((int)first_path_info[gca_level_with_first].splitting_element !=
- search_stack[gca_level_with_first].split_element)
- break;
- gca_level_with_first++;
- }
- assert(gca_level_with_first < p.level);
-
- unsigned int gca_level_with_best = 0;
- for(unsigned int i = search_stack.size(); i > 0; i--) {
- if((int)best_path_info[gca_level_with_best].splitting_element !=
- search_stack[gca_level_with_best].split_element)
- break;
- gca_level_with_best++;
- }
- assert(gca_level_with_best < p.level);
-
- long_prune_add_automorphism(best_path_automorphism);
-
- /*
- * Update orbit information
- */
- update_orbit_information(best_path_orbits, best_path_automorphism);
-
- /*
- * Update orbit information
- */
- const unsigned int nof_old_orbits = first_path_orbits.nof_orbits();
- update_orbit_information(first_path_orbits, best_path_automorphism);
- if(nof_old_orbits != first_path_orbits.nof_orbits())
- {
- // if(write_automorphisms)
- // {
- // print_permutation(stdout, best_path_automorphism);
- // fprintf(stdout, "\n");
- // }
- stats.nof_generators++;
- }
-
- /*
- * Compute backjumping level
- */
- unsigned int backjumping_level = p.level - 1;
- if(!first_path_orbits.is_minimal_representative(search_stack[gca_level_with_first].split_element))
- {
- backjumping_level = gca_level_with_first;
- /*fprintf(stderr, "bj1: %u %u\n", p.level, backjumping_level);*/
- }
- else
- {
- assert(!best_path_orbits.is_minimal_representative(search_stack[gca_level_with_best].split_element));
- backjumping_level = gca_level_with_best;
- /*fprintf(stderr, "bj2: %u %u\n", p.level, backjumping_level);*/
- }
- /* Backtrack */
- search_stack.resize(backjumping_level + 1);
- p.level = backjumping_level;
- continue;
- }
- }
-
-#ifdef PRINT_SEARCH_TREE_DOT
- fprintf(dotty_output, "}\n");
- fclose(dotty_output);
-#endif
-}
-
-
-
-
-void AbstractGraph::find_automorphisms(Stats &stats)
-{
- search(false, stats);
-
- if(first_path_labeling)
- {
- free(first_path_labeling);
- first_path_labeling = 0;
- }
- if(best_path_labeling)
- {
- free(best_path_labeling);
- best_path_labeling = 0;
- }
-}
-
-
-const unsigned int *AbstractGraph::canonical_form(Stats &stats)
-{
- search(true, stats);
-
- return best_path_labeling;
-}
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Routines for undirected graphs
- *
- *-------------------------------------------------------------------------*/
-
-Graph::Vertex::Vertex()
-{
- label = 1;
- nof_edges = 0;
-}
-
-
-Graph::Vertex::~Vertex()
-{
- ;
-}
-
-
-void Graph::Vertex::add_edge(const unsigned int other_vertex)
-{
- edges.push_back(other_vertex);
- nof_edges++;
- DEBUG_ASSERT(nof_edges == edges.size());
-}
-
-
-void Graph::Vertex::remove_duplicate_edges(bool * const duplicate_array)
-{
- for(std::vector<unsigned int>::iterator iter = edges.begin();
- iter != edges.end(); )
- {
- const unsigned int dest_vertex = *iter;
- if(duplicate_array[dest_vertex] == true)
- {
- /* A duplicate edge found! */
- iter = edges.erase(iter);
- nof_edges--;
- DEBUG_ASSERT(nof_edges == edges.size());
- }
- else
- {
- /* Not seen earlier, mark as seen */
- duplicate_array[dest_vertex] = true;
- iter++;
- }
- }
-
- /* Clear duplicate_array */
- for(std::vector<unsigned int>::iterator iter = edges.begin();
- iter != edges.end();
- iter++)
- {
- duplicate_array[*iter] = false;
- }
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Constructor and destructor for undirected graphs
- *
- *-------------------------------------------------------------------------*/
-
-
-Graph::Graph(const unsigned int nof_vertices)
-{
- vertices.resize(nof_vertices);
- sh = sh_flm;
-}
-
-
-Graph::~Graph()
-{
- ;
-}
-
-
-unsigned int Graph::add_vertex(const unsigned int new_label)
-{
- const unsigned int new_vertex_num = vertices.size();
- vertices.resize(new_vertex_num + 1);
- vertices.back().label = new_label;
- return new_vertex_num;
-}
-
-
-void Graph::add_edge(const unsigned int vertex1, const unsigned int vertex2)
-{
- //fprintf(stderr, "(%u,%u) ", vertex1, vertex2);
- assert(vertex1 < vertices.size());
- assert(vertex2 < vertices.size());
- vertices[vertex1].add_edge(vertex2);
- vertices[vertex2].add_edge(vertex1);
-}
-
-
-void Graph::change_label(const unsigned int vertex,
- const unsigned int new_label)
-{
- assert(vertex < vertices.size());
- vertices[vertex].label = new_label;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Read graph in the DIMACS format
- *
- *-------------------------------------------------------------------------*/
-
-// Graph *Graph::read_dimacs(FILE *fp)
-// {
-// Graph *g = 0;
-// unsigned int nof_vertices, nof_edges;
-// unsigned int line_num = 1;
-// int c;
-
-// /* read comments and problem line*/
-// while(1) {
-// c = getc(fp);
-// if(c == 'c') {
-// while((c = getc(fp)) != '\n') {
-// if(c == EOF) {
-// fprintf(stderr, "error in line %u: not in DIMACS format\n",
-// line_num);
-// goto error_exit;
-// }
-// }
-// line_num++;
-// continue;
-// }
-// if(c == 'p') {
-// if(fscanf(fp, " edge %u %u\n", &nof_vertices, &nof_edges) != 2) {
-// fprintf(stderr, "error in line %u: not in DIMACS format\n",
-// line_num);
-// goto error_exit; }
-// line_num++;
-// break;
-// }
-// fprintf(stderr, "error in line %u: not in DIMACS format\n", line_num);
-// goto error_exit;
-// }
-
-// if(nof_vertices <= 0) {
-// fprintf(stderr, "error: no vertices\n");
-// goto error_exit;
-// }
-// #if 0
-// if(nof_edges <= 0) {
-// fprintf(stderr, "error: no edges\n");
-// goto error_exit;
-// }
-// #endif
-// if(bliss_verbose) {
-// fprintf(bliss_verbstr, "Instance has %d vertices and %d edges\n",
-// nof_vertices, nof_edges);
-// fflush(bliss_verbstr);
-// }
-
-// g = new Graph(nof_vertices);
-
-// //
-// // Read vertex labels
-// //
-// if(bliss_verbose) {
-// fprintf(bliss_verbstr, "Reading vertex labels...\n");
-// fflush(bliss_verbstr); }
-// while(1) {
-// c = getc(fp);
-// if(c != 'n') {
-// ungetc(c, fp);
-// break;
-// }
-// ungetc(c, fp);
-// unsigned int vertex, label;
-// if(fscanf(fp, "n %u %u\n", &vertex, &label) != 2) {
-// fprintf(stderr, "error in line %u: not in DIMACS format\n",
-// line_num);
-// goto error_exit;
-// }
-// if(vertex > nof_vertices) {
-// fprintf(stderr, "error in line %u: not in DIMACS format\n",
-// line_num);
-// goto error_exit;
-// }
-// line_num++;
-// g->change_label(vertex - 1, label);
-// }
-// if(bliss_verbose) {
-// fprintf(bliss_verbstr, "Done\n");
-// fflush(bliss_verbstr); }
-
-// //
-// // Read edges
-// //
-// if(bliss_verbose) {
-// fprintf(bliss_verbstr, "Reading edges...\n");
-// fflush(bliss_verbstr); }
-// for(unsigned i = 0; i < nof_edges; i++) {
-// unsigned int from, to;
-// if(fscanf(fp, "e %u %u\n", &from, &to) != 2) {
-// fprintf(stderr, "error in line %u: not in DIMACS format\n",
-// line_num);
-// goto error_exit;
-// }
-// if(from > nof_vertices || to > nof_vertices) {
-// fprintf(stderr, "error in line %u: not in DIMACS format\n",
-// line_num);
-// goto error_exit;
-// }
-// line_num++;
-// g->add_edge(from - 1, to - 1);
-// }
-// if(bliss_verbose) {
-// fprintf(bliss_verbstr, "Done\n");
-// fflush(bliss_verbstr);
-// }
-
-// return g;
-
-// error_exit:
-// if(g)
-// delete g;
-// return 0;
-
-// }
-
-Graph *Graph::from_igraph(const igraph_t *graph) {
-
- unsigned int nof_vertices= (unsigned int)igraph_vcount(graph);
- unsigned int nof_edges= (unsigned int)igraph_ecount(graph);
- Graph *g=new Graph(nof_vertices);
-// for (unsigned int i=0; i<nof_vertices; i++) {
-// g->change_label(i, i);
-// }
- for (unsigned int i=0; i<nof_edges; i++) {
- g->add_edge((unsigned int)IGRAPH_FROM(graph, i),
- (unsigned int)IGRAPH_TO(graph, i));
- }
- return g;
-}
-
-void Graph::print_dimacs(FILE *fp)
-{
- unsigned int nof_edges = 0;
- for(unsigned int i = 0; i < get_nof_vertices(); i++)
- {
- Vertex &v = vertices[i];
- for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- ei != v.edges.end();
- ei++)
- {
- const unsigned int dest_i = *ei;
- if(dest_i < i)
- continue;
- nof_edges++;
- }
- }
-
- fprintf(fp, "p edge %u %u\n", get_nof_vertices(), nof_edges);
- for(unsigned int i = 0; i < get_nof_vertices(); i++)
- {
- Vertex &v = vertices[i];
- if(v.label != 1)
- {
- fprintf(fp, "n %u %u\n", i+1, v.label);
- }
- }
- for(unsigned int i = 0; i < get_nof_vertices(); i++)
- {
- Vertex &v = vertices[i];
- for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- ei != v.edges.end();
- ei++)
- {
- const unsigned int dest_i = *ei;
- if(dest_i < i)
- continue;
- fprintf(fp, "e %u %u\n", i+1, dest_i+1);
- }
- }
-}
-
-
-
-
-Graph *Graph::permute(const unsigned int *perm)
-{
- Graph *g = new Graph(get_nof_vertices());
- for(unsigned int i = 0; i < get_nof_vertices(); i++)
- {
- Vertex &v = vertices[i];
- Vertex &permuted_v = g->vertices[perm[i]];
- permuted_v.label = v.label;
- for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- ei != v.edges.end();
- ei++)
- {
- const unsigned int dest_v = *ei;
- permuted_v.add_edge(perm[dest_v]);
- }
- std::sort(permuted_v.edges.begin(), permuted_v.edges.end());
- }
- return g;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Print graph in graphviz format
- *
- *-------------------------------------------------------------------------*/
-
-
-void Graph::to_dot(const char *file_name)
-{
- FILE *fp = fopen(file_name, "w");
- if(fp)
- to_dot(fp);
- fclose(fp);
-}
-
-
-void Graph::to_dot(FILE *fp)
-{
- remove_duplicate_edges();
-
- fprintf(fp, "graph g {\n");
-
- unsigned int vnum = 0;
- for(std::vector<Vertex>::iterator vi = vertices.begin();
- vi != vertices.end();
- vi++, vnum++)
- {
- Vertex &v = *vi;
- fprintf(fp, "v%u [label=\"%u:%u\"];\n", vnum, vnum, v.label);
- for(std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- ei != v.edges.end();
- ei++)
- {
- const unsigned int vnum2 = *ei;
- if(vnum2 > vnum)
- fprintf(fp, "v%u -- v%u\n", vnum, vnum2);
- }
- }
-
- fprintf(fp, "}\n");
-}
-
-
-
-
-
-void Graph::remove_duplicate_edges()
-{
- bool *duplicate_array = (bool*)calloc(vertices.size(), sizeof(bool));
-
- for(std::vector<Vertex>::iterator vi = vertices.begin();
- vi != vertices.end();
- vi++)
- {
-#ifdef EXPENSIVE_CONSISTENCY_CHECKS
- for(unsigned int i = 0; i < vertices.size(); i++)
- assert(duplicate_array[i] == false);
-#endif
- Vertex &v = *vi;
- v.remove_duplicate_edges(duplicate_array);
- }
-
- free(duplicate_array);
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Partition independent invariants
- *
- *-------------------------------------------------------------------------*/
-
-
-unsigned int Graph::label_invariant(Graph *g, unsigned int v)
-{
- DEBUG_ASSERT(v < g->vertices.size());
- return g->vertices[v].label;
-}
-
-
-unsigned int Graph::degree_invariant(Graph *g, unsigned int v)
-{
- DEBUG_ASSERT(v < g->vertices.size());
- DEBUG_ASSERT(g->vertices[v].edges.size() ==
- g->vertices[v].nof_edges);
- return g->vertices[v].nof_edges;
-}
-
-
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Refine the partition p according to a partition independent invariant
- *
- *-------------------------------------------------------------------------*/
-
-bool Graph::refine_according_to_invariant(unsigned int (*inv)(Graph * const g, unsigned int v))
-{
- bool refined = false;
-
- for(Cell *cell = p.first_cell; cell; )
- {
- assert(cell->max_ival == 0);
- assert(cell->max_ival_count == 0);
-
- Cell * const next_cell = cell->next;
-
- if(cell->length == 1)
- {
- cell = next_cell;
- continue;
- }
-
- const unsigned int *ep = p.elements + cell->first;
- for(unsigned int i = cell->length; i > 0; i--, ep++)
- {
- unsigned int ival = inv(this, *ep);
- p.invariant_values[*ep] = ival;
- if(ival > cell->max_ival) {
- cell->max_ival = ival;
- cell->max_ival_count = 1;
- }
- else if(ival == cell->max_ival) {
- cell->max_ival_count++;
- }
- }
- Cell * const last_new_cell = p.zplit_cell(cell, true);
- refined = (last_new_cell != cell);
- cell = next_cell;
- }
-
- return refined;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Split the neighbourhood of a cell according to the equitable invariant
- *
- *-------------------------------------------------------------------------*/
-
-
-void Graph::split_neighbourhood_of_cell(Cell * const cell)
-{
- DEBUG_ASSERT(neighbour_heap.is_empty());
- DEBUG_ASSERT(cell->length > 1);
-
- eqref_hash.update(cell->first);
- eqref_hash.update(cell->length);
-
- unsigned int *ep = p.elements + cell->first;
- for(unsigned int i = cell->length; i > 0; i--)
- {
- const Vertex &v = vertices[*ep];
- ep++;
-
- std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- for(unsigned int j = v.nof_edges; j > 0; j--)
- {
- const unsigned int dest_vertex = *ei++;
- Cell * const neighbour_cell = p.element_to_cell_map[dest_vertex];
- if(neighbour_cell->length == 1)
- continue;
- const unsigned int ival = p.invariant_values[dest_vertex] + 1;
- p.invariant_values[dest_vertex] = ival;
- if(ival > neighbour_cell->max_ival) {
- neighbour_cell->max_ival = ival;
- neighbour_cell->max_ival_count = 1;
- }
- else if(ival == neighbour_cell->max_ival) {
- neighbour_cell->max_ival_count++;
- }
- if(!neighbour_cell->in_neighbour_heap) {
- neighbour_cell->in_neighbour_heap = true;
- neighbour_heap.insert(neighbour_cell->first);
- }
- }
- }
-
- while(!neighbour_heap.is_empty())
- {
- const unsigned int start = neighbour_heap.remove();
- Cell * const neighbour_cell = p.element_to_cell_map[p.elements[start]];
- DEBUG_ASSERT(neighbour_cell->first == start);
- DEBUG_ASSERT(neighbour_cell->in_neighbour_heap);
- neighbour_cell->in_neighbour_heap = false;
-
- DEBUG_ASSERT(neighbour_cell->length > 1);
- DEBUG_ASSERT(neighbour_cell->max_ival >= 1);
- DEBUG_ASSERT(neighbour_cell->max_ival_count >= 1);
-
- eqref_hash.update(neighbour_cell->first);
- eqref_hash.update(neighbour_cell->length);
- eqref_hash.update(neighbour_cell->max_ival);
- eqref_hash.update(neighbour_cell->max_ival_count);
-
- Cell * const last_new_cell = p.zplit_cell(neighbour_cell, true);
- /* Update hash */
- const Cell *c = neighbour_cell;
- while(1)
- {
- eqref_hash.update(c->first);
- eqref_hash.update(c->length);
- if(c == last_new_cell)
- break;
- c = c->next;
- }
- }
-}
-
-
-bool Graph::split_neighbourhood_of_unit_cell(Cell * const unit_cell)
-{
- DEBUG_ASSERT(neighbour_heap.is_empty());
-
- DEBUG_ASSERT(unit_cell->length == 1);
- DEBUG_ASSERT(p.element_to_cell_map[p.elements[unit_cell->first]] == unit_cell);
- DEBUG_ASSERT(p.in_pos[p.elements[unit_cell->first]] ==
- p.elements + unit_cell->first);
-
- eqref_hash.update(0x87654321);
- eqref_hash.update(unit_cell->first);
- eqref_hash.update(1);
-
- const Vertex &v = vertices[p.elements[unit_cell->first]];
-
- std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- for(unsigned int j = v.nof_edges; j > 0; j--)
- {
- const unsigned int dest_vertex = *ei++;
- Cell * const neighbour_cell = p.element_to_cell_map[dest_vertex];
- DEBUG_ASSERT(*p.in_pos[dest_vertex] == dest_vertex);
-
- if(neighbour_cell->length == 1) {
- DEBUG_ASSERT(!neighbour_cell->in_neighbour_heap);
- if(in_search) {
- neighbour_cell->in_neighbour_heap = true;
- neighbour_heap.insert(neighbour_cell->first);
- }
- continue;
- }
- if(!neighbour_cell->in_neighbour_heap) {
- neighbour_cell->in_neighbour_heap = true;
- neighbour_heap.insert(neighbour_cell->first);
- }
- neighbour_cell->max_ival_count++;
- DEBUG_ASSERT(neighbour_cell->max_ival_count <= neighbour_cell->length);
-
- unsigned int * const swap_position =
- p.elements + neighbour_cell->first + neighbour_cell->length -
- neighbour_cell->max_ival_count;
- DEBUG_ASSERT(p.in_pos[dest_vertex] <= swap_position);
- *p.in_pos[dest_vertex] = *swap_position;
- p.in_pos[*swap_position] = p.in_pos[dest_vertex];
- *swap_position = dest_vertex;
- p.in_pos[dest_vertex] = swap_position;
- }
-
- while(!neighbour_heap.is_empty())
- {
- const unsigned int start = neighbour_heap.remove();
- Cell *neighbour_cell = p.element_to_cell_map[p.elements[start]];
- DEBUG_ASSERT(neighbour_cell->in_neighbour_heap);
- neighbour_cell->in_neighbour_heap = false;
-
-#ifdef DEBUG
- assert(neighbour_cell->first == start);
- if(neighbour_cell->length == 1) {
- assert(neighbour_cell->max_ival_count == 0);
- } else {
- assert(neighbour_cell->max_ival_count > 0);
- assert(neighbour_cell->max_ival_count <= neighbour_cell->length);
- }
-#endif
-
- eqref_hash.update(neighbour_cell->first);
- eqref_hash.update(neighbour_cell->length);
- eqref_hash.update(neighbour_cell->max_ival_count);
-
- if(neighbour_cell->length > 1 &&
- neighbour_cell->max_ival_count != neighbour_cell->length) {
-
- p.consistency_check();
-
- Cell * const new_cell = p.aux_split_in_two(neighbour_cell, neighbour_cell->length - neighbour_cell->max_ival_count);
- unsigned int *ep = p.elements + new_cell->first;
- unsigned int * const lp = p.elements+new_cell->first+new_cell->length;
- while(ep < lp) {
- DEBUG_ASSERT(p.in_pos[*ep] == ep);
- p.element_to_cell_map[*ep] = new_cell;
- ep++;
- }
- neighbour_cell->max_ival_count = 0;
-
- p.consistency_check();
-
- /* update hash */
- eqref_hash.update(neighbour_cell->first);
- eqref_hash.update(neighbour_cell->length);
- eqref_hash.update(0);
- eqref_hash.update(new_cell->first);
- eqref_hash.update(new_cell->length);
- eqref_hash.update(1);
-
- /* Add cells in splitting_queue */
- DEBUG_ASSERT(!new_cell->in_splitting_queue);
- if(neighbour_cell->in_splitting_queue) {
- /* Both cells must be included in splitting_queue in order
- to have refinement to equitable partition */
- p.add_in_splitting_queue(new_cell);
- } else {
- Cell *min_cell, *max_cell;
- if(neighbour_cell->length <= new_cell->length) {
- min_cell = neighbour_cell;
- max_cell = new_cell;
- } else {
- min_cell = new_cell;
- max_cell = neighbour_cell;
- }
- /* Put the smaller cell in splitting_queue */
- p.add_in_splitting_queue(min_cell);
- if(max_cell->length == 1) {
- /* Put the "larger" cell also in splitting_queue */
- p.add_in_splitting_queue(max_cell);
- }
- }
- /* Update pointer for certificate generation */
- neighbour_cell = new_cell;
- }
- else
- neighbour_cell->max_ival_count = 0;
-
- /*
- * Build certificate if required
- */
- if(in_search)
- {
- for(unsigned int i = neighbour_cell->first,
- j = neighbour_cell->length,
- c_index = certificate_current_path.size();
- j > 0;
- j--, i++, c_index += 2)
- {
- if(refine_compare_certificate)
- {
- if(refine_equal_to_first)
- {
- if(c_index >= refine_first_path_subcertificate_end)
- refine_equal_to_first = false;
- else if(certificate_first_path[c_index] !=
- unit_cell->first)
- refine_equal_to_first = false;
- else if(certificate_first_path[c_index+1] != i)
- refine_equal_to_first = false;
- }
- if(refine_cmp_to_best == 0)
- {
- if(c_index >= refine_best_path_subcertificate_end)
- {
- refine_cmp_to_best = 1;
- }
- else if(unit_cell->first>certificate_best_path[c_index])
- {
- refine_cmp_to_best = 1;
- }
- else if(unit_cell->first<certificate_best_path[c_index])
- {
- refine_cmp_to_best = -1;
- }
- else if(i > certificate_best_path[c_index+1])
- {
- refine_cmp_to_best = 1;
- }
- else if(i < certificate_best_path[c_index+1])
- {
- refine_cmp_to_best = -1;
- }
- }
- if((refine_equal_to_first == false) &&
- (refine_cmp_to_best < 0))
- goto worse_exit;
- }
- certificate_current_path.push_back(unit_cell->first);
- certificate_current_path.push_back(i);
- }
- } /* if(in_search) */
- } /* while(!neighbour_heap.is_empty()) */
-
- return false;
-
- worse_exit:
- while(!neighbour_heap.is_empty())
- {
- const unsigned int start = neighbour_heap.remove();
- Cell * const neighbour_cell = p.element_to_cell_map[p.elements[start]];
- DEBUG_ASSERT(neighbour_cell->in_neighbour_heap);
- neighbour_cell->in_neighbour_heap = false;
- neighbour_cell->max_ival_count = 0;
- }
- return true;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Check whether the current partition p is equitable
- * Slow: use only for debugging purposes
- * Side effect: resets max_ival and max_ival_count fields in cells
- *
- *-------------------------------------------------------------------------*/
-
-bool Graph::is_equitable()
-{
- bool result = true;
-
- /*
- * Max ival and max_ival_count are used for counting purposes,
- * they should be reset...
- */
- for(Cell *cell = p.first_cell; cell; cell = cell->next)
- {
- assert(cell->prev_next_ptr && *(cell->prev_next_ptr) == cell);
- assert(cell->max_ival == 0);
- assert(cell->max_ival_count == 0);
- }
-
-
- for(Cell *cell = p.first_cell; cell; cell = cell->next)
- {
- if(cell->length == 1)
- continue;
-
- unsigned int *ep = p.elements + cell->first;
- Vertex &first_vertex = vertices[*ep++];
-
- /* Count edges of the first vertex for cells in max_ival */
- std::vector<unsigned int>::const_iterator ei = first_vertex.edges.begin();
- for(unsigned int j = first_vertex.nof_edges; j > 0; j--)
- {
- p.element_to_cell_map[*ei++]->max_ival++;
- }
-
- /* Count and compare edges of the other vertices */
- for(unsigned int i = cell->length; i > 1; i--)
- {
- Vertex &vertex = vertices[*ep++];
- std::vector<unsigned int>::const_iterator ei = vertex.edges.begin();
- for(unsigned int j = vertex.nof_edges; j > 0; j--)
- {
- p.element_to_cell_map[*ei++]->max_ival_count++;
- }
- for(Cell *cell2 = p.first_cell; cell2; cell2 = cell2->next)
- {
- if(cell2->max_ival != cell2->max_ival_count)
- {
- result = false;
- goto done;
- }
- cell2->max_ival_count = 0;
- }
- }
- /* Reset max_ival */
- for(Cell *cell2 = p.first_cell; cell2; cell2 = cell2->next)
- {
- cell2->max_ival = 0;
- assert(cell2->max_ival_count == 0);
- }
- }
-
- done:
-
- for(Cell *cell = p.first_cell; cell; cell = cell->next)
- {
- cell->max_ival = 0;
- cell->max_ival_count = 0;
- }
-
- return result;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Build the initial equitable partition
- *
- *-------------------------------------------------------------------------*/
-
-void Graph::make_initial_equitable_partition()
-{
- refine_according_to_invariant(&label_invariant);
- p.clear_splitting_queue();
- //p.print_signature(stderr); fprintf(stderr, "\n");
-
- refine_according_to_invariant(°ree_invariant);
- p.clear_splitting_queue();
- //p.print_signature(stderr); fprintf(stderr, "\n");
-
- /* To do: add loop invariant */
-
- refine_to_equitable();
- p.refinement_stack.clean();
- //p.print_signature(stderr); fprintf(stderr, "\n");
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Find the next cell to be splitted
- *
- *-------------------------------------------------------------------------*/
-
-Cell *Graph::find_next_cell_to_be_splitted(Cell *cell)
-{
- assert(!p.is_discrete());
- switch(sh) {
- case sh_f:
- return sh_first(cell);
- case sh_fs:
- return sh_first_smallest(cell);
- case sh_fl:
- return sh_first_largest(cell);
- case sh_fm:
- return sh_first_max_neighbours(cell);
- case sh_fsm:
- return sh_first_smallest_max_neighbours(cell);
- case sh_flm:
- return sh_first_largest_max_neighbours(cell);
- default:
- assert(false && "Unknown splitting heuristics");
- return 0;
- }
-}
-
-/* First nonsingleton cell */
-Cell *Graph::sh_first(Cell *cell)
-{
- IGRAPH_UNUSED(cell);
- return p.first_nonsingleton_cell;
-}
-
-/* First smallest nonsingleton cell. */
-Cell *Graph::sh_first_smallest(Cell *cell)
-{
- Cell *best_cell = 0;
- unsigned int best_size = UINT_MAX;
- for(cell = p.first_nonsingleton_cell; cell; cell = cell->next_nonsingleton)
- {
- assert(cell->length > 1);
- if(cell->length < best_size)
- {
- best_size = cell->length;
- best_cell = cell;
- }
- }
- assert(best_cell);
- return best_cell;
-}
-
-/* First largest nonsingleton cell. */
-Cell *Graph::sh_first_largest(Cell *cell)
-{
- Cell *best_cell = 0;
- unsigned int best_size = 0;
- for(cell = p.first_nonsingleton_cell; cell; cell = cell->next_nonsingleton)
- {
- assert(cell->length > 1);
- if(cell->length > best_size)
- {
- best_size = cell->length;
- best_cell = cell;
- }
- }
- assert(best_cell);
- return best_cell;
-}
-
-/* First nonsingleton cell with max number of neighbouring
- * nonsingleton cells.
- * Assumes that the partition p is equitable.
- * Messes up in_neighbour_heap and max_ival fields of cells
- * (assumes they are false/0).
- */
-Cell *Graph::sh_first_max_neighbours(Cell *cell)
-{
- Cell *best_cell = 0;
- int best_value = -1;
- for(cell = p.first_nonsingleton_cell; cell; cell = cell->next_nonsingleton)
- {
- assert(cell->length > 1);
-
- const Vertex &v = vertices[p.elements[cell->first]];
- std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- std::list<Cell*> neighbour_cells_visited;
- for(unsigned int j = v.nof_edges; j > 0; j--)
- {
- const unsigned int dest_vertex = *ei++;
- Cell * const neighbour_cell = p.element_to_cell_map[dest_vertex];
- if(neighbour_cell->length == 1)
- continue;
- neighbour_cell->max_ival++;
- if(neighbour_cell->in_neighbour_heap)
- continue;
- neighbour_cell->in_neighbour_heap = true;
- neighbour_cells_visited.push_back(neighbour_cell);
- }
- int value = 0;
- while(!neighbour_cells_visited.empty())
- {
- Cell * const neighbour_cell = neighbour_cells_visited.front();
- neighbour_cells_visited.pop_front();
- assert(neighbour_cell->in_neighbour_heap);
- neighbour_cell->in_neighbour_heap = false;
- if(neighbour_cell->max_ival != neighbour_cell->length)
- value++;
- neighbour_cell->max_ival = 0;
- }
- if(value > best_value)
- {
- best_value = value;
- best_cell = cell;
- }
- }
- assert(best_cell);
- return best_cell;
-}
-/* First smallest nonsingleton cell with max number of neighbouring
- * nonsingleton cells.
- * Assumes that the partition p is equitable.
- * Messes up in_neighbour_heap and max_ival fields of cells
- * (assumes they are false).
- */
-Cell *Graph::sh_first_smallest_max_neighbours(Cell *cell)
-{
- Cell *best_cell = 0;
- int best_value = -1;
- int best_size = INT_MAX;
- for(cell = p.first_nonsingleton_cell; cell; cell = cell->next_nonsingleton)
- {
- assert(cell->length > 1);
-
- const Vertex &v = vertices[p.elements[cell->first]];
- std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- std::list<Cell*> neighbour_cells_visited;
- for(unsigned int j = v.nof_edges; j > 0; j--)
- {
- const unsigned int dest_vertex = *ei++;
- Cell * const neighbour_cell = p.element_to_cell_map[dest_vertex];
- if(neighbour_cell->length == 1)
- continue;
- neighbour_cell->max_ival++;
- if(neighbour_cell->in_neighbour_heap)
- continue;
- neighbour_cell->in_neighbour_heap = true;
- neighbour_cells_visited.push_back(neighbour_cell);
- }
- int value = 0;
- while(!neighbour_cells_visited.empty())
- {
- Cell * const neighbour_cell = neighbour_cells_visited.front();
- neighbour_cells_visited.pop_front();
- assert(neighbour_cell->in_neighbour_heap);
- neighbour_cell->in_neighbour_heap = false;
- if(neighbour_cell->max_ival != neighbour_cell->length)
- value++;
- neighbour_cell->max_ival = 0;
- }
- if((value > best_value) ||
- (value == best_value && (int)cell->length < best_size))
- {
- best_value = value;
- best_size = cell->length;
- best_cell = cell;
- }
- }
- assert(best_cell);
- return best_cell;
-}
-/* First largest nonsingleton cell with max number of neighbouring
- * nonsingleton cells.
- * Assumes that the partition p is equitable.
- * Messes up in_neighbour_heap and max_ival fields of cells
- * (assumes they are false/0).
- */
-Cell *Graph::sh_first_largest_max_neighbours(Cell *cell)
-{
- Cell *best_cell = 0;
- int best_value = -1;
- int best_size = -1;
- for(cell = p.first_nonsingleton_cell; cell; cell = cell->next_nonsingleton)
- {
- assert(cell->length > 1);
-
- const Vertex &v = vertices[p.elements[cell->first]];
- std::vector<unsigned int>::const_iterator ei = v.edges.begin();
- std::list<Cell*> neighbour_cells_visited;
- for(unsigned int j = v.nof_edges; j > 0; j--)
- {
- const unsigned int dest_vertex = *ei++;
- Cell * const neighbour_cell = p.element_to_cell_map[dest_vertex];
- if(neighbour_cell->length == 1)
- continue;
- neighbour_cell->max_ival++;
- if(neighbour_cell->in_neighbour_heap)
- continue;
- neighbour_cell->in_neighbour_heap = true;
- neighbour_cells_visited.push_back(neighbour_cell);
- }
- int value = 0;
- while(!neighbour_cells_visited.empty())
- {
- Cell * const neighbour_cell = neighbour_cells_visited.front();
- neighbour_cells_visited.pop_front();
- assert(neighbour_cell->in_neighbour_heap);
- neighbour_cell->in_neighbour_heap = false;
- if(neighbour_cell->max_ival != neighbour_cell->length)
- value++;
- neighbour_cell->max_ival = 0;
- }
- if((value > best_value) ||
- (value == best_value && (int)cell->length > best_size))
- {
- best_value = value;
- best_size = cell->length;
- best_cell = cell;
- }
- }
- assert(best_cell);
- return best_cell;
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Initialize the certificate size and memory
- *
- *-------------------------------------------------------------------------*/
-
-void Graph::initialize_certificate()
-{
- certificate_size = 0;
- for(Cell *cell = p.first_cell; cell; cell = cell->next)
- {
- if(cell->length > 1) {
- certificate_size +=
- vertices[p.elements[cell->first]].nof_edges * 2 * cell->length;
- }
- }
- //if(certificate)
- // free(certificate);
- //certificate = (unsigned int*)malloc(certificate_size * sizeof(unsigned int));
- certificate_index = 0;
-
- certificate_current_path.clear();
- certificate_first_path.clear();
- certificate_best_path.clear();
-}
-
-
-
-
-
-/*-------------------------------------------------------------------------
- *
- * Check whether perm is an automorphism
- *
- *-------------------------------------------------------------------------*/
-
-bool Graph::is_automorphism(unsigned int * const perm)
-{
- std::set<unsigned int, std::less<unsigned int> > edges1;
- std::set<unsigned int, std::less<unsigned int> > edges2;
-
- bool result = true;
-
- for(unsigned int i = 0; i < vertices.size(); i++)
- {
- Vertex &v1 = vertices[i];
- edges1.clear();
- for(std::vector<unsigned int>::iterator ei = v1.edges.begin();
- ei != v1.edges.end();
- ei++)
- edges1.insert(perm[*ei]);
-
- Vertex &v2 = vertices[perm[i]];
- edges2.clear();
- for(std::vector<unsigned int>::iterator ei = v2.edges.begin();
- ei != v2.edges.end();
- ei++)
- edges2.insert(*ei);
-
- if(!(edges1 == edges2))
- {
- result = false;
- goto done;
- }
- }
-
- done:
-
- return result;
-}
-
-}
diff --git a/src/bliss_graph.hh b/src/bliss_graph.hh
deleted file mode 100644
index 1784ec3..0000000
--- a/src/bliss_graph.hh
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_GRAPH_HH
-#define BLISS_GRAPH_HH
-
-namespace igraph {
- class AbstractGraph;
-}
-
-#include <cstdio>
-#include <vector>
-#include "bliss_kstack.hh"
-#include "bliss_kqueue.hh"
-#include "bliss_heap.hh"
-#include "bliss_orbit.hh"
-#include "bliss_partition.hh"
-#include "bliss_bignum.hh"
-#include "bliss_eqrefhash.hh"
-
-#include "igraph_datatype.h"
-
-namespace igraph {
-
-typedef struct t_Stats
-{
- BigNum group_size;
- long unsigned int nof_nodes;
- long unsigned int nof_leaf_nodes;
- long unsigned int nof_bad_nodes;
- long unsigned int nof_canupdates;
- long unsigned int nof_generators;
- unsigned long int max_level;
-} Stats;
-
-class AbstractGraph
-{
- friend class Partition;
-protected:
- AbstractGraph();
- virtual ~AbstractGraph();
-
- Partition p;
-
- bool in_search;
-
- bool refine_compare_certificate;
- bool refine_equal_to_first;
- unsigned int refine_first_path_subcertificate_end;
- int refine_cmp_to_best;
- unsigned int refine_best_path_subcertificate_end;
-
- /* Max mem used by long prune in megabytes */
- static const unsigned int long_prune_options_max_mem = 20;
- static const unsigned int long_prune_options_max_stored_auts = 50;
- unsigned int long_prune_max_stored_autss;
- std::vector<std::vector<bool> *> long_prune_fixed;
- std::vector<std::vector<bool> *> long_prune_mcrs;
- std::vector<bool> long_prune_temp;
- unsigned int long_prune_begin;
- unsigned int long_prune_end;
- void long_prune_init();
- void long_prune_add_automorphism(const unsigned int *aut);
- std::vector<bool> &long_prune_get_fixed(const unsigned int index);
- std::vector<bool> &long_prune_get_mcrs(const unsigned int index);
- void long_prune_swap(const unsigned int i, const unsigned int j);
-
- /*
- * Data structures and routines for refining the partition p into equitable
- */
- Heap neighbour_heap;
- virtual bool split_neighbourhood_of_unit_cell(Cell *) = 0;
- virtual void split_neighbourhood_of_cell(Cell * const) = 0;
- void refine_to_equitable();
- void refine_to_equitable(Cell *cell);
- void refine_to_equitable(Cell *cell1, Cell *cell2);
- void do_refine_to_equitable();
- unsigned int eqref_max_certificate_index;
- bool eqref_worse_than_certificate;
- //void eqref_update_hash(unsigned int i);
- EqrefHash eqref_hash;
-
- /* For debugging purposes only */
- virtual bool is_equitable() {assert(0); return false; }
-
- void print_permutation(FILE *, const unsigned int *perm);
-
- unsigned int *first_path_labeling;
- unsigned int *first_path_labeling_inv;
- Orbit first_path_orbits;
- unsigned int *first_path_automorphism;
-
- unsigned int *best_path_labeling;
- unsigned int *best_path_labeling_inv;
- Orbit best_path_orbits;
- unsigned int *best_path_automorphism;
-
- void update_labeling(unsigned int * const lab);
- void update_labeling_and_its_inverse(unsigned int * const lab,
- unsigned int * const lab_inv);
- void update_orbit_information(Orbit &o, const unsigned int *perm);
-
- void reset_permutation(unsigned int *perm);
-
- /* Mainly for debugging purposes */
- virtual bool is_automorphism(unsigned int * const perm);
-
- std::vector<unsigned int> certificate_current_path;
- std::vector<unsigned int> certificate_first_path;
- std::vector<unsigned int> certificate_best_path;
-
- //unsigned int *certificate;
- unsigned int certificate_size;
- unsigned int certificate_index;
- virtual void initialize_certificate() = 0;
-
- virtual void remove_duplicate_edges() = 0;
- virtual void make_initial_equitable_partition() = 0;
- virtual Cell *find_next_cell_to_be_splitted(Cell *cell) = 0;
-
- void search(const bool canonical, Stats &stats);
-
-#ifdef PRINT_SEARCH_TREE_DOT
- FILE *dotty_output;
-#endif
-
-public:
- virtual unsigned int get_nof_vertices() = 0;
-
- void find_automorphisms(Stats &stats);
- const unsigned int *canonical_form(Stats &stats);
-};
-
-
-
-
-/*
- * Undirected, vertex labeled graph
- * Multiple edges between vertices are not allowed (i.e., will be ignored)
- */
-class Graph : public AbstractGraph
-{
- class Vertex {
- public:
- Vertex();
- ~Vertex();
- void add_edge(const unsigned int other_vertex);
- void remove_duplicate_edges(bool * const);
-
- unsigned int label;
- unsigned int nof_edges;
- std::vector<unsigned int> edges;
- };
- std::vector<Vertex> vertices;
- void remove_duplicate_edges();
-
- /*
- * Partition independent invariants for this graph class
- */
- static unsigned int label_invariant(Graph *g, unsigned int v);
- static unsigned int degree_invariant(Graph *g, unsigned int v);
-
- bool refine_according_to_invariant(unsigned int (*inv)(Graph * g,
- unsigned int v));
-
- /*
- * Routines needed when refining the partition p into equitable
- */
- bool split_neighbourhood_of_unit_cell(Cell *);
- void split_neighbourhood_of_cell(Cell * const);
-
- /* For debugging purposes only */
- bool is_equitable();
-
- Cell *find_next_cell_to_be_splitted(Cell *cell);
- /* Splitting heuristics */
- unsigned int sh;
- Cell *sh_first(Cell *cell);
- Cell *sh_first_smallest(Cell *cell);
- Cell *sh_first_largest(Cell *cell);
- Cell *sh_first_max_neighbours(Cell *cell);
- Cell *sh_first_smallest_max_neighbours(Cell *cell);
- Cell *sh_first_largest_max_neighbours(Cell *cell);
-
- void make_initial_equitable_partition();
- void initialize_certificate();
-
- bool is_automorphism(unsigned int * const perm);
-
-public:
- Graph(const unsigned int nof_vertices = 0);
- ~Graph();
-
- static const unsigned int sh_f = 0;
- static const unsigned int sh_fs = 1;
- static const unsigned int sh_fl = 2;
- static const unsigned int sh_fm = 3;
- static const unsigned int sh_fsm = 4;
- static const unsigned int sh_flm = 5;
-
- static Graph *read_dimacs(FILE *);
- static Graph *from_igraph(const igraph_t *graph);
- void print_dimacs(FILE *);
-
- void to_dot(FILE *fp);
- void to_dot(const char *file_name);
-
- unsigned int get_nof_vertices() {return vertices.size(); }
- Graph *permute(const unsigned int *perm);
-
- unsigned int add_vertex(const unsigned int label = 1);
- void add_edge(const unsigned int vertex1, const unsigned int vertex2);
- void change_label(const unsigned int vertex, const unsigned int new_label);
-
- void set_splitting_heuristics(unsigned int shs) {sh = shs; }
-};
-
-}
-
-#endif
diff --git a/src/bliss_heap.cc b/src/bliss_heap.cc
deleted file mode 100644
index b2b571f..0000000
--- a/src/bliss_heap.cc
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include <cstdlib>
-#include <cstdio>
-#include <climits>
-#include "bliss_defs.hh"
-#include "bliss_heap.hh"
-
-using namespace std;
-
-namespace igraph {
-
-Heap::~Heap()
-{
- if(array)
- {
- free(array);
- array = 0;
- }
-}
-
-void Heap::upheap(unsigned int index)
-{
- assert(n >= 1);
- assert(index >= 1 && index <= n);
- const unsigned int v = array[index];
- array[0] = UINT_MAX;
- while(array[index/2] <= v)
- {
- array[index] = array[index/2];
- index = index/2;
- }
- array[index] = v;
-}
-
-void Heap::downheap(unsigned int index)
-{
- const unsigned int v = array[index];
- while(index <= n/2)
- {
- unsigned int new_index = index + index;
- if(new_index < n && array[new_index] < array[new_index+1])
- new_index++;
- if(v >= array[new_index])
- break;
- array[index] = array[new_index];
- index = new_index;
- }
- array[index] = v;
-}
-
-void Heap::init(unsigned int size)
-{
- array = (unsigned int*)malloc((size + 1) * sizeof(unsigned int));
- n = 0;
-#if defined(CONSISTENCY_CHECKS)
- assert(size > 0);
- N = size;
-#endif
-}
-
-void Heap::insert(unsigned int v)
-{
- DEBUG_ASSERT(n < N);
- array[++n] = v;
- upheap(n);
-}
-
-unsigned int Heap::remove()
-{
- DEBUG_ASSERT(n >= 1 && n <= N);
- const unsigned int v = array[1];
- array[1] = array[n--];
- downheap(1);
- return v;
-}
-
-}
diff --git a/src/bliss_heap.hh b/src/bliss_heap.hh
deleted file mode 100644
index a6954d6..0000000
--- a/src/bliss_heap.hh
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_HEAP_HH
-#define BLISS_HEAP_HH
-
-namespace igraph {
-
-class Heap
-{
-#if defined(CONSISTENCY_CHECKS)
- unsigned int N;
-#endif
- unsigned int n;
- unsigned int *array;
- void upheap(unsigned int k);
- void downheap(unsigned int k);
-public:
- Heap() {array = 0; n = 0; }
- ~Heap();
- void init(unsigned int size);
-
- bool is_empty() const {return(n==0); }
- void clear() {n = 0;}
- void insert(unsigned int v);
- unsigned int remove();
-};
-
-}
-
-#endif
diff --git a/src/bliss_kstack.hh b/src/bliss_kstack.hh
deleted file mode 100644
index b2eb251..0000000
--- a/src/bliss_kstack.hh
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_KSTACK_H
-#define BLISS_KSTACK_H
-
-#include "bliss_defs.hh"
-#include <cstdlib> // malloc
-
-namespace igraph {
-
-/*
- * A stack with fixed capacity
- */
-template <class Type>
-class KStack {
-public:
- KStack();
- KStack(int k);
- ~KStack();
- void init(int k);
-
- bool is_empty() const {return(cursor == entries); }
- Type top() const {DEBUG_ASSERT(cursor > entries); return *cursor; }
- Type pop() {
- DEBUG_ASSERT(cursor > entries);
- Type obj = *cursor;
- cursor--;
- return obj;
- }
- void push(Type obj) {
- DEBUG_ASSERT(cursor < entries + kapacity);
- cursor++;
- *cursor = obj;
- }
- void clean() {cursor = entries; }
- unsigned int size() const {return(cursor - entries);
- }
- Type element_at(unsigned int i) {
- assert(i < size());
- return entries[i+1];
- }
- int capacity() {return kapacity; }
-private:
- int kapacity;
- Type *entries;
- Type *cursor;
-};
-
-template <class Type>
-KStack<Type>::KStack() {
- kapacity = 0;
- entries = 0;
- cursor = 0;
-}
-
-template <class Type>
-KStack<Type>::KStack(int k) {
- assert(k > 0);
- kapacity = k;
- entries = (Type*)malloc((k+1) * sizeof(Type));
- cursor = entries;
-}
-
-template <class Type>
-void KStack<Type>::init(int k) {
- assert(k > 0);
- if(entries)
- free(entries);
- kapacity = k;
- entries = (Type*)malloc((k+1) * sizeof(Type));
- cursor = entries;
-}
-
-template <class Type>
-KStack<Type>::~KStack() {
- free(entries);
-}
-
-}
-
-#endif
diff --git a/src/bliss_orbit.hh b/src/bliss_orbit.hh
deleted file mode 100644
index 6f5a3c4..0000000
--- a/src/bliss_orbit.hh
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_ORBIT_HH
-#define BLISS_ORBIT_HH
-
-namespace igraph {
-
-class Orbit
-{
-protected:
- class OrbitEntry {
- public:
- unsigned int element;
- OrbitEntry *next;
- unsigned int size;
- };
- OrbitEntry *orbits;
- OrbitEntry **in_orbit;
- unsigned int nof_elements;
- unsigned int _nof_orbits;
- void merge_orbits(OrbitEntry *o1, OrbitEntry *o2);
-public:
- Orbit();
- ~Orbit();
- void init(const unsigned int n);
- void reset();
- void merge_orbits(unsigned int e1, unsigned int e2);
- bool is_minimal_representative(unsigned int e);
- unsigned int get_minimal_representative(unsigned int e);
- unsigned int orbit_size(unsigned int e);
- unsigned int nof_orbits() const {return _nof_orbits; }
-};
-
-}
-
-#endif
diff --git a/src/bliss_partition.cc b/src/bliss_partition.cc
deleted file mode 100644
index cdea6ce..0000000
--- a/src/bliss_partition.cc
+++ /dev/null
@@ -1,917 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include <cassert>
-#include <vector>
-#include <list>
-#include "bliss_graph.hh"
-#include "bliss_partition.hh"
-
-using namespace std;
-
-namespace igraph {
-
-static const bool should_not_happen = false;
-
-Partition::Partition()
-{
- elements = 0;
- in_pos = 0;
- invariant_values = 0;
- cells = 0;
- free_cells = 0;
- element_to_cell_map = 0;
- graph = 0;
-}
-
-Partition::~Partition()
-{
- if(elements) {
- free(elements); elements = 0; }
- if(cells) {
- free(cells); cells = 0; }
- if(element_to_cell_map) {
- free(element_to_cell_map); element_to_cell_map = 0; }
- if(in_pos) {
- free(in_pos); in_pos = 0; }
- if(invariant_values) {
- free(invariant_values); invariant_values = 0; }
-}
-
-void Partition::init(const unsigned int N)
-{
- assert(N > 0);
-
- if(elements)
- free(elements);
- elements = (unsigned int*)malloc(N * sizeof(unsigned int));
- for(unsigned int i = 0; i < N; i++)
- elements[i] = i;
-
- if(in_pos)
- free(in_pos);
- in_pos = (unsigned int**)malloc(N * sizeof(unsigned int*));
- for(unsigned int i = 0; i < N; i++)
- in_pos[i] = elements + i;
-
- if(invariant_values)
- free(invariant_values);
- invariant_values = (unsigned int*)malloc(N * sizeof(unsigned int));
- for(unsigned int i = 0; i < N; i++)
- invariant_values[i] = 0;
-
- if(cells)
- free(cells);
- cells = (Cell*)malloc(N * sizeof(Cell));
-
- cells[0].first = 0;
- cells[0].length = N;
- cells[0].max_ival = 0;
- cells[0].max_ival_count = 0;
- cells[0].in_splitting_queue = false;
- cells[0].in_neighbour_heap = false;
- cells[0].next = 0;
- cells[0].prev_next_ptr = &first_cell;
- cells[0].next_nonsingleton = 0;
- cells[0].prev_nonsingleton = 0;
- cells[0].split_level = 0;
- first_cell = &cells[0];
- if(N == 1)
- first_nonsingleton_cell = 0;
- else
- first_nonsingleton_cell = &cells[0];
-
- for(unsigned int i = 1; i < N; i++)
- {
- cells[i].first = 0;
- cells[i].length = 0;
- cells[i].max_ival = 0;
- cells[i].max_ival_count = 0;
- cells[i].in_splitting_queue = false;
- cells[i].in_neighbour_heap = false;
- cells[i].next = (i < N-1)?&cells[i+1]:0;
- cells[i].prev_next_ptr = (i == 1)?&free_cells:&(cells[i-1].next);
- cells[i].next_nonsingleton = 0;
- cells[i].prev_nonsingleton = 0;
- }
- if(N > 1)
- free_cells = &cells[1];
- else
- free_cells = 0;
-
- if(element_to_cell_map)
- free(element_to_cell_map);
- element_to_cell_map = (Cell **)malloc(N * sizeof(Cell *));
- for(unsigned int i = 0; i < N; i++)
- element_to_cell_map[i] = first_cell;
-
- splitting_queue.init(N);
- refinement_stack.init(N);
- level = 0;
-}
-
-/*
- * For debugging purposes only.
- * Checks that the ordered list of nonsingleton cells is consistent.
- */
-void Partition::consistency_check()
-{
-#ifdef DEBUG
- for(const Cell *cell = first_cell; cell; cell = cell->next)
- {
- assert(cell->prev_next_ptr && *(cell->prev_next_ptr) == cell);
- }
- const bool do_print = false;
- if(do_print)
- {
- fprintf(stderr, "\nRef stack: ");
- for(unsigned int j = 0; j < refinement_stack.size(); j++)
- {
- const RefInfo i = refinement_stack.element_at(j);
- fprintf(stderr, "f%u,%d,%d ",
- i.split_cell_first,
- i.prev_nonsingleton_first,
- i.next_nonsingleton_first);
- }
- fprintf(stderr, "\n");
- for(const Cell *cell = first_nonsingleton_cell; cell;
- cell = cell->next_nonsingleton)
- {
- fprintf(stderr, "%u:%u->", cell->first, cell->length);
- if(cell->next_nonsingleton)
- assert(cell->first < cell->next_nonsingleton->first);
- }
- fprintf(stderr, "\n");
- }
- const Cell *next_nonsingleton = first_nonsingleton_cell;
- const Cell *prev_nonsingleton = 0;
- if(next_nonsingleton)
- assert(next_nonsingleton->prev_nonsingleton == 0);
- for(const Cell *cell = first_cell; cell; cell = cell->next)
- {
- assert(!cell->next || cell->next->prev_next_ptr == &(cell->next));
- if(cell->length > 1)
- {
- if(do_print)
- fprintf(stderr, "%u:%u=>", cell->first, cell->length);
- assert(cell == next_nonsingleton);
- assert(cell->prev_nonsingleton == prev_nonsingleton);
- next_nonsingleton = cell->next_nonsingleton;
- prev_nonsingleton = cell;
- if(next_nonsingleton)
- assert(next_nonsingleton->first > cell->first);
- }
- else
- {
- assert(cell != next_nonsingleton);
- assert(cell->next_nonsingleton == 0);
- assert(cell->prev_nonsingleton == 0);
- }
- }
- assert(next_nonsingleton == 0);
- if(do_print)
- fprintf(stderr, "\n");
-#endif
-}
-
-Cell *Partition::aux_split_in_two(Cell * const cell,
- const unsigned int first_half_size)
-{
- RefInfo i;
-
- DEBUG_ASSERT(first_half_size > 0);
- DEBUG_ASSERT(first_half_size < cell->length);
-
- /* (Pseudo)allocate new cell */
- Cell * const new_cell = free_cells;
- DEBUG_ASSERT(new_cell);
- free_cells = new_cell->next;
- /* Update new cell parameters */
- new_cell->first = cell->first + first_half_size;
- new_cell->length = cell->length - first_half_size;
- new_cell->next = cell->next;
- if(new_cell->next)
- new_cell->next->prev_next_ptr = &(new_cell->next);
- new_cell->prev_next_ptr = &(cell->next);
- new_cell->split_level = cell->split_level;
- /* Update old, splitted cell parameters */
- cell->length = first_half_size;
- cell->next = new_cell;
- cell->split_level = level;
-
- /* Add cell in refinement_stack for backtracking */
- i.split_cell_first = cell->first;
- if(cell->prev_nonsingleton)
- i.prev_nonsingleton_first = cell->prev_nonsingleton->first;
- else
- i.prev_nonsingleton_first = -1;
- if(cell->next_nonsingleton)
- i.next_nonsingleton_first = cell->next_nonsingleton->first;
- else
- i.next_nonsingleton_first = -1;
- refinement_stack.push(i);
-
- /* Modify nonsingleton cell list */
- if(new_cell->length > 1)
- {
- new_cell->prev_nonsingleton = cell;
- new_cell->next_nonsingleton = cell->next_nonsingleton;
- if(new_cell->next_nonsingleton)
- new_cell->next_nonsingleton->prev_nonsingleton = new_cell;
- cell->next_nonsingleton = new_cell;
- }
- else
- {
- new_cell->next_nonsingleton = 0;
- new_cell->prev_nonsingleton = 0;
- }
-
- if(cell->length == 1)
- {
- if(cell->prev_nonsingleton)
- cell->prev_nonsingleton->next_nonsingleton = cell->next_nonsingleton;
- else
- first_nonsingleton_cell = cell->next_nonsingleton;
- if(cell->next_nonsingleton)
- cell->next_nonsingleton->prev_nonsingleton = cell->prev_nonsingleton;
- cell->next_nonsingleton = 0;
- cell->prev_nonsingleton = 0;
- }
-
- return new_cell;
-}
-
-void Partition::add_in_splitting_queue(Cell * const cell)
-{
- static const unsigned int smallish_cell_threshold = 1;
- assert(!cell->in_splitting_queue);
- cell->in_splitting_queue = true;
- if(cell->length <= smallish_cell_threshold)
- splitting_queue.push_front(cell);
- else
- splitting_queue.push_back(cell);
-}
-
-
-void Partition::clear_splitting_queue()
-{
- while(!splitting_queue.is_empty())
- {
- Cell * const cell = splitting_queue.pop_front();
- assert(cell->in_splitting_queue);
- cell->in_splitting_queue = false;
- }
-}
-
-
-
-/*
- * Assumes that the invariant values are NOT the same
- * and that the cell contains more than one element
- */
-Cell *Partition::sort_and_split_cell1(Cell *cell)
-{
-#if defined(EXPENSIVE_CONSISTENCY_CHECKS)
- assert(cell->length > 1);
- assert(cell->first + cell->length <= graph->get_nof_vertices());
- bool found0 = false, found1 = false;
- for(unsigned int i = 0; i < cell->length; i++)
- {
- if(invariant_values[elements[cell->first + i]] == 0)
- found0 = true;
- else if(invariant_values[elements[cell->first + i]] == 1)
- found1 = true;
- else
- assert(should_not_happen);
- }
- assert(found0);
- assert(found1);
-#endif
-
- consistency_check();
-
- /* Allocate new cell */
- Cell *new_cell = free_cells;
- DEBUG_ASSERT(new_cell);
- free_cells = new_cell->next;
- if(free_cells) free_cells->prev_next_ptr = &(free_cells);
-
- /* Sort vertices in the cell according to the invariant values */
- unsigned int *ep0 = elements + cell->first;
- unsigned int *ep1 = ep0 + cell->length;
- while(ep1 > ep0)
- {
- const unsigned int element = *ep0;
- const unsigned int ival = invariant_values[element];
- invariant_values[element] = 0;
- DEBUG_ASSERT(ival <= 1);
- DEBUG_ASSERT(element_to_cell_map[element] == cell);
- DEBUG_ASSERT(in_pos[element] == ep0);
- if(ival == 0)
- {
- ep0++;
- }
- else
- {
- ep1--;
- *ep0 = *ep1;
- *ep1 = element;
- element_to_cell_map[element] = new_cell;
- in_pos[element] = ep1;
- in_pos[*ep0] = ep0;
- }
- }
-
- DEBUG_ASSERT(ep1 != elements + cell->first);
- DEBUG_ASSERT(ep0 != elements + cell->first + cell->length);
-
- /* Update new cell parameters */
- new_cell->first = ep1 - elements;
- new_cell->length = cell->length - (new_cell->first - cell->first);
- new_cell->next = cell->next;
- if(new_cell->next)
- new_cell->next->prev_next_ptr = &(new_cell->next);
- new_cell->prev_next_ptr = &(cell->next);
- new_cell->split_level = cell->split_level;
- /* Update old, splitted cell parameters */
- cell->length = new_cell->first - cell->first;
- cell->next = new_cell;
- cell->split_level = level;
-
- /* Add cell in refinement stack for backtracking */
- {
- RefInfo i;
- i.split_cell_first = cell->first;
- if(cell->prev_nonsingleton)
- i.prev_nonsingleton_first = cell->prev_nonsingleton->first;
- else
- i.prev_nonsingleton_first = -1;
- if(cell->next_nonsingleton)
- i.next_nonsingleton_first = cell->next_nonsingleton->first;
- else
- i.next_nonsingleton_first = -1;
- /* Modify nonsingleton cell list */
- if(new_cell->length > 1)
- {
- new_cell->prev_nonsingleton = cell;
- new_cell->next_nonsingleton = cell->next_nonsingleton;
- if(new_cell->next_nonsingleton)
- new_cell->next_nonsingleton->prev_nonsingleton = new_cell;
- cell->next_nonsingleton = new_cell;
- }
- else
- {
- new_cell->next_nonsingleton = 0;
- new_cell->prev_nonsingleton = 0;
- }
- if(cell->length == 1)
- {
- if(cell->prev_nonsingleton)
- cell->prev_nonsingleton->next_nonsingleton = cell->next_nonsingleton;
- else
- first_nonsingleton_cell = cell->next_nonsingleton;
- if(cell->next_nonsingleton)
- cell->next_nonsingleton->prev_nonsingleton = cell->prev_nonsingleton;
- cell->next_nonsingleton = 0;
- cell->prev_nonsingleton = 0;
- }
- refinement_stack.push(i);
- }
-
-
- /* Add cells in splitting queue */
- DEBUG_ASSERT(!new_cell->in_splitting_queue);
- if(cell->in_splitting_queue) {
- /* Both cells must be included in splitting_queue in order to have
- refinement to equitable partition */
- add_in_splitting_queue(new_cell);
- } else {
- Cell *min_cell, *max_cell;
- if(cell->length <= new_cell->length) {
- min_cell = cell;
- max_cell = new_cell;
- } else {
- min_cell = new_cell;
- max_cell = cell;
- }
- /* Put the smaller cell in splitting_queue */
- add_in_splitting_queue(min_cell);
- if(max_cell->length == 1) {
- /* Put the "larger" cell also in splitting_queue */
- add_in_splitting_queue(max_cell);
- }
- }
-
- consistency_check();
-
- return new_cell;
-}
-
-
-
-/*
- * Tables and a subroutine for distribution count sorting
- */
-static IGRAPH_THREAD_LOCAL unsigned int count[256] = {
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
- 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
-};
-static IGRAPH_THREAD_LOCAL unsigned int start[256];
-
-/*
- * Build start array so that start[0] = 0 and start[i+1] = start[i] + count[i]
- */
-static void cumulate_count(const unsigned int max)
-{
- DEBUG_ASSERT(max <= 255);
- unsigned int *count_p = count;
- unsigned int *start_p = start;
- unsigned int sum = 0;
- for(unsigned int i = max+1; i > 0; i--)
- {
- *start_p = sum;
- start_p++;
- sum += *count_p;
- count_p++;
- }
-}
-
-
-/*
- * Distribution count sorting of cells with invariant values less than 256
- */
-Cell *Partition::sort_and_split_cell255(Cell * const cell,
- const unsigned int max_ival)
-{
- //DEBUG_ASSERT(cell->first + cell->length <= graph->vertices.size());
-
- DEBUG_ASSERT(max_ival <= 255);
-
- if(cell->length == 1)
- {
- /* Reset invariant value */
- invariant_values[elements[cell->first]] = 0;
- return cell;
- }
-
-#ifdef CONSISTENCY_CHECKS
- for(unsigned int i = 0; i < 256; i++)
- assert(count[i] == 0);
-#endif
-
- /*
- * Compute the distribution of invariant values to the count array
- */
- {
- const unsigned int *ep = elements + cell->first;
- DEBUG_ASSERT(element_to_cell_map[*ep] == cell);
- const unsigned int ival = invariant_values[*ep];
- DEBUG_ASSERT(ival <= 255);
- count[ival]++;
- ep++;
-#ifdef CONSISTENCY_CHECKS
- bool equal_invariant_values = true;
-#endif
- for(unsigned int i = cell->length - 1; i > 0; i--)
- {
- DEBUG_ASSERT(element_to_cell_map[*ep] == cell);
- const unsigned int ival2 = invariant_values[*ep];
- DEBUG_ASSERT(ival2 <= 255);
- DEBUG_ASSERT(ival2 <= max_ival);
- count[ival2]++;
-#ifdef CONSISTENCY_CHECKS
- if(ival2 != ival) {
- equal_invariant_values = false;
- }
-#endif
- ep++;
- }
-#ifdef CONSISTENCY_CHECKS
- DEBUG_ASSERT(!equal_invariant_values);
- if(equal_invariant_values) {
- DEBUG_ASSERT(count[ival] == cell->length);
- count[ival] = 0;
- clear_ivs(cell);
- return cell;
- }
-#endif
- }
-
- /* Build start array */
- cumulate_count(max_ival);
-
- //DEBUG_ASSERT(start[255] + count[255] == cell->length);
- DEBUG_ASSERT(start[max_ival] + count[max_ival] == cell->length);
-
- /* Do the sorting */
- for(unsigned int i = 0; i <= max_ival; i++)
- {
- unsigned int *ep = elements + cell->first + start[i];
- for(unsigned int j = count[i]; j > 0; j--)
- {
- while(true)
- {
- const unsigned int element = *ep;
- const unsigned int ival = invariant_values[element];
- if(ival == i)
- break;
- DEBUG_ASSERT(ival > i);
- DEBUG_ASSERT(count[ival] > 0);
- *ep = elements[cell->first + start[ival]];
- elements[cell->first + start[ival]] = element;
- start[ival]++;
- count[ival]--;
- }
- ep++;
- }
- count[i] = 0;
- }
-
-#if defined(CONSISTENCY_CHECKS)
- for(unsigned int i = 0; i < 256; i++)
- assert(count[i] == 0);
-#endif
-
-#if defined(VERBOSEDEBUG)
- {
- const unsigned int *ep = elements + cell->first;
- fprintf(stderr, "\n");
- for(unsigned int i = cell->length; i > 0; i--, ep++)
- fprintf(stderr, "%u ", invariant_values[*ep]);
- fprintf(stderr, "\n");
- }
-#endif
-
- /* split cell */
- Cell * const cell2 = split_cell(cell);
- DEBUG_ASSERT(cell2 != cell);
- return cell2;
-}
-
-
-/*
- * Sort the elements in a cell according to their invariant values
- * The invariant values are not cleared
- * Warning: the in_pos array is left in incorrect state
- */
-bool Partition::shellsort_cell(Cell *cell)
-{
- unsigned int h;
- unsigned int *ep;
-
- //DEBUG_ASSERT(cell->first + cell->length <= graph->vertices.size());
-
- if(cell->length == 1)
- return false;
-
- /* Check whether all the elements have the same invariant value */
- bool equal_invariant_values = true;
- {
- ep = elements + cell->first;
- const unsigned int ival = invariant_values[*ep];
- DEBUG_ASSERT(element_to_cell_map[*ep] == cell);
- ep++;
- for(unsigned int i = cell->length - 1; i > 0; i--)
- {
- DEBUG_ASSERT(element_to_cell_map[*ep] == cell);
- if(invariant_values[*ep] != ival) {
- equal_invariant_values = false;
- break;
- }
- ep++;
- }
- }
- if(equal_invariant_values)
- return false;
-
- ep = elements + cell->first;
-
- for(h = 1; h <= cell->length/9; h = 3*h + 1)
- ;
- for( ; h > 0; h = h/3) {
- for(unsigned int i = h; i < cell->length; i++) {
- const unsigned int element = ep[i];
- const unsigned int ival = invariant_values[element];
- unsigned int j = i;
- while(j >= h && invariant_values[ep[j-h]] > ival) {
- ep[j] = ep[j-h];
- j -= h;
- }
- ep[j] = element;
- }
- }
- return true;
-}
-
-
-void Partition::clear_ivs(Cell * const cell)
-{
- unsigned int *ep = elements + cell->first;
- for(unsigned int i = cell->length; i > 0; i--, ep++)
- invariant_values[*ep] = 0;
-}
-
-
-/*
- * Assumes that the elements in the cell are sorted according to their
- * invariant values
- */
-Cell *Partition::split_cell(Cell * const original_cell)
-{
- Cell *cell = original_cell;
- const bool original_cell_was_in_splitting_queue =
- original_cell->in_splitting_queue;
- Cell *largest_new_cell = 0;
-
- consistency_check();
-
- while(true)
- {
- unsigned int *ep = elements + cell->first;
- const unsigned int * const lp = ep + cell->length;
- const unsigned int ival = invariant_values[*ep];
- invariant_values[*ep] = 0;
- element_to_cell_map[*ep] = cell;
- in_pos[*ep] = ep;
- ep++;
- while(ep < lp)
- {
- const unsigned int e = *ep;
- if(invariant_values[e] != ival)
- break;
- invariant_values[e] = 0;
- in_pos[e] = ep;
- ep++;
- element_to_cell_map[e] = cell;
- }
- if(ep == lp)
- break;
-
- Cell * const new_cell = aux_split_in_two(cell, (ep - elements) - cell->first);
-
- if(graph->in_search)
- {
- graph->eqref_hash.update(new_cell->first);
- graph->eqref_hash.update(new_cell->length);
- graph->eqref_hash.update(ival);
- }
-
- /* Add cells in splitting_queue */
- assert(!new_cell->in_splitting_queue);
- if(original_cell_was_in_splitting_queue)
- {
- /* In this case, all new cells are inserted in splitting_queue */
- assert(cell->in_splitting_queue);
- add_in_splitting_queue(new_cell);
- }
- else
- {
- /* Otherwise, we can omit one new cell from splitting_queue */
- assert(!cell->in_splitting_queue);
- if(largest_new_cell == 0) {
- largest_new_cell = cell;
- } else {
- assert(!largest_new_cell->in_splitting_queue);
- if(cell->length > largest_new_cell->length) {
- add_in_splitting_queue(largest_new_cell);
- largest_new_cell = cell;
- } else {
- add_in_splitting_queue(cell);
- }
- }
- }
- /* Process the rest of the cell */
- cell = new_cell;
- }
-
- consistency_check();
-
- if(original_cell == cell) {
- /* All the elements in cell had the same invariant value */
- return cell;
- }
-
- /* Add cells in splitting_queue */
- if(!original_cell_was_in_splitting_queue)
- {
- /* Also consider the last new cell */
- assert(largest_new_cell);
- if(cell->length > largest_new_cell->length)
- {
- add_in_splitting_queue(largest_new_cell);
- largest_new_cell = cell;
- }
- else
- {
- add_in_splitting_queue(cell);
- }
- if(largest_new_cell->length == 1)
- {
- /* Needed in certificate computation */
- add_in_splitting_queue(largest_new_cell);
- }
- }
-
- return cell;
-}
-
-
-Cell *Partition::zplit_cell(Cell * const cell, const bool max_ival_info_ok)
-{
- assert(cell);
-
- Cell *last_new_cell = cell;
-
- if(!max_ival_info_ok)
- {
- /* Compute max_ival info */
- assert(cell->max_ival == 0);
- assert(cell->max_ival_count == 0);
- unsigned int *ep = elements + cell->first;
- for(unsigned int i = cell->length; i > 0; i--, ep++)
- {
- const unsigned int ival = invariant_values[*ep];
- if(ival > cell->max_ival)
- {
- cell->max_ival = ival;
- cell->max_ival_count = 1;
- }
- else if(ival == cell->max_ival)
- {
- cell->max_ival_count++;
- }
- }
- }
-
-#ifdef CONSISTENCY_CHECKS
- /* Verify max_ival info */
- {
- unsigned int max_ival = 0;
- unsigned int max_ival_count = 0;
- unsigned int *ep = elements + cell->first;
- for(unsigned int i = cell->length; i > 0; i--, ep++)
- {
- const unsigned int ival = invariant_values[*ep];
- if(ival > max_ival)
- {
- max_ival = ival;
- max_ival_count = 1;
- }
- else if(ival == max_ival)
- {
- max_ival_count++;
- }
- }
- assert(max_ival == cell->max_ival);
- assert(max_ival_count == cell->max_ival_count);
- }
-#endif
-
- /* max_ival info has been computed */
-
- if(cell->max_ival_count == cell->length)
- {
- /* All invariant values are the same */
- if(cell->max_ival > 0)
- clear_ivs(cell);
- goto done;
- }
-
- /* All invariant values are not the same */
- if(cell->max_ival == 1)
- {
- /* Specialized splitting for cells with binary invariant values */
- last_new_cell = sort_and_split_cell1(cell);
- goto done;
- }
- if(cell->max_ival < 256)
- {
- /* Specialized splitting for cells with invariant values < 256 */
- last_new_cell = sort_and_split_cell255(cell, cell->max_ival);
- goto done;
- }
- {
- /* Generic sorting and splitting */
- const bool sorted = shellsort_cell(cell);
- assert(sorted);
- last_new_cell = split_cell(cell);
- goto done;
- }
-
- done:
- cell->max_ival = 0;
- cell->max_ival_count = 0;
- return last_new_cell;
-}
-
-
-
-
-
-
-void Partition::unrefine(unsigned int dest_split_level,
- unsigned int dest_refinement_stack_size)
-{
- assert(refinement_stack.size() >= dest_refinement_stack_size);
- while(refinement_stack.size() > dest_refinement_stack_size)
- {
- RefInfo i = refinement_stack.pop();
- const unsigned int first = i.split_cell_first;
- //const unsigned int first = refinement_stack.pop();
- Cell *cell = element_to_cell_map[elements[first]];
-
- if(cell->first != first) {
- assert(cell->split_level <= dest_split_level);
- goto done;
- }
- if(cell->split_level <= dest_split_level) {
- goto done;
- }
-
- {
- const unsigned int new_first = cell->first;
- do
- {
- Cell * const next_cell = cell->next;
- assert(next_cell);
- /* (Pseudo)free cell */
- cell->first = 0;
- cell->length = 0;
- cell->next->prev_next_ptr = cell->prev_next_ptr;
- *(cell->prev_next_ptr) = cell->next;
- cell->next = free_cells;
- if(cell->next)
- cell->next->prev_next_ptr = &(cell->next);
- cell->prev_next_ptr = &free_cells;
- free_cells = cell;
-
- cell = next_cell;
- }
- while(cell->split_level > dest_split_level);
- /* Update element_to_cell_map values of elements added in cell */
- unsigned int *ep = elements + new_first;
- unsigned int * const lp = elements + cell->first;
- while(ep < lp) {
- element_to_cell_map[*ep] = cell;
- ep++;
- }
- /* Update cell parameters */
- cell->length = (cell->first + cell->length) - new_first;
- cell->first = new_first;
- }
-
- done:
- if(i.prev_nonsingleton_first >= 0)
- {
- Cell * const prev_cell = element_to_cell_map[elements[i.prev_nonsingleton_first]];
- DEBUG_ASSERT(prev_cell->length > 1);
- cell->prev_nonsingleton = prev_cell;
- prev_cell->next_nonsingleton = cell;
- }
- else
- {
- //assert(cell->prev_nonsingleton == 0);
- cell->prev_nonsingleton = 0;
- first_nonsingleton_cell = cell;
- }
-
- if(i.next_nonsingleton_first >= 0)
- {
- Cell * const next_cell = element_to_cell_map[elements[i.next_nonsingleton_first]];
- DEBUG_ASSERT(next_cell->length > 1);
- cell->next_nonsingleton = next_cell;
- next_cell->prev_nonsingleton = cell;
- }
- else
- {
- //assert(cell->next_nonsingleton == 0);
- cell->next_nonsingleton = 0;
- }
- }
-
- consistency_check();
-}
-
-}
diff --git a/src/bliss_partition.hh b/src/bliss_partition.hh
deleted file mode 100644
index 4059d8a..0000000
--- a/src/bliss_partition.hh
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_PARTITION_HH
-#define BLISS_PARTITION_HH
-
-namespace igraph {
-
-class Cell;
-class Partition;
-
-}
-
-#include <cstdlib>
-#include "bliss_kstack.hh"
-#include "bliss_kqueue.hh"
-#include "bliss_heap.hh"
-#include "bliss_orbit.hh"
-#include "bliss_graph.hh"
-
-namespace igraph {
-
-class Cell
-{
-public:
- /* Index of the first element of the cell in the Partition::elements array */
- unsigned int first;
- unsigned int length;
- unsigned int max_ival;
- unsigned int max_ival_count;
- bool in_neighbour_heap;
- bool in_splitting_queue;
- Cell *next;
- Cell **prev_next_ptr;
- Cell *next_nonsingleton;
- Cell *prev_nonsingleton;
- unsigned int split_level;
-};
-
-
-class Partition
-{
-public:
- AbstractGraph *graph;
-
- /* Used during equitable partition refinement */
- KQueue<Cell *> splitting_queue;
- void add_in_splitting_queue(Cell * const cell);
- void clear_splitting_queue();
-
- class RefInfo {
- public:
- unsigned int split_cell_first;
- int prev_nonsingleton_first;
- int next_nonsingleton_first;
- };
-
- /* Used for unrefinement */
- KStack<RefInfo> refinement_stack;
-
- Cell *aux_split_in_two(Cell * const cell,
- const unsigned int first_half_size);
-
- /* The current search level */
- unsigned int level;
-
- void unrefine(unsigned int dest_level, unsigned int dest_split_stack_size);
-
- void consistency_check();
-public:
- Cell *cells;
- Cell *free_cells;
- Cell *first_cell;
- Cell *first_nonsingleton_cell;
- unsigned int *elements;
- unsigned int *invariant_values;
- /* element_to_cell_map[e] gives the cell of element e */
- Cell **element_to_cell_map;
- /* in_pos[e] points to the elements array s.t. *in_pos[e] = e */
- unsigned int **in_pos;
-
- Partition();
- ~Partition();
- void init(const unsigned int);
-
- bool is_discrete() const {return(free_cells == 0); }
-
- /*
- * Splits "cell" into [cell_1,...,cell_n] so that &cell_1 == &cell
- * according to the invariant_values of elements in the cell
- * Returns cell_n which is different from "cell" iff
- * the cell was actually splitted.
- * max_ival_info_ok indicates that the max_ival and max_ival_count fields
- * in cell have proper values
- * Clears the invariant values of elements in cell and cell's max_ival and
- * max_ival_count fields
- */
- Cell *zplit_cell(Cell * const cell, const bool max_ival_info_ok);
-
-private:
- /* Auxiliary routines for sorting and splitting cells */
- void clear_ivs(Cell * const cell);
- Cell *sort_and_split_cell1(Cell *cell);
- Cell *sort_and_split_cell255(Cell * const cell, const unsigned int max_ival);
- bool shellsort_cell(Cell *cell);
- Cell *split_cell(Cell * const cell);
-};
-
-}
-
-#endif
diff --git a/src/bliss_timer.cc b/src/bliss_timer.cc
deleted file mode 100644
index 6a57e12..0000000
--- a/src/bliss_timer.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include <unistd.h>
-#ifdef HAVE_TIMES_H
-#include <sys/times.h>
-#else
-#include <ctime>
-#endif
-#include "bliss_timer.hh"
-
-using namespace std;
-
-namespace igraph {
-
-#ifdef HAVE_TIMES_H
-static const double numTicksPerSec = (double)(sysconf(_SC_CLK_TCK));
-#else
-static const double numTicksPerSec = CLOCKS_PER_SEC;
-#endif
-
-Timer::Timer()
-{
- start_time = 0.0;
- end_time = 0.0;
-}
-
-void Timer::start()
-{
-
-#ifdef HAVE_TIMES_H
- struct tms clkticks;
-
- times(&clkticks);
- start_time =
- ((double) clkticks.tms_utime + (double) clkticks.tms_stime) /
- numTicksPerSec;
-
-#else
-
- clock_t clkticks;
-
- clkticks=clock();
- start_time = (double)clkticks / numTicksPerSec;
-
-#endif
-}
-
-void Timer::stop()
-{
-#ifdef HAVE_TIMES_H
- struct tms clkticks;
-
- times(&clkticks);
- end_time =
- ((double) clkticks.tms_utime + (double) clkticks.tms_stime) /
- numTicksPerSec;
-#else
-
- clock_t clkticks;
-
- clkticks=clock();
- end_time = (double)clkticks / numTicksPerSec;
-
-#endif
-}
-
-double Timer::get_intermediate()
-{
-#ifdef HAVE_TIMES_H
- struct tms clkticks;
-
- times(&clkticks);
- double intermediate =
- ((double) clkticks.tms_utime + (double) clkticks.tms_stime) /
- numTicksPerSec;
-
-#else
-
- clock_t clkticks;
-
- clkticks=clock();
- double intermediate = (double)clkticks / numTicksPerSec;
-
-#endif
-
- return intermediate - start_time;
-}
-
-double Timer::get_duration()
-{
- return(end_time - start_time);
-}
-
-}
diff --git a/src/bliss_timer.hh b/src/bliss_timer.hh
deleted file mode 100644
index bffee57..0000000
--- a/src/bliss_timer.hh
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_TIMER_HH
-#define BLISS_TIMER_HH
-
-namespace igraph {
-
-class Timer
-{
- double start_time, end_time;
-public:
- Timer();
- void start();
- void stop();
- double get_intermediate();
- double get_duration();
-};
-
-}
-
-#endif
diff --git a/src/bliss_utils.cc b/src/bliss_utils.cc
deleted file mode 100644
index a5cc763..0000000
--- a/src/bliss_utils.cc
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#include "bliss_utils.hh"
-#include "bliss_bignum.hh"
-
-using namespace std;
-
-#include <cstring>
-
-#if defined(BLISS_USE_GMP)
-
-namespace igraph {
-
-int BigNum::tostring(char **str) {
- *str=igraph_Calloc(mpz_sizeinbase(v, 10)+2, char);
- if (! *str) {
- IGRAPH_ERROR("Cannot convert big number to string", IGRAPH_ENOMEM);
- }
- mpz_get_str(*str, 10, v);
- return 0;
-}
-
-}
-
-#else
-
-namespace igraph {
-
-int BigNum::tostring(char **str) {
- int size=static_cast<int>( (log(abs(v))/log(10.0))+4 );
- *str=igraph_Calloc(size, char );
- if (! *str) {
- IGRAPH_ERROR("Cannot convert big number to string", IGRAPH_ENOMEM);
- }
- std::stringstream ss;
- ss << v;
- strncpy(*str, ss.str().c_str(), size);
- return 0;
-}
-
-}
-
-#endif
diff --git a/src/bliss_utils.hh b/src/bliss_utils.hh
deleted file mode 100644
index 04e1be9..0000000
--- a/src/bliss_utils.hh
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-Copyright (C) 2003-2006 Tommi Junttila
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License version 2
- as published by the Free Software Foundation.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-/* FSF address fixed in the above notice on 1 Oct 2009 by Tamas Nepusz */
-
-#ifndef BLISS_UTILS_HH
-#define BLISS_UTILS_HH
-
-#endif
diff --git a/src/cattributes.c b/src/cattributes.c
index 4018f57..7c41c17 100644
--- a/src/cattributes.c
+++ b/src/cattributes.c
@@ -1366,7 +1366,7 @@ int igraph_i_cattribute_combine_vertices(const igraph_t *graph,
long int valno=igraph_vector_ptr_size(val);
long int i, j, keepno=0;
int *TODO;
- void **funcs;
+ igraph_function_pointer_t *funcs;
TODO=igraph_Calloc(valno, int);
if (!TODO) {
@@ -1374,7 +1374,7 @@ int igraph_i_cattribute_combine_vertices(const igraph_t *graph,
IGRAPH_ENOMEM);
}
IGRAPH_FINALLY(igraph_free, TODO);
- funcs=igraph_Calloc(valno, void*);
+ funcs=igraph_Calloc(valno, igraph_function_pointer_t);
if (!funcs) {
IGRAPH_ERROR("Cannot combine vertex attributes",
IGRAPH_ENOMEM);
@@ -1385,7 +1385,7 @@ int igraph_i_cattribute_combine_vertices(const igraph_t *graph,
igraph_attribute_record_t *oldrec=VECTOR(*val)[i];
const char *name=oldrec->name;
igraph_attribute_combination_type_t todo;
- void *voidfunc;
+ igraph_function_pointer_t voidfunc;
igraph_attribute_combination_query(comb, name, &todo, &voidfunc);
TODO[i]=todo;
funcs[i]=voidfunc;
@@ -1974,7 +1974,7 @@ int igraph_i_cattribute_combine_edges(const igraph_t *graph,
long int ealno=igraph_vector_ptr_size(eal);
long int i, j, keepno=0;
int *TODO;
- void **funcs;
+ igraph_function_pointer_t *funcs;
TODO=igraph_Calloc(ealno, int);
if (!TODO) {
@@ -1982,7 +1982,7 @@ int igraph_i_cattribute_combine_edges(const igraph_t *graph,
IGRAPH_ENOMEM);
}
IGRAPH_FINALLY(igraph_free, TODO);
- funcs=igraph_Calloc(ealno, void*);
+ funcs=igraph_Calloc(ealno, igraph_function_pointer_t);
if (!funcs) {
IGRAPH_ERROR("Cannot combine edge attributes",
IGRAPH_ENOMEM);
@@ -1993,7 +1993,7 @@ int igraph_i_cattribute_combine_edges(const igraph_t *graph,
igraph_attribute_record_t *oldrec=VECTOR(*eal)[i];
const char *name=oldrec->name;
igraph_attribute_combination_type_t todo;
- void *voidfunc;
+ igraph_function_pointer_t voidfunc;
igraph_attribute_combination_query(comb, name, &todo, &voidfunc);
TODO[i]=todo;
funcs[i]=voidfunc;
diff --git a/src/centrality.c b/src/centrality.c
index d8ac030..8d40a07 100644
--- a/src/centrality.c
+++ b/src/centrality.c
@@ -2421,8 +2421,8 @@ int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res
* </para><para>
* The closeness centrality of a vertex measures how easily other
* vertices can be reached from it (or the other way: how easily it
- * can be reached from the other vertices). It is defined as the
- * number of the number of vertices minus one divided by the sum of the
+ * can be reached from the other vertices). It is defined as
+ * the number of vertices minus one divided by the sum of the
* lengths of all geodesics from/to the given vertex.
*
* </para><para>
@@ -2599,8 +2599,8 @@ int igraph_i_closeness_estimate_weighted(const igraph_t *graph,
* </para><para>
* The closeness centrality of a vertex measures how easily other
* vertices can be reached from it (or the other way: how easily it
- * can be reached from the other vertices). It is defined as the
- * number of the number of vertices minus one divided by the sum of the
+ * can be reached from the other vertices). It is defined as
+ * the number of vertices minus one divided by the sum of the
* lengths of all geodesics from/to the given vertex. When estimating
* closeness centrality, igraph considers paths having a length less than
* or equal to a prescribed cutoff value.
diff --git a/src/cliquer/README b/src/cliquer/README
new file mode 100644
index 0000000..8eb21f1
--- /dev/null
+++ b/src/cliquer/README
@@ -0,0 +1,61 @@
+
+Cliquer - routines for clique searching
+---------------------------------------
+
+
+Cliquer is a set of C routines for finding cliques in an arbitrary
+weighted graph. It uses an exact branch-and-bound algorithm recently
+developed by Patric Ostergard. It is designed with the aim of being
+efficient while still being flexible and easy to use.
+
+Cliquer was developed on Linux, and it should compile without
+modification on most modern UNIX systems. Other operating systems may
+require minor changes to the source code.
+
+Features:
+
+ * support for both weighted and unweighted graphs (faster routines
+ for unweighted graphs)
+ * search for maximum clique / maximum-weight clique
+ * search for clique with size / weight within a given range
+ * restrict search to maximal cliques
+ * store found cliques in memory
+ * call a user-defined function for every clique found
+ * Cliquer is re-entrant, so you can use the clique-searching
+ functions from within the callback function
+
+The full documentation can be obtained via the www page of
+Cliquer <http://www.tkk.fi/~pat/cliquer.html>.
+
+
+License
+
+Cliquer is Copyright (C) 2002 Sampo Niskanen, Patric Ostergard.
+
+Cliquer is licensed under the GNU General Public License as published
+by the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version. The full license is included in
+the file LICENSE.
+
+Basically, you can use Cliquer for any purpose, provided that any
+programs or modifications you make and distribute are also licensed
+under the GNU GPL.
+
+ABSOLUTELY NO GUARANTEES OR WARRANTIES are made concerning the
+suitability, correctness, or any other aspect of these routines.
+
+
+Contact
+
+Cliquer was mainly written by Sampo Niskanen <sampo.niskanen at iki.fi>.
+
+For bug-fixes, feedback, and, in particular, for putting your
+name on the mailing list for important information regarding Cliquer,
+please contact:
+
+Patric Ostergard
+Department of Communications and Networking
+Aalto University
+P.O. Box 13000, 00076 Aalto
+FINLAND
+<patric.ostergard at tkk.fi>
diff --git a/src/cliquer/cliquer.c b/src/cliquer/cliquer.c
new file mode 100644
index 0000000..f5081e7
--- /dev/null
+++ b/src/cliquer/cliquer.c
@@ -0,0 +1,1777 @@
+
+/*
+ * This file contains the clique searching routines.
+ *
+ * Copyright (C) 2002 Sampo Niskanen, Patric �sterg�rd.
+ * Licensed under the GNU GPL, read the file LICENSE for details.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+/*
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/times.h>
+*/
+
+#include "cliquer.h"
+
+#include "config.h"
+
+#ifdef USING_R
+#include <R.h>
+#endif
+
+/* Default cliquer options */
+IGRAPH_THREAD_LOCAL clique_options clique_default_options = {
+ reorder_by_default, NULL, /*clique_print_time*/ NULL, NULL, NULL, NULL, NULL, 0
+};
+
+
+/* Calculate d/q, rounding result upwards/downwards. */
+#define DIV_UP(d,q) (((d)+(q)-1)/(q))
+#define DIV_DOWN(d,q) ((int)((d)/(q)))
+
+
+/* Global variables used: */
+/* These must be saved and restored in re-entrance. */
+static IGRAPH_THREAD_LOCAL int *clique_size; /* c[i] == max. clique size in {0,1,...,i-1} */
+static IGRAPH_THREAD_LOCAL set_t current_clique; /* Current clique being searched. */
+static IGRAPH_THREAD_LOCAL set_t best_clique; /* Largest/heaviest clique found so far. */
+/*static struct tms cputimer;*/ /* Timer for opts->time_function() */
+/*static struct timeval realtimer;*/ /* Timer for opts->time_function() */
+static IGRAPH_THREAD_LOCAL int clique_list_count=0; /* No. of cliques in opts->clique_list[] */
+static IGRAPH_THREAD_LOCAL int weight_multiplier=1; /* Weights multiplied by this when passing
+ * to time_function(). */
+
+/* List cache (contains memory blocks of size g->n * sizeof(int)) */
+static IGRAPH_THREAD_LOCAL int **temp_list=NULL;
+static IGRAPH_THREAD_LOCAL int temp_count=0;
+
+
+/*
+ * Macros for re-entrance. ENTRANCE_SAVE() must be called immediately
+ * after variable definitions, ENTRANCE_RESTORE() restores global
+ * variables to original values. entrance_level should be increased
+ * and decreased accordingly.
+ */
+static IGRAPH_THREAD_LOCAL int entrance_level=0; /* How many levels for entrance have occurred? */
+
+#define ENTRANCE_SAVE() \
+int *old_clique_size = clique_size; \
+set_t old_current_clique = current_clique; \
+set_t old_best_clique = best_clique; \
+int old_clique_list_count = clique_list_count; \
+int old_weight_multiplier = weight_multiplier; \
+int **old_temp_list = temp_list; \
+int old_temp_count = temp_count; \
+/*struct tms old_cputimer; \
+struct timeval old_realtimer; \
+memcpy(&old_cputimer,&cputimer,sizeof(struct tms)); \
+memcpy(&old_realtimer,&realtimer,sizeof(struct timeval));*/
+
+#define ENTRANCE_RESTORE() \
+clique_size = old_clique_size; \
+current_clique = old_current_clique; \
+best_clique = old_best_clique; \
+clique_list_count = old_clique_list_count; \
+weight_multiplier = old_weight_multiplier; \
+temp_list = old_temp_list; \
+temp_count = old_temp_count; \
+/*memcpy(&cputimer,&old_cputimer,sizeof(struct tms)); \
+memcpy(&realtimer,&old_realtimer,sizeof(struct timeval));*/
+
+
+/* Number of clock ticks per second (as returned by sysconf(_SC_CLK_TCK)) */
+/*static int clocks_per_sec=0;*/
+
+
+
+
+/* Recursion and helper functions */
+static boolean sub_unweighted_single(int *table, int size, int min_size,
+ graph_t *g);
+static int sub_unweighted_all(int *table, int size, int min_size, int max_size,
+ boolean maximal, graph_t *g,
+ clique_options *opts);
+static int sub_weighted_all(int *table, int size, int weight,
+ int current_weight, int prune_low, int prune_high,
+ int min_weight, int max_weight, boolean maximal,
+ graph_t *g, clique_options *opts);
+
+
+static boolean store_clique(set_t clique, graph_t *g, clique_options *opts);
+static boolean is_maximal(set_t clique, graph_t *g);
+static boolean false_function(set_t clique,graph_t *g,clique_options *opts);
+
+
+
+
+
+/***** Unweighted searches *****/
+/*
+ * Unweighted searches are done separately from weighted searches because
+ * some effective pruning methods can be used when the vertex weights
+ * are all 1. Single and all clique finding routines are separated,
+ * because the single clique finding routine can store the found clique
+ * while it is returning from the recursion, thus requiring no implicit
+ * storing of the current clique. When searching for all cliques the
+ * current clique must be stored.
+ */
+
+
+/*
+ * unweighted_clique_search_single()
+ *
+ * Searches for a single clique of size min_size. Stores maximum clique
+ * sizes into clique_size[].
+ *
+ * table - the order of the vertices in g to use
+ * min_size - minimum size of clique to search for. If min_size==0,
+ * searches for a maximum clique.
+ * g - the graph
+ * opts - time printing options
+ *
+ * opts->time_function is called after each base-level recursion, if
+ * non-NULL.
+ *
+ * Returns the size of the clique found, or 0 if min_size>0 and a clique
+ * of that size was not found (or if time_function aborted the search).
+ * The largest clique found is stored in current_clique.
+ *
+ * Note: Does NOT use opts->user_function of opts->clique_list.
+ */
+static int unweighted_clique_search_single(int *table, int min_size,
+ graph_t *g, clique_options *opts) {
+ /*
+ struct tms tms;
+ struct timeval timeval;
+ */
+ int i,j;
+ int v,w;
+ int *newtable;
+ int newsize;
+
+ v=table[0];
+ clique_size[v]=1;
+ set_empty(current_clique);
+ SET_ADD_ELEMENT(current_clique,v);
+ if (min_size==1)
+ return 1;
+
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+ for (i=1; i < g->n; i++) {
+ w=v;
+ v=table[i];
+
+ newsize=0;
+ for (j=0; j<i; j++) {
+ if (GRAPH_IS_EDGE(g, v, table[j])) {
+ newtable[newsize]=table[j];
+ newsize++;
+ }
+ }
+
+ if (sub_unweighted_single(newtable,newsize,clique_size[w],g)) {
+ SET_ADD_ELEMENT(current_clique,v);
+ clique_size[v]=clique_size[w]+1;
+ } else {
+ clique_size[v]=clique_size[w];
+ }
+
+ /*
+ if (opts && opts->time_function) {
+ gettimeofday(&timeval,NULL);
+ times(&tms);
+ if (!opts->time_function(entrance_level,
+ i+1,g->n,clique_size[v] *
+ weight_multiplier,
+ (double)(tms.tms_utime-
+ cputimer.tms_utime)/
+ clocks_per_sec,
+ timeval.tv_sec-
+ realtimer.tv_sec+
+ (double)(timeval.tv_usec-
+ realtimer.tv_usec)/
+ 1000000,opts)) {
+ temp_list[temp_count++]=newtable;
+ return 0;
+ }
+ }
+ */
+
+ if (min_size) {
+ if (clique_size[v]>=min_size) {
+ temp_list[temp_count++]=newtable;
+ return clique_size[v];
+ }
+ if (clique_size[v]+g->n-i-1 < min_size) {
+ temp_list[temp_count++]=newtable;
+ return 0;
+ }
+ }
+ }
+
+ temp_list[temp_count++]=newtable;
+
+ if (min_size)
+ return 0;
+ return clique_size[v];
+}
+
+/*
+ * sub_unweighted_single()
+ *
+ * Recursion function for searching for a single clique of size min_size.
+ *
+ * table - subset of the vertices in graph
+ * size - size of table
+ * min_size - size of clique to look for within the subgraph
+ * (decreased with every recursion)
+ * g - the graph
+ *
+ * Returns TRUE if a clique of size min_size is found, FALSE otherwise.
+ * If a clique of size min_size is found, it is stored in current_clique.
+ *
+ * clique_size[] for all values in table must be defined and correct,
+ * otherwise inaccurate results may occur.
+ */
+static boolean sub_unweighted_single(int *table, int size, int min_size,
+ graph_t *g) {
+ int i;
+ int v;
+ int *newtable;
+ int *p1, *p2;
+
+ /* Zero or one vertices needed anymore. */
+ if (min_size <= 1) {
+ if (size>0 && min_size==1) {
+ set_empty(current_clique);
+ SET_ADD_ELEMENT(current_clique,table[0]);
+ return TRUE;
+ }
+ if (min_size==0) {
+ set_empty(current_clique);
+ return TRUE;
+ }
+ return FALSE;
+ }
+ if (size < min_size)
+ return FALSE;
+
+ /* Dynamic memory allocation with cache */
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+
+ for (i = size-1; i >= 0; i--) {
+ v = table[i];
+
+ if (clique_size[v] < min_size)
+ break;
+ /* This is faster when compiling with gcc than placing
+ * this in the for-loop condition. */
+ if (i+1 < min_size)
+ break;
+
+ /* Very ugly code, but works faster than "for (i=...)" */
+ p1 = newtable;
+ for (p2=table; p2 < table+i; p2++) {
+ int w = *p2;
+ if (GRAPH_IS_EDGE(g, v, w)) {
+ *p1 = w;
+ p1++;
+ }
+ }
+
+ /* Avoid unneccessary loops (next size == p1-newtable) */
+ if (p1-newtable < min_size-1)
+ continue;
+ /* Now p1-newtable >= min_size-1 >= 2-1 == 1, so we can use
+ * p1-newtable-1 safely. */
+ if (clique_size[newtable[p1-newtable-1]] < min_size-1)
+ continue;
+
+ if (sub_unweighted_single(newtable,p1-newtable,
+ min_size-1,g)) {
+ /* Clique found. */
+ SET_ADD_ELEMENT(current_clique,v);
+ temp_list[temp_count++]=newtable;
+ return TRUE;
+ }
+ }
+ temp_list[temp_count++]=newtable;
+ return FALSE;
+}
+
+
+/*
+ * unweighted_clique_search_all()
+ *
+ * Searches for all cliques with size at least min_size and at most
+ * max_size. Stores the cliques as opts declares.
+ *
+ * table - the order of the vertices in g to search
+ * start - first index where the subgraph table[0], ..., table[start]
+ * might include a requested kind of clique
+ * min_size - minimum size of clique to search for. min_size > 0 !
+ * max_size - maximum size of clique to search for. If no upper limit
+ * is desired, use eg. INT_MAX
+ * maximal - requires cliques to be maximal
+ * g - the graph
+ * opts - time printing and clique storage options
+ *
+ * Cliques found are stored as defined by opts->user_function and
+ * opts->clique_list. opts->time_function is called after each
+ * base-level recursion, if non-NULL.
+ *
+ * clique_size[] must be defined and correct for all values of
+ * table[0], ..., table[start-1].
+ *
+ * Returns the number of cliques stored (not neccessarily number of cliques
+ * in graph, if user/time_function aborts).
+ */
+static int unweighted_clique_search_all(int *table, int start,
+ int min_size, int max_size,
+ boolean maximal, graph_t *g,
+ clique_options *opts) {
+ /*
+ struct timeval timeval;
+ struct tms tms;
+ */
+ int i,j;
+ int v;
+ int *newtable;
+ int newsize;
+ int count=0;
+
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+
+ clique_list_count=0;
+ set_empty(current_clique);
+ for (i=start; i < g->n; i++) {
+ v=table[i];
+ clique_size[v]=min_size; /* Do not prune here. */
+
+ newsize=0;
+ for (j=0; j<i; j++) {
+ if (GRAPH_IS_EDGE(g,v,table[j])) {
+ newtable[newsize]=table[j];
+ newsize++;
+ }
+ }
+
+ SET_ADD_ELEMENT(current_clique,v);
+ j=sub_unweighted_all(newtable,newsize,min_size-1,max_size-1,
+ maximal,g,opts);
+ SET_DEL_ELEMENT(current_clique,v);
+ if (j<0) {
+ /* Abort. */
+ count-=j;
+ break;
+ }
+ count+=j;
+
+#if 0
+ if (opts->time_function) {
+ gettimeofday(&timeval,NULL);
+ times(&tms);
+ if (!opts->time_function(entrance_level,
+ i+1,g->n,min_size *
+ weight_multiplier,
+ (double)(tms.tms_utime-
+ cputimer.tms_utime)/
+ clocks_per_sec,
+ timeval.tv_sec-
+ realtimer.tv_sec+
+ (double)(timeval.tv_usec-
+ realtimer.tv_usec)/
+ 1000000,opts)) {
+ /* Abort. */
+ break;
+ }
+ }
+#endif
+ }
+ temp_list[temp_count++]=newtable;
+ return count;
+}
+
+/*
+ * sub_unweighted_all()
+ *
+ * Recursion function for searching for all cliques of given size.
+ *
+ * table - subset of vertices of graph g
+ * size - size of table
+ * min_size - minimum size of cliques to search for (decreased with
+ * every recursion)
+ * max_size - maximum size of cliques to search for (decreased with
+ * every recursion). If no upper limit is desired, use
+ * eg. INT_MAX
+ * maximal - require cliques to be maximal (passed through)
+ * g - the graph
+ * opts - storage options
+ *
+ * All cliques of suitable size found are stored according to opts.
+ *
+ * Returns the number of cliques found. If user_function returns FALSE,
+ * then the number of cliques is returned negative.
+ *
+ * Uses current_clique to store the currently-being-searched clique.
+ * clique_size[] for all values in table must be defined and correct,
+ * otherwise inaccurate results may occur.
+ */
+static int sub_unweighted_all(int *table, int size, int min_size, int max_size,
+ boolean maximal, graph_t *g,
+ clique_options *opts) {
+ int i;
+ int v;
+ int n;
+ int *newtable;
+ int *p1, *p2;
+ int count=0; /* Amount of cliques found */
+
+ if (min_size <= 0) {
+ if ((!maximal) || is_maximal(current_clique,g)) {
+ /* We've found one. Store it. */
+ count++;
+ if (!store_clique(current_clique,g,opts)) {
+ return -count;
+ }
+ }
+ if (max_size <= 0) {
+ /* If we add another element, size will be too big. */
+ return count;
+ }
+ }
+
+ if (size < min_size) {
+ return count;
+ }
+
+ /* Dynamic memory allocation with cache */
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+
+ for (i=size-1; i>=0; i--) {
+ v = table[i];
+ if (clique_size[v] < min_size) {
+ break;
+ }
+ if (i+1 < min_size) {
+ break;
+ }
+
+ /* Very ugly code, but works faster than "for (i=...)" */
+ p1 = newtable;
+ for (p2=table; p2 < table+i; p2++) {
+ int w = *p2;
+ if (GRAPH_IS_EDGE(g, v, w)) {
+ *p1 = w;
+ p1++;
+ }
+ }
+
+ /* Avoid unneccessary loops (next size == p1-newtable) */
+ if (p1-newtable < min_size-1) {
+ continue;
+ }
+
+ SET_ADD_ELEMENT(current_clique,v);
+ n=sub_unweighted_all(newtable,p1-newtable,
+ min_size-1,max_size-1,maximal,g,opts);
+ SET_DEL_ELEMENT(current_clique,v);
+ if (n < 0) {
+ /* Abort. */
+ count -= n;
+ count = -count;
+ break;
+ }
+ count+=n;
+ }
+ temp_list[temp_count++]=newtable;
+ return count;
+}
+
+
+
+
+/***** Weighted clique searches *****/
+/*
+ * Weighted clique searches can use the same recursive routine, because
+ * in both cases (single/all) they have to search through all potential
+ * permutations searching for heavier cliques.
+ */
+
+
+/*
+ * weighted_clique_search_single()
+ *
+ * Searches for a single clique of weight at least min_weight, and at
+ * most max_weight. Stores maximum clique sizes into clique_size[]
+ * (or min_weight-1, whichever is smaller).
+ *
+ * table - the order of the vertices in g to use
+ * min_weight - minimum weight of clique to search for. If min_weight==0,
+ * then searches for a maximum weight clique
+ * max_weight - maximum weight of clique to search for. If no upper limit
+ * is desired, use eg. INT_MAX
+ * g - the graph
+ * opts - time printing options
+ *
+ * opts->time_function is called after each base-level recursion, if
+ * non-NULL.
+ *
+ * Returns 0 if a clique of requested weight was not found (also if
+ * time_function requested an abort), otherwise returns >= 1.
+ * If min_weight==0 (search for maximum-weight clique), then the return
+ * value is the weight of the clique found. The found clique is stored
+ * in best_clique.
+ *
+ * Note: Does NOT use opts->user_function of opts->clique_list.
+ */
+static int weighted_clique_search_single(int *table, int min_weight,
+ int max_weight, graph_t *g,
+ clique_options *opts) {
+ /*
+ struct timeval timeval;
+ struct tms tms;
+ */
+ int i,j;
+ int v;
+ int *newtable;
+ int newsize;
+ int newweight;
+ int search_weight;
+ int min_w;
+ clique_options localopts;
+
+ if (min_weight==0)
+ min_w=INT_MAX;
+ else
+ min_w=min_weight;
+
+
+ if (min_weight==1) {
+ /* min_weight==1 may cause trouble in the routine, and
+ * it's trivial to check as it's own case.
+ * We write nothing to clique_size[]. */
+ for (i=0; i < g->n; i++) {
+ if (g->weights[table[i]] <= max_weight) {
+ set_empty(best_clique);
+ SET_ADD_ELEMENT(best_clique,table[i]);
+ return g->weights[table[i]];
+ }
+ }
+ return 0;
+ }
+
+ localopts.time_function=NULL;
+ localopts.reorder_function=NULL;
+ localopts.reorder_map=NULL;
+ localopts.user_function=false_function;
+ localopts.user_data=NULL;
+ localopts.clique_list=&best_clique;
+ localopts.clique_list_length=1;
+ clique_list_count=0;
+
+ v=table[0];
+ set_empty(best_clique);
+ SET_ADD_ELEMENT(best_clique,v);
+ search_weight=g->weights[v];
+ if (min_weight && (search_weight >= min_weight)) {
+ if (search_weight <= max_weight) {
+ /* Found suitable clique. */
+ return search_weight;
+ }
+ search_weight=min_weight-1;
+ }
+ clique_size[v]=search_weight;
+ set_empty(current_clique);
+
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+
+ for (i = 1; i < g->n; i++) {
+ v=table[i];
+
+ newsize=0;
+ newweight=0;
+ for (j=0; j<i; j++) {
+ if (GRAPH_IS_EDGE(g,v,table[j])) {
+ newweight += g->weights[table[j]];
+ newtable[newsize]=table[j];
+ newsize++;
+ }
+ }
+
+
+ SET_ADD_ELEMENT(current_clique,v);
+ search_weight=sub_weighted_all(newtable,newsize,newweight,
+ g->weights[v],search_weight,
+ clique_size[table[i-1]] +
+ g->weights[v],
+ min_w,max_weight,FALSE,
+ g,&localopts);
+ SET_DEL_ELEMENT(current_clique,v);
+ if (search_weight < 0) {
+ break;
+ }
+
+ clique_size[v]=search_weight;
+
+ /*
+ if (opts->time_function) {
+ gettimeofday(&timeval,NULL);
+ times(&tms);
+ if (!opts->time_function(entrance_level,
+ i+1,g->n,clique_size[v] *
+ weight_multiplier,
+ (double)(tms.tms_utime-
+ cputimer.tms_utime)/
+ clocks_per_sec,
+ timeval.tv_sec-
+ realtimer.tv_sec+
+ (double)(timeval.tv_usec-
+ realtimer.tv_usec)/
+ 1000000,opts)) {
+ set_free(current_clique);
+ current_clique=NULL;
+ break;
+ }
+ }
+ */
+ }
+ temp_list[temp_count++]=newtable;
+ if (min_weight && (search_weight > 0)) {
+ /* Requested clique has not been found. */
+ return 0;
+ }
+ return clique_size[table[i-1]];
+}
+
+
+/*
+ * weighted_clique_search_all()
+ *
+ * Searches for all cliques with weight at least min_weight and at most
+ * max_weight. Stores the cliques as opts declares.
+ *
+ * table - the order of the vertices in g to search
+ * start - first index where the subgraph table[0], ..., table[start]
+ * might include a requested kind of clique
+ * min_weight - minimum weight of clique to search for. min_weight > 0 !
+ * max_weight - maximum weight of clique to search for. If no upper limit
+ * is desired, use eg. INT_MAX
+ * maximal - search only for maximal cliques
+ * g - the graph
+ * opts - time printing and clique storage options
+ *
+ * Cliques found are stored as defined by opts->user_function and
+ * opts->clique_list. opts->time_function is called after each
+ * base-level recursion, if non-NULL.
+ *
+ * clique_size[] must be defined and correct for all values of
+ * table[0], ..., table[start-1].
+ *
+ * Returns the number of cliques stored (not neccessarily number of cliques
+ * in graph, if user/time_function aborts).
+ */
+static int weighted_clique_search_all(int *table, int start,
+ int min_weight, int max_weight,
+ boolean maximal, graph_t *g,
+ clique_options *opts) {
+ /*
+ struct timeval timeval;
+ struct tms tms;
+ */
+ int i,j;
+ int v;
+ int *newtable;
+ int newsize;
+ int newweight;
+
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+
+ clique_list_count=0;
+ set_empty(current_clique);
+ for (i=start; i < g->n; i++) {
+ v=table[i];
+ clique_size[v]=min_weight; /* Do not prune here. */
+
+ newsize=0;
+ newweight=0;
+ for (j=0; j<i; j++) {
+ if (GRAPH_IS_EDGE(g,v,table[j])) {
+ newtable[newsize]=table[j];
+ newweight+=g->weights[table[j]];
+ newsize++;
+ }
+ }
+
+ SET_ADD_ELEMENT(current_clique,v);
+ j=sub_weighted_all(newtable,newsize,newweight,
+ g->weights[v],min_weight-1,INT_MAX,
+ min_weight,max_weight,maximal,g,opts);
+ SET_DEL_ELEMENT(current_clique,v);
+
+ if (j<0) {
+ /* Abort. */
+ break;
+ }
+
+ /*
+ if (opts->time_function) {
+ gettimeofday(&timeval,NULL);
+ times(&tms);
+ if (!opts->time_function(entrance_level,
+ i+1,g->n,clique_size[v] *
+ weight_multiplier,
+ (double)(tms.tms_utime-
+ cputimer.tms_utime)/
+ clocks_per_sec,
+ timeval.tv_sec-
+ realtimer.tv_sec+
+ (double)(timeval.tv_usec-
+ realtimer.tv_usec)/
+ 1000000,opts)) {
+ set_free(current_clique);
+ current_clique=NULL;
+ break;
+ }
+ }
+ */
+ }
+ temp_list[temp_count++]=newtable;
+
+ return clique_list_count;
+}
+
+/*
+ * sub_weighted_all()
+ *
+ * Recursion function for searching for all cliques of given weight.
+ *
+ * table - subset of vertices of graph g
+ * size - size of table
+ * weight - total weight of vertices in table
+ * current_weight - weight of clique found so far
+ * prune_low - ignore all cliques with weight less or equal to this value
+ * (often heaviest clique found so far) (passed through)
+ * prune_high - maximum weight possible for clique in this subgraph
+ * (passed through)
+ * min_size - minimum weight of cliques to search for (passed through)
+ * Must be greater than 0.
+ * max_size - maximum weight of cliques to search for (passed through)
+ * If no upper limit is desired, use eg. INT_MAX
+ * maximal - search only for maximal cliques
+ * g - the graph
+ * opts - storage options
+ *
+ * All cliques of suitable weight found are stored according to opts.
+ *
+ * Returns weight of heaviest clique found (prune_low if a heavier clique
+ * hasn't been found); if a clique with weight at least min_size is found
+ * then min_size-1 is returned. If clique storage failed, -1 is returned.
+ *
+ * The largest clique found smaller than max_weight is stored in
+ * best_clique, if non-NULL.
+ *
+ * Uses current_clique to store the currently-being-searched clique.
+ * clique_size[] for all values in table must be defined and correct,
+ * otherwise inaccurate results may occur.
+ *
+ * To search for a single maximum clique, use min_weight==max_weight==INT_MAX,
+ * with best_clique non-NULL. To search for a single given-weight clique,
+ * use opts->clique_list and opts->user_function=false_function. When
+ * searching for all cliques, min_weight should be given the minimum weight
+ * desired.
+ */
+static int sub_weighted_all(int *table, int size, int weight,
+ int current_weight, int prune_low, int prune_high,
+ int min_weight, int max_weight, boolean maximal,
+ graph_t *g, clique_options *opts) {
+ int i;
+ int v,w;
+ int *newtable;
+ int *p1, *p2;
+ int newweight;
+
+ if (current_weight >= min_weight) {
+ if ((current_weight <= max_weight) &&
+ ((!maximal) || is_maximal(current_clique,g))) {
+ /* We've found one. Store it. */
+ if (!store_clique(current_clique,g,opts)) {
+ return -1;
+ }
+ }
+ if (current_weight >= max_weight) {
+ /* Clique too heavy. */
+ return min_weight-1;
+ }
+ }
+ if (size <= 0) {
+ /* current_weight < min_weight, prune_low < min_weight,
+ * so return value is always < min_weight. */
+ if (current_weight>prune_low) {
+ if (best_clique)
+ set_copy(best_clique,current_clique);
+ if (current_weight < min_weight)
+ return current_weight;
+ else
+ return min_weight-1;
+ } else {
+ return prune_low;
+ }
+ }
+
+ /* Dynamic memory allocation with cache */
+ if (temp_count) {
+ temp_count--;
+ newtable=temp_list[temp_count];
+ } else {
+ newtable=malloc(g->n * sizeof(int));
+ }
+
+ for (i = size-1; i >= 0; i--) {
+ v = table[i];
+ if (current_weight+clique_size[v] <= prune_low) {
+ /* Dealing with subset without heavy enough clique. */
+ break;
+ }
+ if (current_weight+weight <= prune_low) {
+ /* Even if all elements are added, won't do. */
+ break;
+ }
+
+ /* Very ugly code, but works faster than "for (i=...)" */
+ p1 = newtable;
+ newweight = 0;
+ for (p2=table; p2 < table+i; p2++) {
+ w = *p2;
+ if (GRAPH_IS_EDGE(g, v, w)) {
+ *p1 = w;
+ newweight += g->weights[w];
+ p1++;
+ }
+ }
+
+ w=g->weights[v];
+ weight-=w;
+ /* Avoid a few unneccessary loops */
+ if (current_weight+w+newweight <= prune_low) {
+ continue;
+ }
+
+ SET_ADD_ELEMENT(current_clique,v);
+ prune_low=sub_weighted_all(newtable,p1-newtable,
+ newweight,
+ current_weight+w,
+ prune_low,prune_high,
+ min_weight,max_weight,maximal,
+ g,opts);
+ SET_DEL_ELEMENT(current_clique,v);
+ if ((prune_low<0) || (prune_low>=prune_high)) {
+ /* Impossible to find larger clique. */
+ break;
+ }
+ }
+ temp_list[temp_count++]=newtable;
+ return prune_low;
+}
+
+
+
+
+/***** Helper functions *****/
+
+
+/*
+ * store_clique()
+ *
+ * Stores a clique according to given user options.
+ *
+ * clique - the clique to store
+ * opts - storage options
+ *
+ * Returns FALSE if opts->user_function() returned FALSE; otherwise
+ * returns TRUE.
+ */
+static boolean store_clique(set_t clique, graph_t *g, clique_options *opts) {
+
+ clique_list_count++;
+
+ /* clique_list[] */
+ if (opts->clique_list) {
+ /*
+ * This has been a major source of bugs:
+ * Has clique_list_count been set to 0 before calling
+ * the recursions?
+ */
+ if (clique_list_count <= 0) {
+#ifdef USING_R
+ error("CLIQUER INTERNAL ERROR: ",
+ "clique_list_count has negative value!");
+#else
+ fprintf(stderr,"CLIQUER INTERNAL ERROR: "
+ "clique_list_count has negative value!\n");
+ fprintf(stderr,"Please report as a bug.\n");
+ abort();
+#endif
+ }
+ if (clique_list_count <= opts->clique_list_length)
+ opts->clique_list[clique_list_count-1] =
+ set_duplicate(clique);
+ }
+
+ /* user_function() */
+ if (opts->user_function) {
+ if (!opts->user_function(clique,g,opts)) {
+ /* User function requested abort. */
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+/*
+ * maximalize_clique()
+ *
+ * Adds greedily all possible vertices in g to set s to make it a maximal
+ * clique.
+ *
+ * s - clique of vertices to make maximal
+ * g - graph
+ *
+ * Note: Not very optimized (uses a simple O(n^2) routine), but is called
+ * at maximum once per clique_xxx() call, so it shouldn't matter.
+ */
+static void maximalize_clique(set_t s,graph_t *g) {
+ int i,j;
+ boolean add;
+
+ for (i=0; i < g->n; i++) {
+ add=TRUE;
+ for (j=0; j < g->n; j++) {
+ if (SET_CONTAINS_FAST(s,j) && !GRAPH_IS_EDGE(g,i,j)) {
+ add=FALSE;
+ break;
+ }
+ }
+ if (add) {
+ SET_ADD_ELEMENT(s,i);
+ }
+ }
+ return;
+}
+
+
+/*
+ * is_maximal()
+ *
+ * Check whether a clique is maximal or not.
+ *
+ * clique - set of vertices in clique
+ * g - graph
+ *
+ * Returns TRUE is clique is a maximal clique of g, otherwise FALSE.
+ */
+static boolean is_maximal(set_t clique, graph_t *g) {
+ int i,j;
+ int *table;
+ int len;
+ boolean addable;
+
+ if (temp_count) {
+ temp_count--;
+ table=temp_list[temp_count];
+ } else {
+ table=malloc(g->n * sizeof(int));
+ }
+
+ len=0;
+ for (i=0; i < g->n; i++)
+ if (SET_CONTAINS_FAST(clique,i))
+ table[len++]=i;
+
+ for (i=0; i < g->n; i++) {
+ addable=TRUE;
+ for (j=0; j<len; j++) {
+ if (!GRAPH_IS_EDGE(g,i,table[j])) {
+ addable=FALSE;
+ break;
+ }
+ }
+ if (addable) {
+ temp_list[temp_count++]=table;
+ return FALSE;
+ }
+ }
+ temp_list[temp_count++]=table;
+ return TRUE;
+}
+
+
+/*
+ * false_function()
+ *
+ * Returns FALSE. Can be used as user_function.
+ */
+static boolean false_function(set_t clique,graph_t *g,clique_options *opts) {
+ return FALSE;
+}
+
+
+
+
+/***** API-functions *****/
+
+/*
+ * clique_unweighted_max_weight()
+ *
+ * Returns the size of the maximum (sized) clique in g (or 0 if search
+ * was aborted).
+ *
+ * g - the graph
+ * opts - time printing options
+ *
+ * Note: As we don't have an algorithm faster than actually finding
+ * a maximum clique, we use clique_unweighted_find_single().
+ * This incurs only very small overhead.
+ */
+int clique_unweighted_max_weight(graph_t *g, clique_options *opts) {
+ set_t s;
+ int size;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+
+ s=clique_unweighted_find_single(g,0,0,FALSE,opts);
+ if (s==NULL) {
+ /* Search was aborted. */
+ return 0;
+ }
+ size=set_size(s);
+ set_free(s);
+ return size;
+}
+
+
+/*
+ * clique_unweighted_find_single()
+ *
+ * Returns a clique with size at least min_size and at most max_size.
+ *
+ * g - the graph
+ * min_size - minimum size of clique to search for. If min_size==0,
+ * searches for maximum clique.
+ * max_size - maximum size of clique to search for. If max_size==0, no
+ * upper limit is used. If min_size==0, this must also be 0.
+ * maximal - require returned clique to be maximal
+ * opts - time printing options
+ *
+ * Returns the set of vertices forming the clique, or NULL if a clique
+ * of requested size/maximality does not exist in the graph (or if
+ * opts->time_function() requests abort).
+ *
+ * The returned clique is newly allocated and can be freed by set_free().
+ *
+ * Note: Does NOT use opts->user_function() or opts->clique_list[].
+ */
+set_t clique_unweighted_find_single(graph_t *g,int min_size,int max_size,
+ boolean maximal, clique_options *opts) {
+ int i;
+ int *table;
+ set_t s;
+
+ ENTRANCE_SAVE();
+ entrance_level++;
+
+ if (opts==NULL)
+ opts=&clique_default_options;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+ ASSERT(min_size>=0);
+ ASSERT(max_size>=0);
+ ASSERT((max_size==0) || (min_size <= max_size));
+ ASSERT(!((min_size==0) && (max_size>0)));
+ ASSERT((opts->reorder_function==NULL) || (opts->reorder_map==NULL));
+
+ if ((max_size>0) && (min_size>max_size)) {
+ /* state was not changed */
+ entrance_level--;
+ return NULL;
+ }
+
+ /*
+ if (clocks_per_sec==0)
+ clocks_per_sec=sysconf(_SC_CLK_TCK);
+ ASSERT(clocks_per_sec>0);
+ */
+
+ /* Dynamic allocation */
+ current_clique=set_new(g->n);
+ clique_size=malloc(g->n * sizeof(int));
+ /* table allocated later */
+ temp_list=malloc((g->n+2)*sizeof(int *));
+ temp_count=0;
+
+ /* "start clock" */
+ /*
+ gettimeofday(&realtimer,NULL);
+ times(&cputimer);
+ */
+
+ /* reorder */
+ if (opts->reorder_function) {
+ table=opts->reorder_function(g,FALSE);
+ } else if (opts->reorder_map) {
+ table=reorder_duplicate(opts->reorder_map,g->n);
+ } else {
+ table=reorder_ident(g->n);
+ }
+ ASSERT(reorder_is_bijection(table,g->n));
+
+
+ if (unweighted_clique_search_single(table,min_size,g,opts)==0) {
+ set_free(current_clique);
+ current_clique=NULL;
+ goto cleanreturn;
+ }
+ if (maximal && (min_size>0)) {
+ maximalize_clique(current_clique,g);
+
+ if ((max_size > 0) && (set_size(current_clique) > max_size)) {
+ clique_options localopts;
+
+ s = set_new(g->n);
+ localopts.time_function = opts->time_function;
+ localopts.output = opts->output;
+ localopts.user_function = false_function;
+ localopts.clique_list = &s;
+ localopts.clique_list_length = 1;
+
+ for (i=0; i < g->n-1; i++)
+ if (clique_size[table[i]]>=min_size)
+ break;
+ if (unweighted_clique_search_all(table,i,min_size,
+ max_size,maximal,
+ g,&localopts)) {
+ set_free(current_clique);
+ current_clique=s;
+ } else {
+ set_free(current_clique);
+ current_clique=NULL;
+ }
+ }
+ }
+
+ cleanreturn:
+ s=current_clique;
+
+ /* Free resources */
+ for (i=0; i < temp_count; i++)
+ free(temp_list[i]);
+ free(temp_list);
+ free(table);
+ free(clique_size);
+
+ ENTRANCE_RESTORE();
+ entrance_level--;
+
+ return s;
+}
+
+
+/*
+ * clique_unweighted_find_all()
+ *
+ * Find all cliques with size at least min_size and at most max_size.
+ *
+ * g - the graph
+ * min_size - minimum size of cliques to search for. If min_size==0,
+ * searches for maximum cliques.
+ * max_size - maximum size of cliques to search for. If max_size==0, no
+ * upper limit is used. If min_size==0, this must also be 0.
+ * maximal - require cliques to be maximal cliques
+ * opts - time printing and clique storage options
+ *
+ * Returns the number of cliques found. This can be less than the number
+ * of cliques in the graph iff opts->time_function() or opts->user_function()
+ * returns FALSE (request abort).
+ *
+ * The cliques found are stored in opts->clique_list[] and
+ * opts->user_function() is called with them (if non-NULL). The cliques
+ * stored in opts->clique_list[] are newly allocated, and can be freed
+ * by set_free().
+ */
+int clique_unweighted_find_all(graph_t *g, int min_size, int max_size,
+ boolean maximal, clique_options *opts) {
+ int i;
+ int *table;
+ int count;
+
+ ENTRANCE_SAVE();
+ entrance_level++;
+
+ if (opts==NULL)
+ opts=&clique_default_options;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+ ASSERT(min_size>=0);
+ ASSERT(max_size>=0);
+ ASSERT((max_size==0) || (min_size <= max_size));
+ ASSERT(!((min_size==0) && (max_size>0)));
+ ASSERT((opts->reorder_function==NULL) || (opts->reorder_map==NULL));
+
+ if ((max_size>0) && (min_size>max_size)) {
+ /* state was not changed */
+ entrance_level--;
+ return 0;
+ }
+
+ /*
+ if (clocks_per_sec==0)
+ clocks_per_sec=sysconf(_SC_CLK_TCK);
+ ASSERT(clocks_per_sec>0);
+ */
+
+ /* Dynamic allocation */
+ current_clique=set_new(g->n);
+ clique_size=malloc(g->n * sizeof(int));
+ /* table allocated later */
+ temp_list=malloc((g->n+2)*sizeof(int *));
+ temp_count=0;
+
+ clique_list_count=0;
+ memset(clique_size,0,g->n * sizeof(int));
+
+ /* "start clock" */
+ /*
+ gettimeofday(&realtimer,NULL);
+ times(&cputimer);
+ */
+
+ /* reorder */
+ if (opts->reorder_function) {
+ table=opts->reorder_function(g,FALSE);
+ } else if (opts->reorder_map) {
+ table=reorder_duplicate(opts->reorder_map,g->n);
+ } else {
+ table=reorder_ident(g->n);
+ }
+ ASSERT(reorder_is_bijection(table,g->n));
+
+
+ /* Search as normal until there is a chance to find a suitable
+ * clique. */
+ if (unweighted_clique_search_single(table,min_size,g,opts)==0) {
+ count=0;
+ goto cleanreturn;
+ }
+
+ if (min_size==0 && max_size==0) {
+ min_size=max_size=clique_size[table[g->n-1]];
+ maximal=FALSE; /* No need to test, since we're searching
+ * for maximum cliques. */
+ }
+ if (max_size==0) {
+ max_size=INT_MAX;
+ }
+
+ for (i=0; i < g->n-1; i++)
+ if (clique_size[table[i]] >= min_size)
+ break;
+ count=unweighted_clique_search_all(table,i,min_size,max_size,
+ maximal,g,opts);
+
+ cleanreturn:
+ /* Free resources */
+ for (i=0; i<temp_count; i++)
+ free(temp_list[i]);
+ free(temp_list);
+ free(table);
+ free(clique_size);
+ set_free(current_clique);
+
+ ENTRANCE_RESTORE();
+ entrance_level--;
+
+ return count;
+}
+
+
+
+
+/*
+ * clique_max_weight()
+ *
+ * Returns the weight of the maximum weight clique in the graph (or 0 if
+ * the search was aborted).
+ *
+ * g - the graph
+ * opts - time printing options
+ *
+ * Note: As we don't have an algorithm faster than actually finding
+ * a maximum weight clique, we use clique_find_single().
+ * This incurs only very small overhead.
+ */
+int clique_max_weight(graph_t *g,clique_options *opts) {
+ set_t s;
+ int weight;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+
+ s=clique_find_single(g,0,0,FALSE,opts);
+ if (s==NULL) {
+ /* Search was aborted. */
+ return 0;
+ }
+ weight=graph_subgraph_weight(g,s);
+ set_free(s);
+ return weight;
+}
+
+
+/*
+ * clique_find_single()
+ *
+ * Returns a clique with weight at least min_weight and at most max_weight.
+ *
+ * g - the graph
+ * min_weight - minimum weight of clique to search for. If min_weight==0,
+ * searches for a maximum weight clique.
+ * max_weight - maximum weight of clique to search for. If max_weight==0,
+ * no upper limit is used. If min_weight==0, max_weight must
+ * also be 0.
+ * maximal - require returned clique to be maximal
+ * opts - time printing options
+ *
+ * Returns the set of vertices forming the clique, or NULL if a clique
+ * of requested weight/maximality does not exist in the graph (or if
+ * opts->time_function() requests abort).
+ *
+ * The returned clique is newly allocated and can be freed by set_free().
+ *
+ * Note: Does NOT use opts->user_function() or opts->clique_list[].
+ * Note: Automatically uses clique_unweighted_find_single if all vertex
+ * weights are the same.
+ */
+set_t clique_find_single(graph_t *g,int min_weight,int max_weight,
+ boolean maximal, clique_options *opts) {
+ int i;
+ int *table;
+ set_t s;
+
+ ENTRANCE_SAVE();
+ entrance_level++;
+
+ if (opts==NULL)
+ opts=&clique_default_options;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+ ASSERT(min_weight>=0);
+ ASSERT(max_weight>=0);
+ ASSERT((max_weight==0) || (min_weight <= max_weight));
+ ASSERT(!((min_weight==0) && (max_weight>0)));
+ ASSERT((opts->reorder_function==NULL) || (opts->reorder_map==NULL));
+
+ if ((max_weight>0) && (min_weight>max_weight)) {
+ /* state was not changed */
+ entrance_level--;
+ return NULL;
+ }
+
+ /*
+ if (clocks_per_sec==0)
+ clocks_per_sec=sysconf(_SC_CLK_TCK);
+ ASSERT(clocks_per_sec>0);
+ */
+
+ /* Check whether we can use unweighted routines. */
+ if (!graph_weighted(g)) {
+ min_weight=DIV_UP(min_weight,g->weights[0]);
+ if (max_weight) {
+ max_weight=DIV_DOWN(max_weight,g->weights[0]);
+ if (max_weight < min_weight) {
+ /* state was not changed */
+ entrance_level--;
+ return NULL;
+ }
+ }
+
+ weight_multiplier = g->weights[0];
+ entrance_level--;
+ s=clique_unweighted_find_single(g,min_weight,max_weight,
+ maximal,opts);
+ ENTRANCE_RESTORE();
+ return s;
+ }
+
+ /* Dynamic allocation */
+ current_clique=set_new(g->n);
+ best_clique=set_new(g->n);
+ clique_size=malloc(g->n * sizeof(int));
+ memset(clique_size, 0, g->n * sizeof(int));
+ /* table allocated later */
+ temp_list=malloc((g->n+2)*sizeof(int *));
+ temp_count=0;
+
+ clique_list_count=0;
+
+ /* "start clock" */
+ /*
+ gettimeofday(&realtimer,NULL);
+ times(&cputimer);
+ */
+
+ /* reorder */
+ if (opts->reorder_function) {
+ table=opts->reorder_function(g,TRUE);
+ } else if (opts->reorder_map) {
+ table=reorder_duplicate(opts->reorder_map,g->n);
+ } else {
+ table=reorder_ident(g->n);
+ }
+ ASSERT(reorder_is_bijection(table,g->n));
+
+ if (max_weight==0)
+ max_weight=INT_MAX;
+
+ if (weighted_clique_search_single(table,min_weight,max_weight,
+ g,opts)==0) {
+ /* Requested clique has not been found. */
+ set_free(best_clique);
+ best_clique=NULL;
+ goto cleanreturn;
+ }
+ if (maximal && (min_weight>0)) {
+ maximalize_clique(best_clique,g);
+ if (graph_subgraph_weight(g,best_clique) > max_weight) {
+ clique_options localopts;
+
+ localopts.time_function = opts->time_function;
+ localopts.output = opts->output;
+ localopts.user_function = false_function;
+ localopts.clique_list = &best_clique;
+ localopts.clique_list_length = 1;
+
+ for (i=0; i < g->n-1; i++)
+ if ((clique_size[table[i]] >= min_weight) ||
+ (clique_size[table[i]] == 0))
+ break;
+ if (!weighted_clique_search_all(table,i,min_weight,
+ max_weight,maximal,
+ g,&localopts)) {
+ set_free(best_clique);
+ best_clique=NULL;
+ }
+ }
+ }
+
+ cleanreturn:
+ s=best_clique;
+
+ /* Free resources */
+ for (i=0; i < temp_count; i++)
+ free(temp_list[i]);
+ free(temp_list);
+ temp_list=NULL;
+ temp_count=0;
+ free(table);
+ set_free(current_clique);
+ current_clique=NULL;
+ free(clique_size);
+ clique_size=NULL;
+
+ ENTRANCE_RESTORE();
+ entrance_level--;
+
+ return s;
+}
+
+
+
+
+
+/*
+ * clique_find_all()
+ *
+ * Find all cliques with weight at least min_weight and at most max_weight.
+ *
+ * g - the graph
+ * min_weight - minimum weight of cliques to search for. If min_weight==0,
+ * searches for maximum weight cliques.
+ * max_weight - maximum weight of cliques to search for. If max_weight==0,
+ * no upper limit is used. If min_weight==0, max_weight must
+ * also be 0.
+ * maximal - require cliques to be maximal cliques
+ * opts - time printing and clique storage options
+ *
+ * Returns the number of cliques found. This can be less than the number
+ * of cliques in the graph iff opts->time_function() or opts->user_function()
+ * returns FALSE (request abort).
+ *
+ * The cliques found are stored in opts->clique_list[] and
+ * opts->user_function() is called with them (if non-NULL). The cliques
+ * stored in opts->clique_list[] are newly allocated, and can be freed
+ * by set_free().
+ *
+ * Note: Automatically uses clique_unweighted_find_all if all vertex
+ * weights are the same.
+ */
+int clique_find_all(graph_t *g, int min_weight, int max_weight,
+ boolean maximal, clique_options *opts) {
+ int i,n;
+ int *table;
+
+ ENTRANCE_SAVE();
+ entrance_level++;
+
+ if (opts==NULL)
+ opts=&clique_default_options;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+ ASSERT(min_weight>=0);
+ ASSERT(max_weight>=0);
+ ASSERT((max_weight==0) || (min_weight <= max_weight));
+ ASSERT(!((min_weight==0) && (max_weight>0)));
+ ASSERT((opts->reorder_function==NULL) || (opts->reorder_map==NULL));
+
+ if ((max_weight>0) && (min_weight>max_weight)) {
+ /* state was not changed */
+ entrance_level--;
+ return 0;
+ }
+
+ /*
+ if (clocks_per_sec==0)
+ clocks_per_sec=sysconf(_SC_CLK_TCK);
+ ASSERT(clocks_per_sec>0);
+ */
+
+ if (!graph_weighted(g)) {
+ min_weight=DIV_UP(min_weight,g->weights[0]);
+ if (max_weight) {
+ max_weight=DIV_DOWN(max_weight,g->weights[0]);
+ if (max_weight < min_weight) {
+ /* state was not changed */
+ entrance_level--;
+ return 0;
+ }
+ }
+
+ weight_multiplier = g->weights[0];
+ entrance_level--;
+ i=clique_unweighted_find_all(g,min_weight,max_weight,maximal,
+ opts);
+ ENTRANCE_RESTORE();
+ return i;
+ }
+
+ /* Dynamic allocation */
+ current_clique=set_new(g->n);
+ best_clique=set_new(g->n);
+ clique_size=malloc(g->n * sizeof(int));
+ memset(clique_size, 0, g->n * sizeof(int));
+ /* table allocated later */
+ temp_list=malloc((g->n+2)*sizeof(int *));
+ temp_count=0;
+
+ /* "start clock" */
+ /*
+ gettimeofday(&realtimer,NULL);
+ times(&cputimer);
+ */
+
+ /* reorder */
+ if (opts->reorder_function) {
+ table=opts->reorder_function(g,TRUE);
+ } else if (opts->reorder_map) {
+ table=reorder_duplicate(opts->reorder_map,g->n);
+ } else {
+ table=reorder_ident(g->n);
+ }
+ ASSERT(reorder_is_bijection(table,g->n));
+
+ /* First phase */
+ n=weighted_clique_search_single(table,min_weight,INT_MAX,g,opts);
+ if (n==0) {
+ /* Requested clique has not been found. */
+ goto cleanreturn;
+ }
+
+ if (min_weight==0) {
+ min_weight=n;
+ max_weight=n;
+ maximal=FALSE; /* They're maximum cliques already. */
+ }
+ if (max_weight==0)
+ max_weight=INT_MAX;
+
+ for (i=0; i < g->n; i++)
+ if ((clique_size[table[i]] >= min_weight) ||
+ (clique_size[table[i]] == 0))
+ break;
+
+ /* Second phase */
+ n=weighted_clique_search_all(table,i,min_weight,max_weight,maximal,
+ g,opts);
+
+ cleanreturn:
+ /* Free resources */
+ for (i=0; i < temp_count; i++)
+ free(temp_list[i]);
+ free(temp_list);
+ free(table);
+ set_free(current_clique);
+ set_free(best_clique);
+ free(clique_size);
+
+ ENTRANCE_RESTORE();
+ entrance_level--;
+
+ return n;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#if 0
+/*
+ * clique_print_time()
+ *
+ * Reports current running information every 0.1 seconds or when values
+ * change.
+ *
+ * level - re-entrance level
+ * i - current recursion level
+ * n - maximum recursion level
+ * max - weight of heaviest clique found
+ * cputime - CPU time used in algorithm so far
+ * realtime - real time used in algorithm so far
+ * opts - prints information to (FILE *)opts->output (or stdout if NULL)
+ *
+ * Returns always TRUE (ie. never requests abort).
+ */
+boolean clique_print_time(int level, int i, int n, int max,
+ double cputime, double realtime,
+ clique_options *opts) {
+ static float prev_time=100;
+ static int prev_i=100;
+ static int prev_max=100;
+ static int prev_level=0;
+ FILE *fp=opts->output;
+ int j;
+
+ if (fp==NULL)
+ fp=stdout;
+
+ if (ABS(prev_time-realtime)>0.1 || i==n || i<prev_i || max!=prev_max ||
+ level!=prev_level) {
+ for (j=1; j<level; j++)
+ fprintf(fp," ");
+ if (realtime-prev_time < 0.01 || i<=prev_i)
+ fprintf(fp,"%3d/%d (max %2d) %2.2f s "
+ "(0.00 s/round)\n",i,n,max,
+ realtime);
+ else
+ fprintf(fp,"%3d/%d (max %2d) %2.2f s "
+ "(%2.2f s/round)\n",
+ i,n,max,realtime,
+ (realtime-prev_time)/(i-prev_i));
+ prev_time=realtime;
+ prev_i=i;
+ prev_max=max;
+ prev_level=level;
+ }
+ return TRUE;
+}
+
+/*
+ * clique_print_time_always()
+ *
+ * Reports current running information.
+ *
+ * level - re-entrance level
+ * i - current recursion level
+ * n - maximum recursion level
+ * max - largest clique found
+ * cputime - CPU time used in algorithm so far
+ * realtime - real time used in algorithm so far
+ * opts - prints information to (FILE *)opts->output (or stdout if NULL)
+ *
+ * Returns always TRUE (ie. never requests abort).
+ */
+boolean clique_print_time_always(int level, int i, int n, int max,
+ double cputime, double realtime,
+ clique_options *opts) {
+ static float prev_time=100;
+ static int prev_i=100;
+ FILE *fp=opts->output;
+ int j;
+
+ if (fp==NULL)
+ fp=stdout;
+
+ for (j=1; j<level; j++)
+ fprintf(fp," ");
+
+ if (realtime-prev_time < 0.01 || i<=prev_i)
+ fprintf(fp,"%3d/%d (max %2d) %2.2f s (0.00 s/round)\n",
+ i,n,max,realtime);
+ else
+ fprintf(fp,"%3d/%d (max %2d) %2.2f s (%2.2f s/round)\n",
+ i,n,max,realtime,(realtime-prev_time)/(i-prev_i));
+ prev_time=realtime;
+ prev_i=i;
+
+ return TRUE;
+}
+#endif
diff --git a/src/cliquer/cliquer.h b/src/cliquer/cliquer.h
new file mode 100644
index 0000000..492b3c8
--- /dev/null
+++ b/src/cliquer/cliquer.h
@@ -0,0 +1,57 @@
+
+#ifndef CLIQUER_H
+#define CLIQUER_H
+
+#include <string.h>
+
+#include "set.h"
+#include "graph.h"
+#include "reorder.h"
+
+typedef struct _clique_options clique_options;
+struct _clique_options {
+ int *(*reorder_function)(graph_t *, boolean);
+ int *reorder_map;
+
+ /* arguments: level, n, max, user_time, system_time, opts */
+ boolean (*time_function)(int,int,int,int,double,double,
+ clique_options *);
+ FILE *output;
+
+ boolean (*user_function)(set_t,graph_t *,clique_options *);
+ void *user_data;
+ set_t *clique_list;
+ int clique_list_length;
+};
+
+/* Weighted clique functions */
+extern int clique_max_weight(graph_t *g,clique_options *opts);
+extern set_t clique_find_single(graph_t *g,int min_weight,int max_weight,
+ boolean maximal, clique_options *opts);
+extern int clique_find_all(graph_t *g, int req_weight, boolean exact,
+ boolean maximal, clique_options *opts);
+
+/* Unweighted clique functions */
+#define clique_unweighted_max_size clique_unweighted_max_weight
+extern int clique_unweighted_max_weight(graph_t *g, clique_options *opts);
+extern set_t clique_unweighted_find_single(graph_t *g,int min_size,
+ int max_size,boolean maximal,
+ clique_options *opts);
+extern int clique_unweighted_find_all(graph_t *g, int min_size, int max_size,
+ boolean maximal, clique_options *opts);
+
+/* Time printing functions */
+/*
+extern boolean clique_print_time(int level, int i, int n, int max,
+ double cputime, double realtime,
+ clique_options *opts);
+extern boolean clique_print_time_always(int level, int i, int n, int max,
+ double cputime, double realtime,
+ clique_options *opts);
+*/
+
+/* Alternate spelling (let's be a little forgiving): */
+#define cliquer_options clique_options
+#define cliquer_default_options clique_default_options
+
+#endif /* !CLIQUER_H */
diff --git a/src/cliquer/cliquer_graph.c b/src/cliquer/cliquer_graph.c
new file mode 100644
index 0000000..6119438
--- /dev/null
+++ b/src/cliquer/cliquer_graph.c
@@ -0,0 +1,768 @@
+
+/*
+ * This file contains the graph handling routines.
+ *
+ * Copyright (C) 2002 Sampo Niskanen, Patric �sterg�rd.
+ * Licensed under the GNU GPL, read the file LICENSE for details.
+ */
+
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include "graph.h"
+
+#ifdef USING_R
+#include <R.h>
+#endif
+
+/*
+static graph_t *graph_read_dimacs_binary(FILE *fp,char *firstline);
+static graph_t *graph_read_dimacs_ascii(FILE *fp,char *firstline);
+*/
+
+
+/*
+ * graph_new()
+ *
+ * Returns a newly allocated graph with n vertices all with weight 1,
+ * and no edges.
+ */
+graph_t *graph_new(int n) {
+ graph_t *g;
+ int i;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(n>0);
+
+ g=malloc(sizeof(graph_t));
+ g->n=n;
+ g->edges=malloc(g->n * sizeof(set_t));
+ g->weights=malloc(g->n * sizeof(int));
+ for (i=0; i < g->n; i++) {
+ g->edges[i]=set_new(n);
+ g->weights[i]=1;
+ }
+ return g;
+}
+
+/*
+ * graph_free()
+ *
+ * Frees the memory associated with the graph g.
+ */
+void graph_free(graph_t *g) {
+ int i;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(g!=NULL);
+ ASSERT(g->n > 0);
+
+ for (i=0; i < g->n; i++) {
+ set_free(g->edges[i]);
+ }
+ free(g->weights);
+ free(g->edges);
+ free(g);
+ return;
+}
+
+
+/*
+ * graph_resize()
+ *
+ * Resizes graph g to given size. If size > g->n, the new vertices are
+ * not connected to any others and their weights are set to 1.
+ * If size < g->n, the last g->n - size vertices are removed.
+ */
+void graph_resize(graph_t *g, int size) {
+ int i;
+
+ ASSERT(g!=NULL);
+ ASSERT(g->n > 0);
+ ASSERT(size > 0);
+
+ if (g->n == size)
+ return;
+
+ /* Free/alloc extra edge-sets */
+ for (i=size; i < g->n; i++)
+ set_free(g->edges[i]);
+ g->edges=realloc(g->edges, size * sizeof(set_t));
+ for (i=g->n; i < size; i++)
+ g->edges[i]=set_new(size);
+
+ /* Resize original sets */
+ for (i=0; i < MIN(g->n,size); i++) {
+ g->edges[i]=set_resize(g->edges[i],size);
+ }
+
+ /* Weights */
+ g->weights=realloc(g->weights,size * sizeof(int));
+ for (i=g->n; i<size; i++)
+ g->weights[i]=1;
+
+ g->n=size;
+ return;
+}
+
+/*
+ * graph_crop()
+ *
+ * Resizes the graph so as to remove all highest-valued isolated vertices.
+ */
+void graph_crop(graph_t *g) {
+ int i;
+
+ for (i=g->n-1; i>=1; i--)
+ if (set_size(g->edges[i])>0)
+ break;
+ graph_resize(g,i+1);
+ return;
+}
+
+
+/*
+ * graph_weighted()
+ *
+ * Returns TRUE if all vertex weights of graph g are all the same.
+ *
+ * Note: Does NOT require weights to be 1.
+ */
+boolean graph_weighted(graph_t *g) {
+ int i,w;
+
+ w=g->weights[0];
+ for (i=1; i < g->n; i++)
+ if (g->weights[i] != w)
+ return TRUE;
+ return FALSE;
+}
+
+/*
+ * graph_edge_count()
+ *
+ * Returns the number of edges in graph g.
+ */
+int graph_edge_count(graph_t *g) {
+ int i;
+ int count=0;
+
+ for (i=0; i < g->n; i++) {
+ count += set_size(g->edges[i]);
+ }
+ return count/2;
+}
+
+
+#if 0
+/*
+ * graph_write_dimacs_ascii_file()
+ *
+ * Writes an ASCII dimacs-format file of graph g, with comment, to
+ * given file.
+ *
+ * Returns TRUE if successful, FALSE if an error occurred.
+ */
+boolean graph_write_dimacs_ascii_file(graph_t *g, char *comment, char *file) {
+ FILE *fp;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(file!=NULL);
+
+ if ((fp=fopen(file,"wb"))==NULL)
+ return FALSE;
+ if (!graph_write_dimacs_ascii(g,comment,fp)) {
+ fclose(fp);
+ return FALSE;
+ }
+ fclose(fp);
+ return TRUE;
+}
+
+/*
+ * graph_write_dimacs_ascii()
+ *
+ * Writes an ASCII dimacs-format file of graph g, with comment, to the
+ * file stream fp.
+ *
+ * Returns TRUE if successful, FALSE if an error occurred.
+ */
+boolean graph_write_dimacs_ascii(graph_t *g, char *comment, FILE *fp) {
+ int i,j;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(graph_test(g,NULL));
+ ASSERT(fp!=NULL);
+
+ if (comment)
+ fprintf(fp,"c %s\n",comment);
+ fprintf(fp,"p edge %d %d\n",g->n,graph_edge_count(g));
+ for (i=0; i < g->n; i++)
+ if (g->weights[i]!=1)
+ fprintf(fp,"n %d %d\n",i+1,g->weights[i]);
+ for (i=0; i < g->n; i++)
+ for (j=0; j<i; j++)
+ if (GRAPH_IS_EDGE_FAST(g,i,j))
+ fprintf(fp,"e %d %d\n",i+1,j+1);
+ return TRUE;
+}
+
+/*
+ * graph_write_dimacs_binary_file()
+ *
+ * Writes a binary dimacs-format file of graph g, with comment, to
+ * given file.
+ *
+ * Returns TRUE if successful, FALSE if an error occurred.
+ */
+boolean graph_write_dimacs_binary_file(graph_t *g, char *comment, char *file) {
+ FILE *fp;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(file!=NULL);
+
+ if ((fp=fopen(file,"wb"))==NULL)
+ return FALSE;
+ if (!graph_write_dimacs_binary(g,comment,fp)) {
+ fclose(fp);
+ return FALSE;
+ }
+ fclose(fp);
+ return TRUE;
+}
+
+/*
+ * graph_write_dimacs_binary()
+ *
+ * Writes a binary dimacs-format file of graph g, with comment, to the
+ * file stream fp.
+ *
+ * Returns TRUE if successful, FALSE if an error occurred.
+ */
+
+#define STR_APPEND(s) \
+if (headerlength+strlen(s) >= headersize) { \
+ headersize+=1024; \
+ header=realloc(header,headersize); \
+} \
+strncat(header,s,1000); \
+headerlength+=strlen(s);
+
+boolean graph_write_dimacs_binary(graph_t *g, char *comment,FILE *fp) {
+ char *buf;
+ char *header=NULL;
+ int headersize=0;
+ int headerlength=0;
+ int i,j;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(graph_test(g,NULL));
+ ASSERT(fp!=NULL);
+
+ buf=malloc(MAX(1024,g->n/8+1));
+ header=malloc(1024);
+ header[0]=0;
+ headersize=1024;
+ if (comment) {
+ strcpy(buf,"c ");
+ strncat(buf,comment,1000);
+ strcat(buf,"\n");
+ STR_APPEND(buf);
+ }
+ sprintf(buf,"p edge %d %d\n",g->n,graph_edge_count(g));
+ STR_APPEND(buf);
+ for (i=0; i < g->n; i++) {
+ if (g->weights[i]!=1) {
+ sprintf(buf,"n %d %d\n",i+1,g->weights[i]);
+ STR_APPEND(buf);
+ }
+ }
+
+ fprintf(fp,"%d\n",(int)strlen(header));
+ fprintf(fp,"%s",header);
+ free(header);
+
+ for (i=0; i < g->n; i++) {
+ memset(buf,0,i/8+1);
+ for (j=0; j<i; j++) {
+ if (GRAPH_IS_EDGE_FAST(g,i,j)) {
+ buf[j/8] |= SET_BIT_MASK(7-j%8);
+ }
+ }
+ fwrite(buf,1,i/8+1,fp);
+ }
+ free(buf);
+ return TRUE;
+}
+
+
+
+/*
+ * graph_read_dimacs_file()
+ *
+ * Reads a dimacs-format (ASCII or binary) file from the given file.
+ *
+ * Returns a newly allocated graph, or NULL if an error occurred, and an
+ * error message is printed to stderr.
+ */
+graph_t *graph_read_dimacs_file(char *file) {
+ FILE *fp;
+ graph_t *g;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(file!=NULL);
+
+ if ((fp=fopen(file,"rb"))==NULL) {
+ perror(file);
+ return NULL;
+ }
+ g=graph_read_dimacs(fp);
+ fclose(fp);
+ return g;
+}
+
+
+/*
+ * graph_read_dimacs()
+ *
+ * Reads a dimacs-format (ASCII or binary) file from the file stream fp.
+ *
+ * Returns a newly allocated graph, or NULL if an error occurred, and an
+ * error message is printed to stderr.
+ */
+graph_t *graph_read_dimacs(FILE *fp) {
+ char buffer[1024];
+ graph_t *g;
+ char tmp[10];
+ int n;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+ ASSERT(fp!=NULL);
+
+ if (fgets(buffer,1023,fp)==NULL) {
+ fprintf(stderr,"Input does not contain any data.\n");
+ return NULL;
+ }
+ if (sscanf(buffer," %d %2s",&n,tmp)!=1) {
+ g=graph_read_dimacs_ascii(fp,buffer);
+ } else {
+ g=graph_read_dimacs_binary(fp,buffer);
+ }
+ return g;
+}
+
+
+/*
+ * parse_input()
+ *
+ * Parses the string str for ASCII-format dimacs commands, and modifies
+ * the graph g accordingly.
+ *
+ * Returns TRUE if successful, FALSE if a bad command was encountered.
+ *
+ * Note: Ignores all unknown commands. The 'd', 'v' and 'x' commands
+ * (mainly generator-specific information) are ignored silently,
+ * for all others a warning message is printed to stderr.
+ */
+static boolean parse_input(char *str,graph_t *g) {
+ int i,j,w;
+ char tmp[16];
+
+ for (i=0; i<strlen(str); i++) {
+ if (!isspace((int)str[i]))
+ break;
+ }
+ if (i>=strlen(str)) /* blank line */
+ return TRUE;
+ if (str[i+1]!=0 && !isspace(str[i+1])) /* not 1-char field */
+ return FALSE;
+
+ switch (str[i]) {
+ case 'c':
+ return TRUE;
+ case 'p':
+ if (g->n != 0)
+ return FALSE;
+ if (sscanf(str," p %15s %d %d %2s",tmp,&(g->n),&i,tmp)!=3)
+ return FALSE;
+ if (g->n <= 0)
+ return FALSE;
+ g->edges=calloc(g->n,sizeof(set_t));
+ for (i=0; i<g->n; i++)
+ g->edges[i]=set_new(g->n);
+ g->weights=calloc(g->n,sizeof(int));
+ for (i=0; i<g->n; i++)
+ g->weights[i]=1;
+ return TRUE;
+ case 'n':
+ if ((g->n <= 0) || (g->weights == NULL))
+ return FALSE;
+ if (sscanf(str," n %d %d %2s",&i,&w,tmp)!=2)
+ return FALSE;
+ if (i<1 || i>g->n)
+ return FALSE;
+ if (w<=0)
+ return FALSE;
+ g->weights[i-1]=w;
+ return TRUE;
+ case 'e':
+ if ((g->n <= 0) || (g->edges == NULL))
+ return FALSE;
+ if (sscanf(str," e %d %d %2s",&i,&j,tmp)!=2)
+ return FALSE;
+ if (i<1 || j<1 || i>g->n || j>g->n)
+ return FALSE;
+ if (i==j) /* We want antireflexive graphs. */
+ return TRUE;
+ GRAPH_ADD_EDGE(g,i-1,j-1);
+ return TRUE;
+ case 'd':
+ case 'v':
+ case 'x':
+ return TRUE;
+ default:
+ fprintf(stderr,"Warning: ignoring field '%c' in "
+ "input.\n",str[i]);
+ return TRUE;
+ }
+}
+
+
+/*
+ * graph_read_dimacs_binary()
+ *
+ * Reads a dimacs-format binary file from file stream fp with the first
+ * line being firstline.
+ *
+ * Returns the newly-allocated graph or NULL if an error occurred.
+ *
+ * TODO: This function leaks memory when reading erroneous files.
+ */
+static graph_t *graph_read_dimacs_binary(FILE *fp,char *firstline) {
+ int length=0;
+ graph_t *g;
+ int i,j;
+ char *buffer;
+ char *start;
+ char *end;
+ char **buf;
+ char tmp[10];
+
+ if (sscanf(firstline," %d %2s",&length,tmp)!=1)
+ return NULL;
+ if (length<=0) {
+ fprintf(stderr,"Malformed preamble: preamble size < 0.\n");
+ return NULL;
+ }
+ buffer=malloc(length+2);
+ if (fread(buffer,1,length,fp)<length) {
+ fprintf(stderr,"Malformed preamble: unexpected "
+ "end of file.\n");
+ free(buffer);
+ return NULL;
+ }
+
+ g=calloc(1,sizeof(graph_t));
+ start=buffer;
+ while (start < buffer+length) {
+ end=strchr(start,'\n');
+ if (end==NULL)
+ end=buffer+length;
+ end[0]=0;
+ if (!parse_input(start,g)) {
+ fprintf(stderr,"Malformed preamble: %s\n",start);
+ free (buffer);
+ return NULL;
+ }
+ start=end+1;
+ }
+
+ free(buffer);
+ if (g->n <= 0) {
+ fprintf(stderr,"Malformed preamble: number of "
+ "vertices <= 0\n");
+ free(g);
+ return NULL;
+ }
+
+ /* Binary part. */
+ buf=calloc(g->n,sizeof(char*));
+ for (i=0; i < g->n; i++) {
+ buf[i]=calloc(g->n,1);
+ if (fread(buf[i],1,i/8+1,fp) < (i/8+1)) {
+ fprintf(stderr,"Unexpected end of file when "
+ "reading graph.\n");
+ return NULL;
+ }
+ }
+
+ for (i=0; i < g->n; i++) {
+ for (j=0; j<i; j++) {
+ if (buf[i][j/8]&(1<<(7-(j%8)))) {
+ GRAPH_ADD_EDGE(g,i,j);
+ }
+ }
+ free(buf[i]);
+ }
+ free(buf);
+
+ return g;
+}
+
+
+/*
+ * graph_read_dimacs_ascii()
+ *
+ * Reads a dimacs-format ASCII file from file stream fp with the first
+ * line being firstline.
+ *
+ * Returns the newly-allocated graph or NULL if an error occurred.
+ *
+ * TODO: This function leaks memory when reading erroneous files.
+ */
+static graph_t *graph_read_dimacs_ascii(FILE *fp, char *firstline) {
+ graph_t *g;
+ char buffer[1024];
+
+ g=calloc(1,sizeof(graph_t));
+
+ if (!parse_input(firstline,g)) {
+ fprintf(stderr,"Malformed input: %s",firstline);
+ free(g);
+ return NULL;
+ }
+ while (fgets(buffer,1023,fp)) {
+ if (!parse_input(buffer,g)) {
+ fprintf(stderr,"Malformed input: %s",buffer);
+ return NULL;
+ }
+ }
+ if (g->n <= 0) {
+ free(g);
+ fprintf(stderr,"Unexpected end of file when reading graph.\n");
+ return NULL;
+ }
+
+ return g;
+}
+#endif
+
+
+#ifndef USING_R
+/*
+ * graph_print()
+ *
+ * Prints a representation of the graph g to stdout (along with any errors
+ * noticed). Mainly useful for debugging purposes and trivial output.
+ *
+ * The output consists of a first line describing the dimensions and then
+ * one line per vertex containing the vertex number (numbered 0,...,n-1),
+ * the vertex weight (if the graph is weighted), "->" and then a list
+ * of all vertices it is adjacent to.
+ */
+void graph_print(graph_t *g) {
+ int i,j;
+ int asymm=0;
+ int refl=0;
+ int nonpos=0;
+ int extra=0;
+ unsigned int weight=0;
+ boolean weighted;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+
+ if (g==NULL) {
+ printf(" WARNING: Graph pointer is NULL!\n");
+ return;
+ }
+ if (g->n <= 0) {
+ printf(" WARNING: Graph has %d vertices "
+ "(should be positive)!\n",g->n);
+ return;
+ }
+
+ weighted=graph_weighted(g);
+
+ printf("%s graph has %d vertices, %d edges (density %.2f).\n",
+ weighted?"Weighted":((g->weights[0]==1)?
+ "Unweighted":"Semi-weighted"),
+ g->n,graph_edge_count(g),
+ (float)graph_edge_count(g)/((float)(g->n - 1)*(g->n)/2));
+
+ for (i=0; i < g->n; i++) {
+ printf("%2d",i);
+ if (weighted) {
+ printf(" w=%d",g->weights[i]);
+ if (g->weights[i] <= 0) {
+ printf("*NON-POSITIVE*");
+ nonpos++;
+ }
+ }
+ if (weight < INT_MAX)
+ weight+=g->weights[i];
+ printf(" ->");
+ for (j=0; j < g->n; j++) {
+ if (SET_CONTAINS_FAST(g->edges[i],j)) {
+ printf(" %d",j);
+ if (i==j) {
+ printf("*REFLEXIVE*");
+ refl++;
+ }
+ if (!SET_CONTAINS_FAST(g->edges[j],i)) {
+ printf("*ASYMMERTIC*");
+ asymm++;
+ }
+ }
+ }
+ for (j=g->n; j < SET_ARRAY_LENGTH(g->edges[i])*ELEMENTSIZE;
+ j++) {
+ if (SET_CONTAINS_FAST(g->edges[i],j)) {
+ printf(" %d*NON-EXISTENT*",j);
+ extra++;
+ }
+ }
+ printf("\n");
+ }
+
+ if (asymm)
+ printf(" WARNING: Graph contained %d asymmetric edges!\n",
+ asymm);
+ if (refl)
+ printf(" WARNING: Graph contained %d reflexive edges!\n",
+ refl);
+ if (nonpos)
+ printf(" WARNING: Graph contained %d non-positive vertex "
+ "weights!\n",nonpos);
+ if (extra)
+ printf(" WARNING: Graph contained %d edges to "
+ "non-existent vertices!\n",extra);
+ if (weight>=INT_MAX)
+ printf(" WARNING: Total graph weight >= INT_MAX!\n");
+ return;
+}
+
+#endif
+
+/*
+ * graph_test()
+ *
+ * Tests graph g to be valid. Checks that g is non-NULL, the edges are
+ * symmetric and anti-reflexive, and that all vertex weights are positive.
+ * If output is non-NULL, prints a few lines telling the status of the graph
+ * to file descriptor output.
+ *
+ * Returns TRUE if the graph is valid, FALSE otherwise.
+ */
+boolean graph_test(graph_t *g,FILE *output) {
+ int i,j;
+ int edges=0;
+ int asymm=0;
+ int nonpos=0;
+ int refl=0;
+ int extra=0;
+ unsigned int weight=0;
+ boolean weighted;
+
+ ASSERT((sizeof(setelement)*8)==ELEMENTSIZE);
+
+ if (g==NULL) {
+ if (output)
+ fprintf(output," WARNING: Graph pointer is NULL!\n");
+ return FALSE;
+ }
+
+ weighted=graph_weighted(g);
+
+ for (i=0; i < g->n; i++) {
+ if (g->edges[i]==NULL) {
+ if (output)
+ fprintf(output," WARNING: Graph edge set "
+ "NULL!\n"
+ " (further warning suppressed)\n");
+ return FALSE;
+ }
+ if (SET_MAX_SIZE(g->edges[i]) < g->n) {
+ if (output)
+ fprintf(output," WARNING: Graph edge set "
+ "too small!\n"
+ " (further warnings suppressed)\n");
+ return FALSE;
+ }
+ for (j=0; j < g->n; j++) {
+ if (SET_CONTAINS_FAST(g->edges[i],j)) {
+ edges++;
+ if (i==j) {
+ refl++;
+ }
+ if (!SET_CONTAINS_FAST(g->edges[j],i)) {
+ asymm++;
+ }
+ }
+ }
+ for (j=g->n; j < SET_ARRAY_LENGTH(g->edges[i])*ELEMENTSIZE;
+ j++) {
+ if (SET_CONTAINS_FAST(g->edges[i],j))
+ extra++;
+ }
+ if (g->weights[i] <= 0)
+ nonpos++;
+ if (weight<INT_MAX)
+ weight += g->weights[i];
+ }
+
+ edges/=2; /* Each is counted twice. */
+
+ if (output) {
+ /* Semi-weighted means all weights are equal, but not 1. */
+ fprintf(output,"%s graph has %d vertices, %d edges "
+ "(density %.2f).\n",
+ weighted?"Weighted":
+ ((g->weights[0]==1)?"Unweighted":"Semi-weighted"),
+ g->n,edges,(float)edges/((float)(g->n - 1)*(g->n)/2));
+
+ if (asymm)
+ fprintf(output," WARNING: Graph contained %d "
+ "asymmetric edges!\n",asymm);
+ if (refl)
+ fprintf(output," WARNING: Graph contained %d "
+ "reflexive edges!\n",refl);
+ if (nonpos)
+ fprintf(output," WARNING: Graph contained %d "
+ "non-positive vertex weights!\n",nonpos);
+ if (extra)
+ fprintf(output," WARNING: Graph contained %d edges "
+ "to non-existent vertices!\n",extra);
+ if (weight>=INT_MAX)
+ fprintf(output," WARNING: Total graph weight >= "
+ "INT_MAX!\n");
+ if (asymm==0 && refl==0 && nonpos==0 && extra==0 &&
+ weight<INT_MAX)
+ fprintf(output,"Graph OK.\n");
+ }
+
+ if (asymm || refl || nonpos || extra || weight>=INT_MAX)
+ return FALSE;
+
+ return TRUE;
+}
+
+
+/*
+ * graph_test_regular()
+ *
+ * Returns the vertex degree for regular graphs, or -1 if the graph is
+ * not regular.
+ */
+int graph_test_regular(graph_t *g) {
+ int i,n;
+
+ n=set_size(g->edges[0]);
+
+ for (i=1; i < g->n; i++) {
+ if (set_size(g->edges[i]) != n)
+ return -1;
+ }
+ return n;
+}
+
diff --git a/src/cliquer/cliquerconf.h b/src/cliquer/cliquerconf.h
new file mode 100644
index 0000000..47d923b
--- /dev/null
+++ b/src/cliquer/cliquerconf.h
@@ -0,0 +1,68 @@
+
+#ifndef CLIQUERCONF_H
+#define CLIQUERCONF_H
+
+/*
+ * setelement is the basic memory type used in sets. It is often fastest
+ * to be as large as can fit into the CPU registers.
+ *
+ * ELEMENTSIZE is the size of one setelement, measured in bits. It must
+ * be either 16, 32 or 64 (otherwise additional changes must be made to
+ * the source).
+ *
+ * The default is to use "unsigned long int" and attempt to guess the
+ * size using <limits.h>, which should work pretty well. Check functioning
+ * with "make test".
+ */
+
+/* typedef unsigned long int setelement; */
+/* #define ELEMENTSIZE 64 */
+
+
+/*
+ * INLINE is a command prepended to function declarations to instruct the
+ * compiler to inline the function. If inlining is not desired, define blank.
+ *
+ * The default is to use "inline", which is recognized by most compilers.
+ */
+
+/* #define INLINE */
+/* #define INLINE __inline__ */
+#if __STDC_VERSION__ >= 199901L
+ #define INLINE inline
+#else
+ #if defined(_MSC_VER)
+ #define INLINE __inline
+ #elif defined(__GNUC__)
+ #define INLINE __inline__
+ #else
+ #define INLINE
+ #endif
+#endif
+
+
+/*
+ * Set handling functions are defined as static functions in set.h for
+ * performance reasons. This may cause unnecessary warnings from the
+ * compiler. Some compilers (such as GCC) have the possibility to turn
+ * off the warnings on a per-function basis using a flag prepended to
+ * the function declaration.
+ *
+ * The default is to use the correct attribute when compiling with GCC,
+ * or no flag otherwise.
+ */
+
+/* #define UNUSED_FUNCTION __attribute__((unused)) */
+/* #define UNUSED_FUNCTION */
+
+
+/*
+ * Uncommenting the following will disable all assertions (checks that
+ * function arguments and other variables are correct). This is highly
+ * discouraged, as it allows bugs to go unnoticed easier. The assertions
+ * are set so that they do not slow down programs notably.
+ */
+
+/* #define ASSERT(x) */
+
+#endif /* !CLIQUERCONF_H */
diff --git a/src/cliquer/graph.h b/src/cliquer/graph.h
new file mode 100644
index 0000000..956f2a1
--- /dev/null
+++ b/src/cliquer/graph.h
@@ -0,0 +1,75 @@
+
+#ifndef CLIQUER_GRAPH_H
+#define CLIQUER_GRAPH_H
+
+#include "set.h"
+
+typedef struct _graph_t graph_t;
+struct _graph_t {
+ int n; /* Vertices numbered 0...n-1 */
+ set_t *edges; /* A list of n sets (the edges). */
+ int *weights; /* A list of n vertex weights. */
+};
+
+
+#define GRAPH_IS_EDGE_FAST(g,i,j) (SET_CONTAINS_FAST((g)->edges[(i)],(j)))
+#define GRAPH_IS_EDGE(g,i,j) (((i)<((g)->n))?SET_CONTAINS((g)->edges[(i)], \
+ (j)):FALSE)
+#define GRAPH_ADD_EDGE(g,i,j) do { \
+ SET_ADD_ELEMENT((g)->edges[(i)],(j)); \
+ SET_ADD_ELEMENT((g)->edges[(j)],(i)); \
+} while (FALSE)
+#define GRAPH_DEL_EDGE(g,i,j) do { \
+ SET_DEL_ELEMENT((g)->edges[(i)],(j)); \
+ SET_DEL_ELEMENT((g)->edges[(j)],(i)); \
+} while (FALSE)
+
+
+extern graph_t *graph_new(int n);
+extern void graph_free(graph_t *g);
+extern void graph_resize(graph_t *g, int size);
+extern void graph_crop(graph_t *g);
+
+extern boolean graph_weighted(graph_t *g);
+extern int graph_edge_count(graph_t *g);
+
+/*
+extern graph_t *graph_read_dimacs(FILE *fp);
+extern graph_t *graph_read_dimacs_file(char *file);
+extern boolean graph_write_dimacs_ascii(graph_t *g, char *comment,FILE *fp);
+extern boolean graph_write_dimacs_ascii_file(graph_t *g,char *comment,
+ char *file);
+extern boolean graph_write_dimacs_binary(graph_t *g, char *comment,FILE *fp);
+extern boolean graph_write_dimacs_binary_file(graph_t *g, char *comment,
+ char *file);
+*/
+
+extern void graph_print(graph_t *g);
+extern boolean graph_test(graph_t *g, FILE *output);
+extern int graph_test_regular(graph_t *g);
+
+UNUSED_FUNCTION INLINE
+static int graph_subgraph_weight(graph_t *g,set_t s) {
+ int i,j;
+ int count=0;
+ setelement e;
+
+ for (i=0; i<SET_ARRAY_LENGTH(s); i++) {
+ if (s[i]) {
+ e=s[i];
+ for (j=0; j<ELEMENTSIZE; j++) {
+ if (e&1)
+ count+=g->weights[i*ELEMENTSIZE+j];
+ e = e>>1;
+ }
+ }
+ }
+ return count;
+}
+
+UNUSED_FUNCTION INLINE
+static int graph_vertex_degree(graph_t *g, int v) {
+ return set_size(g->edges[v]);
+}
+
+#endif /* !CLIQUER_GRAPH_H */
diff --git a/src/cliquer/misc.h b/src/cliquer/misc.h
new file mode 100644
index 0000000..8022103
--- /dev/null
+++ b/src/cliquer/misc.h
@@ -0,0 +1,73 @@
+
+#ifndef CLIQUER_MISC_H
+#define CLIQUER_MISC_H
+
+#include "cliquerconf.h"
+
+/*
+ * We #define boolean instead of using a typedef because nauty.h uses it
+ * also. AFAIK, there is no way to check for an existing typedef, and
+ * re-typedefing is illegal (even when using exactly the same datatype!).
+ */
+#ifndef boolean
+#define boolean int
+#endif
+
+
+/*
+ * The original cliquer source has some functions incorrectly marked as unused,
+ * thus leave this undefined.
+ */
+#define UNUSED_FUNCTION
+
+
+/*
+ * Default inlining directive: "inline"
+ */
+#ifndef INLINE
+#define INLINE inline
+#endif
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef ASSERT
+#ifdef USING_R
+#include <R.h>
+#define ASSERT(expr) \
+ if (!(expr)) { \
+ error("cliquer file %s: line %d: assertion failed: " \
+ "(%s)\n",__FILE__,__LINE__,#expr); \
+ }
+#else
+#define ASSERT(expr) \
+ if (!(expr)) { \
+ fprintf(stderr,"cliquer file %s: line %d: assertion failed: " \
+ "(%s)\n",__FILE__,__LINE__,#expr); \
+ abort(); \
+ }
+#endif
+#endif /* !ASSERT */
+
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
+
+#ifndef MIN
+#define MIN(a,b) (((a)<(b))?(a):(b))
+#endif
+#ifndef MAX
+#define MAX(a,b) (((a)>(b))?(a):(b))
+#endif
+#ifndef ABS
+#define ABS(v) (((v)<0)?(-(v)):(v))
+#endif
+
+#endif /* !CLIQUER_MISC_H */
+
diff --git a/src/cliquer/reorder.c b/src/cliquer/reorder.c
new file mode 100644
index 0000000..6f1a05e
--- /dev/null
+++ b/src/cliquer/reorder.c
@@ -0,0 +1,425 @@
+
+/*
+ * This file contains the vertex reordering routines.
+ *
+ * Copyright (C) 2002 Sampo Niskanen, Patric �sterg�rd.
+ * Licensed under the GNU GPL, read the file LICENSE for details.
+ */
+
+#include "reorder.h"
+
+#include <stdlib.h>
+
+#include <limits.h>
+
+#include <igraph_random.h>
+
+
+/*
+ * reorder_set()
+ *
+ * Reorders the set s with a function i -> order[i].
+ *
+ * Note: Assumes that order is the same size as SET_MAX_SIZE(s).
+ */
+void reorder_set(set_t s,int *order) {
+ set_t tmp;
+ int i,j;
+ setelement e;
+
+ ASSERT(reorder_is_bijection(order,SET_MAX_SIZE(s)));
+
+ tmp=set_new(SET_MAX_SIZE(s));
+
+ for (i=0; i<(SET_MAX_SIZE(s)/ELEMENTSIZE); i++) {
+ e=s[i];
+ if (e==0)
+ continue;
+ for (j=0; j<ELEMENTSIZE; j++) {
+ if (e&1) {
+ SET_ADD_ELEMENT(tmp,order[i*ELEMENTSIZE+j]);
+ }
+ e = e>>1;
+ }
+ }
+ if (SET_MAX_SIZE(s)%ELEMENTSIZE) {
+ e=s[i];
+ for (j=0; j<(SET_MAX_SIZE(s)%ELEMENTSIZE); j++) {
+ if (e&1) {
+ SET_ADD_ELEMENT(tmp,order[i*ELEMENTSIZE+j]);
+ }
+ e = e>>1;
+ }
+ }
+ set_copy(s,tmp);
+ set_free(tmp);
+ return;
+}
+
+
+/*
+ * reorder_graph()
+ *
+ * Reorders the vertices in the graph with function i -> order[i].
+ *
+ * Note: Assumes that order is of size g->n.
+ */
+void reorder_graph(graph_t *g, int *order) {
+ int i;
+ set_t *tmp_e;
+ int *tmp_w;
+
+ ASSERT(reorder_is_bijection(order,g->n));
+
+ tmp_e=malloc(g->n * sizeof(set_t));
+ tmp_w=malloc(g->n * sizeof(int));
+ for (i=0; i<g->n; i++) {
+ reorder_set(g->edges[i],order);
+ tmp_e[order[i]]=g->edges[i];
+ tmp_w[order[i]]=g->weights[i];
+ }
+ for (i=0; i<g->n; i++) {
+ g->edges[i]=tmp_e[i];
+ g->weights[i]=tmp_w[i];
+ }
+ free(tmp_e);
+ free(tmp_w);
+ return;
+}
+
+
+
+/*
+ * reorder_duplicate()
+ *
+ * Returns a newly allocated duplicate of the given ordering.
+ */
+int *reorder_duplicate(int *order,int n) {
+ int *new;
+
+ new=malloc(n*sizeof(int));
+ memcpy(new,order,n*sizeof(int));
+ return new;
+}
+
+/*
+ * reorder_invert()
+ *
+ * Inverts the given ordering so that new[old[i]]==i.
+ *
+ * Note: Asserts that order is a bijection.
+ */
+void reorder_invert(int *order,int n) {
+ int *new;
+ int i;
+
+ ASSERT(reorder_is_bijection(order,n));
+
+ new=malloc(n*sizeof(int));
+ for (i=0; i<n; i++)
+ new[order[i]]=i;
+ for (i=0; i<n; i++)
+ order[i]=new[i];
+ free(new);
+ return;
+}
+
+/*
+ * reorder_reverse()
+ *
+ * Reverses the given ordering so that new[i] == n-1 - old[i].
+ */
+void reorder_reverse(int *order,int n) {
+ int i;
+
+ for (i=0; i<n; i++)
+ order[i] = n-1 - order[i];
+ return;
+}
+
+/*
+ * reorder_is_bijection
+ *
+ * Checks that an ordering is a bijection {0,...,n-1} -> {0,...,n-1}.
+ *
+ * Returns TRUE if it is a bijection, FALSE otherwise.
+ */
+boolean reorder_is_bijection(int *order,int n) {
+ boolean *used;
+ int i;
+
+ used=calloc(n,sizeof(boolean));
+ for (i=0; i<n; i++) {
+ if (order[i]<0 || order[i]>=n) {
+ free(used);
+ return FALSE;
+ }
+ if (used[order[i]]) {
+ free(used);
+ return FALSE;
+ }
+ used[order[i]]=TRUE;
+ }
+ for (i=0; i<n; i++) {
+ if (!used[i]) {
+ free(used);
+ return FALSE;
+ }
+ }
+ free(used);
+ return TRUE;
+}
+
+/*
+ * reorder_ident()
+ *
+ * Returns a newly allocated identity ordering of size n, ie. order[i]==i.
+ */
+int *reorder_ident(int n) {
+ int i;
+ int *order;
+
+ order=malloc(n*sizeof(int));
+ for (i=0; i<n; i++)
+ order[i]=i;
+ return order;
+}
+
+
+
+/*** Reordering functions for use in clique_options ***/
+
+/*
+ * reorder_by_ident()
+ *
+ * Returns an identity ordering.
+ */
+int *reorder_by_ident(graph_t *g,boolean weighted) {
+ return reorder_ident(g->n);
+}
+
+/*
+ * reorder_by_reverse()
+ *
+ * Returns a reverse identity ordering.
+ */
+int *reorder_by_reverse(graph_t *g,boolean weighted) {
+ int i;
+ int *order;
+
+ order=malloc(g->n * sizeof(int));
+ for (i=0; i < g->n; i++)
+ order[i]=g->n-i-1;
+ return order;
+}
+
+/*
+ * reorder_by_greedy_coloring()
+ *
+ * Equivalent to reorder_by_weighted_greedy_coloring or
+ * reorder_by_unweighted_greedy_coloring according to the value of weighted.
+ */
+int *reorder_by_greedy_coloring(graph_t *g,boolean weighted) {
+ if (weighted)
+ return reorder_by_weighted_greedy_coloring(g,weighted);
+ else
+ return reorder_by_unweighted_greedy_coloring(g,weighted);
+}
+
+
+/*
+ * reorder_by_unweighted_greedy_coloring()
+ *
+ * Returns an ordering for the graph g by coloring the clique one
+ * color at a time, always adding the vertex of largest degree within
+ * the uncolored graph, and numbering these vertices 0, 1, ...
+ *
+ * Experimentally efficient for use with unweighted graphs.
+ */
+int *reorder_by_unweighted_greedy_coloring(graph_t *g,boolean weighted) {
+ int i,j,v;
+ boolean *tmp_used;
+ int *degree; /* -1 for used vertices */
+ int *order;
+ int maxdegree,maxvertex=0;
+ boolean samecolor;
+
+ tmp_used=calloc(g->n,sizeof(boolean));
+ degree=calloc(g->n,sizeof(int));
+ order=calloc(g->n,sizeof(int));
+
+ for (i=0; i < g->n; i++) {
+ for (j=0; j < g->n; j++) {
+ ASSERT(!((i==j) && GRAPH_IS_EDGE(g,i,j)));
+ if (GRAPH_IS_EDGE(g,i,j))
+ degree[i]++;
+ }
+ }
+
+ v=0;
+ while (v < g->n) {
+ /* Reset tmp_used. */
+ memset(tmp_used,0,g->n * sizeof(boolean));
+
+ do {
+ /* Find vertex to be colored. */
+ maxdegree=0;
+ samecolor=FALSE;
+ for (i=0; i < g->n; i++) {
+ if (!tmp_used[i] && degree[i] >= maxdegree) {
+ maxvertex=i;
+ maxdegree=degree[i];
+ samecolor=TRUE;
+ }
+ }
+ if (samecolor) {
+ order[v]=maxvertex;
+ degree[maxvertex]=-1;
+ v++;
+
+ /* Mark neighbors not to color with same
+ * color and update neighbor degrees. */
+ for (i=0; i < g->n; i++) {
+ if (GRAPH_IS_EDGE(g,maxvertex,i)) {
+ tmp_used[i]=TRUE;
+ degree[i]--;
+ }
+ }
+ }
+ } while (samecolor);
+ }
+
+ free(tmp_used);
+ free(degree);
+ return order;
+}
+
+/*
+ * reorder_by_weighted_greedy_coloring()
+ *
+ * Returns an ordering for the graph g by coloring the clique one
+ * color at a time, always adding the vertex that (in order of importance):
+ * 1. has the minimum weight in the remaining graph
+ * 2. has the largest sum of weights surrounding the vertex
+ *
+ * Experimentally efficient for use with weighted graphs.
+ */
+int *reorder_by_weighted_greedy_coloring(graph_t *g, boolean weighted) {
+ int i,j,p=0;
+ int cnt;
+ int *nwt; /* Sum of surrounding vertices' weights */
+ int min_wt,max_nwt;
+ boolean *used;
+ int *order;
+
+ nwt=malloc(g->n * sizeof(int));
+ order=malloc(g->n * sizeof(int));
+ used=calloc(g->n,sizeof(boolean));
+
+ for (i=0; i < g->n; i++) {
+ nwt[i]=0;
+ for (j=0; j < g->n; j++)
+ if (GRAPH_IS_EDGE(g, i, j))
+ nwt[i] += g->weights[j];
+ }
+
+ for (cnt=0; cnt < g->n; cnt++) {
+ min_wt=INT_MAX;
+ max_nwt=-1;
+ for (i=g->n-1; i>=0; i--)
+ if ((!used[i]) && (g->weights[i] < min_wt))
+ min_wt=g->weights[i];
+ for (i=g->n-1; i>=0; i--) {
+ if (used[i] || (g->weights[i] > min_wt))
+ continue;
+ if (nwt[i] > max_nwt) {
+ max_nwt=nwt[i];
+ p=i;
+ }
+ }
+ order[cnt]=p;
+ used[p]=TRUE;
+ for (j=0; j < g->n; j++)
+ if ((!used[j]) && (GRAPH_IS_EDGE(g, p, j)))
+ nwt[j] -= g->weights[p];
+ }
+
+ free(nwt);
+ free(used);
+
+ ASSERT(reorder_is_bijection(order,g->n));
+
+ return order;
+}
+
+/*
+ * reorder_by_degree()
+ *
+ * Returns a reordering of the graph g so that the vertices with largest
+ * degrees (most neighbors) are first.
+ */
+int *reorder_by_degree(graph_t *g, boolean weighted) {
+ int i,j,v;
+ int *degree;
+ int *order;
+ int maxdegree,maxvertex=0;
+
+ degree=calloc(g->n,sizeof(int));
+ order=calloc(g->n,sizeof(int));
+
+ for (i=0; i < g->n; i++) {
+ for (j=0; j < g->n; j++) {
+ ASSERT(!((i==j) && GRAPH_IS_EDGE(g,i,j)));
+ if (GRAPH_IS_EDGE(g,i,j))
+ degree[i]++;
+ }
+ }
+
+ for (v=0; v < g->n; v++) {
+ maxdegree=0;
+ for (i=0; i < g->n; i++) {
+ if (degree[i] >= maxdegree) {
+ maxvertex=i;
+ maxdegree=degree[i];
+ }
+ }
+ order[v]=maxvertex;
+ degree[maxvertex]=-1; /* used */
+/*** Max. degree withing unselected graph:
+ for (i=0; i < g->n; i++) {
+ if (GRAPH_IS_EDGE(g,maxvertex,i))
+ degree[i]--;
+ }
+***/
+ }
+
+ free(degree);
+ return order;
+}
+
+/*
+ * reorder_by_random()
+ *
+ * Returns a random reordering for graph g.
+ * Note: Used the functions rand() and srand() to generate the random
+ * numbers. srand() is re-initialized every time reorder_by_random()
+ * is called using the system time.
+ */
+int *reorder_by_random(graph_t *g, boolean weighted) {
+ int i,r;
+ int *new;
+ boolean *used;
+
+ new=calloc(g->n, sizeof(int));
+ used=calloc(g->n, sizeof(boolean));
+ for (i=0; i < g->n; i++) {
+ do {
+ r = igraph_rng_get_integer(igraph_rng_default(), 0, g->n - 1);
+ } while (used[r]);
+ new[i]=r;
+ used[r]=TRUE;
+ }
+ free(used);
+ return new;
+}
+
diff --git a/src/cliquer/reorder.h b/src/cliquer/reorder.h
new file mode 100644
index 0000000..5c06d31
--- /dev/null
+++ b/src/cliquer/reorder.h
@@ -0,0 +1,26 @@
+
+#ifndef CLIQUER_REORDER_H
+#define CLIQUER_REORDER_H
+
+#include "set.h"
+#include "graph.h"
+
+extern void reorder_set(set_t s,int *order);
+extern void reorder_graph(graph_t *g, int *order);
+extern int *reorder_duplicate(int *order,int n);
+extern void reorder_invert(int *order,int n);
+extern void reorder_reverse(int *order,int n);
+extern int *reorder_ident(int n);
+extern boolean reorder_is_bijection(int *order,int n);
+
+
+#define reorder_by_default reorder_by_greedy_coloring
+extern int *reorder_by_greedy_coloring(graph_t *g, boolean weighted);
+extern int *reorder_by_weighted_greedy_coloring(graph_t *g, boolean weighted);
+extern int *reorder_by_unweighted_greedy_coloring(graph_t *g,boolean weighted);
+extern int *reorder_by_degree(graph_t *g, boolean weighted);
+extern int *reorder_by_random(graph_t *g, boolean weighted);
+extern int *reorder_by_ident(graph_t *g, boolean weighted);
+extern int *reorder_by_reverse(graph_t *g, boolean weighted);
+
+#endif /* !CLIQUER_REORDER_H */
diff --git a/src/cliquer/set.h b/src/cliquer/set.h
new file mode 100644
index 0000000..bd6c73e
--- /dev/null
+++ b/src/cliquer/set.h
@@ -0,0 +1,389 @@
+
+/*
+ * This file contains the set handling routines.
+ *
+ * Copyright (C) 2002 Sampo Niskanen, Patric �sterg�rd.
+ * Licensed under the GNU GPL, read the file LICENSE for details.
+ */
+
+#ifndef CLIQUER_SET_H
+#define CLIQUER_SET_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
+#include "misc.h"
+
+/*
+ * Sets are arrays of setelement's (typically unsigned long int's) with
+ * representative bits for each value they can contain. The values
+ * are numbered 0,...,n-1.
+ */
+
+
+/*** Variable types and constants. ***/
+
+
+/*
+ * If setelement hasn't been declared:
+ * - use "unsigned long int" as setelement
+ * - try to deduce size from ULONG_MAX
+ */
+
+#ifndef ELEMENTSIZE
+typedef unsigned long int setelement;
+# if (ULONG_MAX == 65535)
+# define ELEMENTSIZE 16
+# elif (ULONG_MAX == 4294967295)
+# define ELEMENTSIZE 32
+# else
+# define ELEMENTSIZE 64
+# endif
+#endif /* !ELEMENTSIZE */
+
+typedef setelement * set_t;
+
+
+/*** Counting amount of 1 bits in a setelement ***/
+
+/* Array for amount of 1 bits in a byte. */
+static int set_bit_count[256] = {
+ 0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,
+ 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+ 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+ 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+ 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+ 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+ 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+ 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+ 1,2,2,3,2,3,3,4,2,3,3,4,3,4,4,5,
+ 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+ 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+ 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+ 2,3,3,4,3,4,4,5,3,4,4,5,4,5,5,6,
+ 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+ 3,4,4,5,4,5,5,6,4,5,5,6,5,6,6,7,
+ 4,5,5,6,5,6,6,7,5,6,6,7,6,7,7,8 };
+
+/* The following macros assume that all higher bits are 0.
+ * They may in some cases be useful also on with other ELEMENTSIZE's,
+ * so we define them all. */
+#define SET_ELEMENT_BIT_COUNT_8(a) (set_bit_count[(a)])
+#define SET_ELEMENT_BIT_COUNT_16(a) (set_bit_count[(a)>>8] + \
+ set_bit_count[(a)&0xFF])
+#define SET_ELEMENT_BIT_COUNT_32(a) (set_bit_count[(a)>>24] + \
+ set_bit_count[((a)>>16)&0xFF] + \
+ set_bit_count[((a)>>8)&0xFF] + \
+ set_bit_count[(a)&0xFF])
+#define SET_ELEMENT_BIT_COUNT_64(a) (set_bit_count[(a)>>56] + \
+ set_bit_count[((a)>>48)&0xFF] + \
+ set_bit_count[((a)>>40)&0xFF] + \
+ set_bit_count[((a)>>32)&0xFF] + \
+ set_bit_count[((a)>>24)&0xFF] + \
+ set_bit_count[((a)>>16)&0xFF] + \
+ set_bit_count[((a)>>8)&0xFF] + \
+ set_bit_count[(a)&0xFF])
+#if (ELEMENTSIZE==64)
+# define SET_ELEMENT_BIT_COUNT(a) SET_ELEMENT_BIT_COUNT_64(a)
+# define FULL_ELEMENT ((setelement)0xFFFFFFFFFFFFFFFF)
+#elif (ELEMENTSIZE==32)
+# define SET_ELEMENT_BIT_COUNT(a) SET_ELEMENT_BIT_COUNT_32(a)
+# define FULL_ELEMENT ((setelement)0xFFFFFFFF)
+#elif (ELEMENTSIZE==16)
+# define SET_ELEMENT_BIT_COUNT(a) SET_ELEMENT_BIT_COUNT_16(a)
+# define FULL_ELEMENT ((setelement)0xFFFF)
+#else
+# error "SET_ELEMENT_BIT_COUNT(a) not defined for current ELEMENTSIZE"
+#endif
+
+
+
+/*** Macros and functions ***/
+
+/*
+ * Gives a value with bit x (counting from lsb up) set.
+ *
+ * Making this as a table might speed up things on some machines
+ * (though on most modern machines it's faster to shift instead of
+ * using memory). Making it a macro makes it easy to change.
+ */
+#define SET_BIT_MASK(x) ((setelement)1<<(x))
+
+
+
+/* Set element handling macros */
+
+#define SET_ELEMENT_INTERSECT(a,b) ((a)&(b))
+#define SET_ELEMENT_UNION(a,b) ((a)|(b))
+#define SET_ELEMENT_DIFFERENCE(a,b) ((a)&(~(b)))
+#define SET_ELEMENT_CONTAINS(e,v) ((e)&SET_BIT_MASK(v))
+
+
+/* Set handling macros */
+
+#define SET_ADD_ELEMENT(s,a) \
+ ((s)[(a)/ELEMENTSIZE] |= SET_BIT_MASK((a)%ELEMENTSIZE))
+#define SET_DEL_ELEMENT(s,a) \
+ ((s)[(a)/ELEMENTSIZE] &= ~SET_BIT_MASK((a)%ELEMENTSIZE))
+#define SET_CONTAINS_FAST(s,a) (SET_ELEMENT_CONTAINS((s)[(a)/ELEMENTSIZE], \
+ (a)%ELEMENTSIZE))
+#define SET_CONTAINS(s,a) (((a)<SET_MAX_SIZE(s))?SET_CONTAINS_FAST(s,a):FALSE)
+
+/* Sets can hold values between 0,...,SET_MAX_SIZE(s)-1 */
+#define SET_MAX_SIZE(s) ((s)[-1])
+/* Sets consist of an array of SET_ARRAY_LENGTH(s) setelements */
+#define SET_ARRAY_LENGTH(s) (((s)[-1]+ELEMENTSIZE-1)/ELEMENTSIZE)
+
+
+/*
+ * set_new()
+ *
+ * Create a new set that can hold values in the range 0,...,size-1.
+ */
+UNUSED_FUNCTION
+static set_t set_new(int size) {
+ int n;
+ set_t s;
+
+ ASSERT(size>0);
+
+ n=(size/ELEMENTSIZE+1)+1;
+ s=calloc(n,sizeof(setelement));
+ s[0]=size;
+
+ return &(s[1]);
+}
+
+/*
+ * set_free()
+ *
+ * Free the memory associated with set s.
+ */
+UNUSED_FUNCTION INLINE
+static void set_free(set_t s) {
+ ASSERT(s!=NULL);
+ free(&(s[-1]));
+}
+
+/*
+ * set_resize()
+ *
+ * Resizes set s to given size. If the size is less than SET_MAX_SIZE(s),
+ * the last elements are dropped.
+ *
+ * Returns a pointer to the new set.
+ */
+UNUSED_FUNCTION INLINE
+static set_t set_resize(set_t s, int size) {
+ int n;
+
+ ASSERT(size>0);
+
+ n=(size/ELEMENTSIZE+1);
+ s=((setelement *)realloc(s-1,(n+1)*sizeof(setelement)))+1;
+
+ if (n>SET_ARRAY_LENGTH(s))
+ memset(s+SET_ARRAY_LENGTH(s),0,
+ (n-SET_ARRAY_LENGTH(s))*sizeof(setelement));
+ if (size < SET_MAX_SIZE(s))
+ s[(size-1)/ELEMENTSIZE] &= (FULL_ELEMENT >>
+ (ELEMENTSIZE-size%ELEMENTSIZE));
+ s[-1]=size;
+
+ return s;
+}
+
+/*
+ * set_size()
+ *
+ * Returns the number of elements in set s.
+ */
+UNUSED_FUNCTION INLINE
+static int set_size(set_t s) {
+ int count=0;
+ setelement *c;
+
+ for (c=s; c < s+SET_ARRAY_LENGTH(s); c++)
+ count+=SET_ELEMENT_BIT_COUNT(*c);
+ return count;
+}
+
+/*
+ * set_duplicate()
+ *
+ * Returns a newly allocated duplicate of set s.
+ */
+UNUSED_FUNCTION INLINE
+static set_t set_duplicate(set_t s) {
+ set_t new;
+
+ new=set_new(SET_MAX_SIZE(s));
+ memcpy(new,s,SET_ARRAY_LENGTH(s)*sizeof(setelement));
+ return new;
+}
+
+/*
+ * set_copy()
+ *
+ * Copies set src to dest. If dest is NULL, is equal to set_duplicate.
+ * If dest smaller than src, it is freed and a new set of the same size as
+ * src is returned.
+ */
+UNUSED_FUNCTION INLINE
+static set_t set_copy(set_t dest,set_t src) {
+ if (dest==NULL)
+ return set_duplicate(src);
+ if (SET_MAX_SIZE(dest)<SET_MAX_SIZE(src)) {
+ set_free(dest);
+ return set_duplicate(src);
+ }
+ memcpy(dest,src,SET_ARRAY_LENGTH(src)*sizeof(setelement));
+ memset(dest+SET_ARRAY_LENGTH(src),0,((SET_ARRAY_LENGTH(dest) -
+ SET_ARRAY_LENGTH(src)) *
+ sizeof(setelement)));
+ return dest;
+}
+
+/*
+ * set_empty()
+ *
+ * Removes all elements from the set s.
+ */
+UNUSED_FUNCTION INLINE
+static void set_empty(set_t s) {
+ memset(s,0,SET_ARRAY_LENGTH(s)*sizeof(setelement));
+ return;
+}
+
+/*
+ * set_intersection()
+ *
+ * Store the intersection of sets a and b into res. If res is NULL,
+ * a new set is created and the result is written to it. If res is
+ * smaller than the larger one of a and b, it is freed and a new set
+ * is created and the result is returned.
+ *
+ * Returns either res or a new set that has been allocated in its stead.
+ *
+ * Note: res may not be a or b.
+ */
+UNUSED_FUNCTION INLINE
+static set_t set_intersection(set_t res,set_t a,set_t b) {
+ int i,max;
+
+ if (res==NULL) {
+ res = set_new(MAX(SET_MAX_SIZE(a),SET_MAX_SIZE(b)));
+ } else if (SET_MAX_SIZE(res) < MAX(SET_MAX_SIZE(a),SET_MAX_SIZE(b))) {
+ set_free(res);
+ res = set_new(MAX(SET_MAX_SIZE(a),SET_MAX_SIZE(b)));
+ } else {
+ set_empty(res);
+ }
+
+ max=MIN(SET_ARRAY_LENGTH(a),SET_ARRAY_LENGTH(b));
+ for (i=0; i<max; i++) {
+ res[i]=SET_ELEMENT_INTERSECT(a[i],b[i]);
+ }
+
+ return res;
+}
+
+/*
+ * set_union()
+ *
+ * Store the union of sets a and b into res. If res is NULL, a new set
+ * is created and the result is written to it. If res is smaller than
+ * the larger one of a and b, it is freed and a new set is created and
+ * the result is returned.
+ *
+ * Returns either res or a new set that has been allocated in its stead.
+ *
+ * Note: res may not be a or b.
+ */
+UNUSED_FUNCTION INLINE
+static set_t set_union(set_t res,set_t a,set_t b) {
+ int i,max;
+
+ if (res==NULL) {
+ res = set_new(MAX(SET_MAX_SIZE(a),SET_MAX_SIZE(b)));
+ } else if (SET_MAX_SIZE(res) < MAX(SET_MAX_SIZE(a),SET_MAX_SIZE(b))) {
+ set_free(res);
+ res = set_new(MAX(SET_MAX_SIZE(a),SET_MAX_SIZE(b)));
+ } else {
+ set_empty(res);
+ }
+
+ max=MAX(SET_ARRAY_LENGTH(a),SET_ARRAY_LENGTH(b));
+ for (i=0; i<max; i++) {
+ res[i]=SET_ELEMENT_UNION(a[i],b[i]);
+ }
+
+ return res;
+}
+
+
+/*
+ * set_return_next()
+ *
+ * Returns the smallest value in set s which is greater than n, or -1 if
+ * such a value does not exist.
+ *
+ * Can be used to iterate through all values of s:
+ *
+ * int i=-1;
+ * while ((i=set_return_next(s,i))>=0) {
+ * // i is in set s
+ * }
+ */
+UNUSED_FUNCTION INLINE
+static int set_return_next(set_t s, int n) {
+ if (n<0)
+ n=0;
+ else
+ n++;
+ if (n >= SET_MAX_SIZE(s))
+ return -1;
+
+ while (n%ELEMENTSIZE) {
+ if (SET_CONTAINS(s,n))
+ return n;
+ n++;
+ if (n >= SET_MAX_SIZE(s))
+ return -1;
+ }
+
+ while (s[n/ELEMENTSIZE]==0) {
+ n+=ELEMENTSIZE;
+ if (n >= SET_MAX_SIZE(s))
+ return -1;
+ }
+ while (!SET_CONTAINS(s,n)) {
+ n++;
+ if (n >= SET_MAX_SIZE(s))
+ return -1;
+ }
+ return n;
+}
+
+
+/*
+ * set_print()
+ *
+ * Prints the size and contents of set s to stdout.
+ * Mainly useful for debugging purposes and trivial output.
+ */
+/*
+UNUSED_FUNCTION
+static void set_print(set_t s) {
+ int i;
+ printf("size=%d(max %d)",set_size(s),(int)SET_MAX_SIZE(s));
+ for (i=0; i<SET_MAX_SIZE(s); i++)
+ if (SET_CONTAINS(s,i))
+ printf(" %d",i);
+ printf("\n");
+ return;
+}
+*/
+
+#endif /* !CLIQUER_SET_H */
diff --git a/src/cliques.c b/src/cliques.c
index 0fde867..8f6215f 100644
--- a/src/cliques.c
+++ b/src/cliques.c
@@ -31,6 +31,7 @@
#include "igraph_progress.h"
#include "igraph_stack.h"
#include "igraph_types_internal.h"
+#include "igraph_cliquer.h"
#include "config.h"
#include <assert.h>
@@ -326,7 +327,185 @@ int igraph_i_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
*/
int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
igraph_integer_t min_size, igraph_integer_t max_size) {
- return igraph_i_cliques(graph, res, min_size, max_size, 0);
+ return igraph_i_cliquer_cliques(graph, res, min_size, max_size);
+}
+
+
+/**
+ * \function igraph_clique_size_hist
+ * \brief Count cliques of each size in the graph
+ *
+ * </para><para>
+ * Cliques are fully connected subgraphs of a graph.
+ *
+ * </para><para>The current implementation of this function
+ * uses version 1.21 of the Cliquer library by Sampo Niskanen and
+ * Patric R. J. Östergård, http://users.aalto.fi/~pat/cliquer.html
+ *
+ * \param graph The input graph.
+ * \param hist Pointer to an initialized vector. The result will be stored
+ * here. The first element will store the number of size-1 cliques, the second
+ * element the number of size-2 cliques, etc. For cliques smaller than \c min_size,
+ * zero counts will be returned.
+ * \param min_size Integer giving the minimum size of the cliques to be
+ * returned. If negative or zero, no lower bound will be used.
+ * \param max_size Integer giving the maximum size of the cliques to be
+ * returned. If negative or zero, no upper bound will be used.
+ * \return Error code.
+ *
+ * \sa \ref igraph_cliques() and \ref igraph_cliques_callback()
+ *
+ * Time complexity: Exponential
+ *
+ */
+int igraph_clique_size_hist(const igraph_t *graph, igraph_vector_t *hist,
+ igraph_integer_t min_size, igraph_integer_t max_size) {
+ return igraph_i_cliquer_histogram(graph, hist, min_size, max_size);
+}
+
+
+/**
+ * \function igraph_cliques_callback
+ * \brief Calls a function for each clique in the graph.
+ *
+ * </para><para>
+ * Cliques are fully connected subgraphs of a graph. This function
+ * enumerates all cliques within the given size range and calls
+ * \p cliquehandler_fn for each of them. The cliques are passed to the
+ * callback function as an <type>igraph_vector_t *</type>. Destroying and
+ * freeing this vector is left up to the user. Use \ref igraph_vector_destroy()
+ * to destroy it first, then free it using \ref igraph_free().
+ *
+ * </para><para>The current implementation of this function
+ * uses version 1.21 of the Cliquer library by Sampo Niskanen and
+ * Patric R. J. Östergård, http://users.aalto.fi/~pat/cliquer.html
+ *
+ * \param graph The input graph.
+ * \param min_size Integer giving the minimum size of the cliques to be
+ * returned. If negative or zero, no lower bound will be used.
+ * \param max_size Integer giving the maximum size of the cliques to be
+ * returned. If negative or zero, no upper bound will be used.
+ * \param cliquehandler_fn Callback function to be called for each clique.
+ * See also igraph_clique_handler_t.
+ * \param arg Extra argument to supply to \p cliquehandler_fn.
+ * \return Error code.
+ *
+ * \sa \ref igraph_cliques()
+ *
+ * Time complexity: Exponential
+ *
+ */
+int igraph_cliques_callback(const igraph_t *graph,
+ igraph_integer_t min_size, igraph_integer_t max_size,
+ igraph_clique_handler_t *cliquehandler_fn, void *arg)
+{
+ return igraph_i_cliquer_callback(graph, min_size, max_size, cliquehandler_fn, arg);
+}
+
+
+/**
+ * \function igraph_weighted_cliques
+ * \brief Find all cliques in a given weight range in a vertex weighted graph
+ *
+ * </para><para>
+ * Cliques are fully connected subgraphs of a graph.
+ * The weight of a clique is the sum of the weights
+ * of individual vertices within the clique.
+ *
+ * </para><para>The current implementation of this function
+ * uses version 1.21 of the Cliquer library by Sampo Niskanen and
+ * Patric R. J. Östergård, http://users.aalto.fi/~pat/cliquer.html
+ *
+ * Only positive integer vertex weights are supported.
+ *
+ * \param graph The input graph.
+ * \param vertex_weights A vector of vertex weights. The current implementation
+ * will truncate all weights to their integer parts.
+ * \param res Pointer to a pointer vector, the result will be stored
+ * here, ie. \c res will contain pointers to \c igraph_vector_t
+ * objects which contain the indices of vertices involved in a clique.
+ * The pointer vector will be resized if needed but note that the
+ * objects in the pointer vector will not be freed.
+ * \param min_weight Integer giving the minimum weight of the cliques to be
+ * returned. If negative or zero, no lower bound will be used.
+ * \param max_weight Integer giving the maximum weight of the cliques to be
+ * returned. If negative or zero, no upper bound will be used.
+ * \param maximal If true, only maximal cliques will be returned
+ * \return Error code.
+ *
+ * \sa \ref igraph_cliques(), \ref igraph_maximal_cliques()
+ *
+ * Time complexity: Exponential
+ *
+ */
+int igraph_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res,
+ igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal)
+{
+ return igraph_i_weighted_cliques(graph, vertex_weights, res, min_weight, max_weight, maximal);
+}
+
+
+/**
+ * \function igraph_largest_weighted_cliques
+ * \brief Finds the largest weight clique(s) in a graph.
+ *
+ * </para><para>
+ * Finds the clique(s) having the largest weight in the graph.
+ *
+ * </para><para>The current implementation of this function
+ * uses version 1.21 of the Cliquer library by Sampo Niskanen and
+ * Patric R. J. Östergård, http://users.aalto.fi/~pat/cliquer.html
+ *
+ * Only positive integer vertex weights are supported.
+ *
+ * \param graph The input graph.
+ * \param vertex_weights A vector of vertex weights. The current implementation
+ * will truncate all weights to their integer parts.
+ * \param res Pointer to a pointer vector, the result will be stored
+ * here, ie. \c res will contain pointers to \c igraph_vector_t
+ * objects which contain the indices of vertices involved in a clique.
+ * The pointer vector will be resized if needed but note that the
+ * objects in the pointer vector will not be freed.
+ * \return Error code.
+ *
+ * \sa \ref igraph_weighted_cliques(), \ref igraph_weighted_clique_number(), \ref igraph_largest_cliques()
+ *
+ * Time complexity: TODO
+ */
+int igraph_largest_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res)
+{
+ return igraph_i_largest_weighted_cliques(graph, vertex_weights, res);
+}
+
+
+/**
+ * \function igraph_weighted_clique_number
+ * \brief Find the weight of the largest weight clique in the graph
+ *
+ * </para><para>The current implementation of this function
+ * uses version 1.21 of the Cliquer library by Sampo Niskanen and
+ * Patric R. J. Östergård, http://users.aalto.fi/~pat/cliquer.html
+ *
+ * Only positive integer vertex weights are supported.
+ *
+ * \param graph The input graph.
+ * \param vertex_weights A vector of vertex weights. The current implementation
+ * will truncate all weights to their integer parts.
+ * \param res The largest weight will be returned to the \c igraph_real_t
+ * pointed to by this variable.
+ * \return Error code.
+ *
+ * \sa \ref igraph_weighted_cliques(), \ref igraph_largest_weighted_cliques(), \ref igraph_clique_number()
+ *
+ * Time complexity: TODO
+ *
+ */
+int igraph_weighted_clique_number(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_real_t *res)
+{
+ return igraph_i_weighted_clique_number(graph, vertex_weights, res);
}
typedef int(*igraph_i_maximal_clique_func_t)(const igraph_vector_t*, void*, igraph_bool_t*);
diff --git a/src/clustertool.cpp b/src/clustertool.cpp
index c59678e..0df175f 100644
--- a/src/clustertool.cpp
+++ b/src/clustertool.cpp
@@ -272,7 +272,7 @@ int igraph_i_community_spinglass_orig(const igraph_t *graph,
IGRAPH_ERROR("Invalid cooling factor", IGRAPH_EINVAL);
}
if (gamma < 0.0) {
- IGRAPH_ERROR("Invalid gamme value", IGRAPH_EINVAL);
+ IGRAPH_ERROR("Invalid gamma value", IGRAPH_EINVAL);
}
if (starttemp/stoptemp<1.0) {
IGRAPH_ERROR("starttemp should be larger in absolute value than stoptemp",
@@ -582,8 +582,13 @@ int igraph_i_community_spinglass_negative(const igraph_t *graph,
if (!conn) {
IGRAPH_ERROR("Cannot work with unconnected graph", IGRAPH_EINVAL);
}
-
- igraph_vector_minmax(weights, &d_n, &d_p);
+
+ if (weights) {
+ igraph_vector_minmax(weights, &d_n, &d_p);
+ } else {
+ d_n = d_p = 1;
+ }
+
if (d_n > 0) { d_n=0; }
if (d_p < 0) { d_p=0; }
d_n = -d_n;
diff --git a/src/cohesive_blocks.c b/src/cohesive_blocks.c
index 0c0adf8..698eaaf 100644
--- a/src/cohesive_blocks.c
+++ b/src/cohesive_blocks.c
@@ -228,6 +228,7 @@ int igraph_cohesive_blocks(const igraph_t *graph,
igraph_vector_bool_t Qcheck;
long int Qptr=0;
igraph_integer_t conn;
+ igraph_bool_t is_simple;
igraph_t *graph_copy;
@@ -245,6 +246,12 @@ int igraph_cohesive_blocks(const igraph_t *graph,
IGRAPH_EINVAL);
}
+ IGRAPH_CHECK(igraph_is_simple(graph, &is_simple));
+ if (!is_simple) {
+ IGRAPH_ERROR("Cohesive blocking only works on simple graphs",
+ IGRAPH_EINVAL);
+ }
+
IGRAPH_STATUS("Starting cohesive block calculation.\n", 0);
if (blocks) { igraph_vector_ptr_clear(blocks); }
diff --git a/src/community.c b/src/community.c
index 95e6696..655fc04 100644
--- a/src/community.c
+++ b/src/community.c
@@ -45,6 +45,10 @@
#include <string.h>
#include <math.h>
+#ifdef USING_R
+#include <R.h>
+#endif
+
int igraph_i_rewrite_membership_vector(igraph_vector_t *membership) {
long int no=(long int) igraph_vector_max(membership)+1;
igraph_vector_t idx;
@@ -858,7 +862,8 @@ int igraph_community_to_membership(const igraph_matrix_t *merges,
* See also Clauset, A.; Newman, M. E. J.; Moore, C. Finding
* community structure in very large networks, Physical Review E,
* 2004, 70, 066111.
- * \param graph The input graph.
+ * \param graph The input graph. It must be undirected; directed graphs are
+ * not supported yet.
* \param membership Numeric vector which gives the type of each
* vertex, ie. the component to which it belongs.
* It does not have to be consecutive, i.e. empty communities are
@@ -885,10 +890,21 @@ int igraph_modularity(const igraph_t *graph,
igraph_real_t m;
long int c1, c2;
+ if (igraph_is_directed(graph)) {
+#ifndef USING_R
+ IGRAPH_ERROR("modularity is implemented for undirected graphs", IGRAPH_EINVAL);
+#else
+ REprintf("Modularity is implemented for undirected graphs only.\n");
+#endif
+ }
+
if (igraph_vector_size(membership) < igraph_vcount(graph)) {
IGRAPH_ERROR("cannot calculate modularity, membership vector too short",
IGRAPH_EINVAL);
}
+ if (igraph_vector_min(membership) < 0) {
+ IGRAPH_ERROR("Invalid membership vector", IGRAPH_EINVAL);
+ }
IGRAPH_VECTOR_INIT_FINALLY(&e, types);
IGRAPH_VECTOR_INIT_FINALLY(&a, types);
@@ -2194,7 +2210,7 @@ int igraph_community_label_propagation(const igraph_t *graph,
}
} else {
for (i=0; i<no_of_nodes; i++) {
- VECTOR(*membership)[i] = i;
+ VECTOR(*membership)[i] = i+1;
}
}
diff --git a/src/decomposition.c b/src/decomposition.c
index f5814aa..56248f1 100644
--- a/src/decomposition.c
+++ b/src/decomposition.c
@@ -68,6 +68,12 @@ int igraph_maximum_cardinality_search(const igraph_t *graph,
/***************/
long int j, v;
+
+ if (no_of_nodes == 0) {
+ igraph_vector_clear(alpha);
+ if (alpham1) igraph_vector_clear(alpham1);
+ return IGRAPH_SUCCESS;
+ }
IGRAPH_CHECK(igraph_vector_long_init(&size, no_of_nodes));
IGRAPH_FINALLY(igraph_vector_long_destroy, &size);
diff --git a/src/dotproduct.c b/src/dotproduct.c
index 4ec7b52..266da6d 100644
--- a/src/dotproduct.c
+++ b/src/dotproduct.c
@@ -74,9 +74,9 @@ int igraph_dot_product_game(igraph_t *graph, const igraph_matrix_t *vecs,
igraph_vector_t v1;
igraph_vector_view(&v1, &MATRIX(*vecs, 0, i), nrow);
for (j = from; j < ncol; j++) {
- if (i==j) { continue; }
igraph_real_t prob;
igraph_vector_t v2;
+ if (i==j) { continue; }
igraph_vector_view(&v2, &MATRIX(*vecs, 0, j), nrow);
igraph_lapack_ddot(&v1, &v2, &prob);
if (prob < 0 && ! warned_neg) {
diff --git a/src/drl_layout.cpp b/src/drl_layout.cpp
index 20f53ba..1b179b1 100644
--- a/src/drl_layout.cpp
+++ b/src/drl_layout.cpp
@@ -416,6 +416,7 @@ int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options,
options->simmer_attraction = .5;
options->simmer_damping_mult = 0;
+ break;
default:
IGRAPH_ERROR("Unknown DrL template", IGRAPH_EINVAL);
break;
diff --git a/src/fast_community.c b/src/fast_community.c
index 8acb4e1..2cb3773 100644
--- a/src/fast_community.c
+++ b/src/fast_community.c
@@ -112,22 +112,32 @@ typedef struct {
int igraph_i_fastgreedy_community_rescan_max(
igraph_i_fastgreedy_community* comm) {
long int i, n;
- igraph_i_fastgreedy_commpair *p, *oldmax;
+ igraph_i_fastgreedy_commpair *p, *best;
+ igraph_real_t bestdq, currdq;
n = igraph_vector_ptr_size(&comm->neis);
- if (n==0) {
+ if (n == 0) {
comm->maxdq = 0;
return 1;
}
-
- oldmax = comm->maxdq;
- comm->maxdq = (igraph_i_fastgreedy_commpair*)VECTOR(comm->neis)[0];
- for (i=1; i<n; i++) {
+
+ best = (igraph_i_fastgreedy_commpair*)VECTOR(comm->neis)[0];
+ bestdq = *best->dq;
+ for (i = 1; i < n; i++) {
p = (igraph_i_fastgreedy_commpair*)VECTOR(comm->neis)[i];
- if (*p->dq > *comm->maxdq->dq) comm->maxdq=p;
+ currdq = *p->dq;
+ if (currdq > bestdq) {
+ best = p;
+ bestdq = currdq;
+ }
+ }
+
+ if (best != comm->maxdq) {
+ comm->maxdq = best;
+ return 1;
+ } else {
+ return 0;
}
- if (oldmax == comm->maxdq) return 0;
- return 1;
}
/* Destroys the global community list object */
@@ -148,24 +158,26 @@ void igraph_i_fastgreedy_community_list_sift_down(
long int root, child, c1, c2;
igraph_i_fastgreedy_community* dummy;
igraph_integer_t dummy2;
+ igraph_i_fastgreedy_community** heap = list->heap;
+ igraph_integer_t* heapindex = list->heapindex;
root = idx;
while (root*2+1 < list->no_of_communities) {
child = root*2+1;
if (child+1 < list->no_of_communities &&
- *list->heap[child]->maxdq->dq < *list->heap[child+1]->maxdq->dq)
+ *heap[child]->maxdq->dq < *heap[child+1]->maxdq->dq)
child++;
- if (*list->heap[root]->maxdq->dq < *list->heap[child]->maxdq->dq) {
- c1 = list->heap[root]->maxdq->first;
- c2 = list->heap[child]->maxdq->first;
+ if (*heap[root]->maxdq->dq < *heap[child]->maxdq->dq) {
+ c1 = heap[root]->maxdq->first;
+ c2 = heap[child]->maxdq->first;
- dummy = list->heap[root];
- list->heap[root] = list->heap[child];
- list->heap[child] = dummy;
+ dummy = heap[root];
+ heap[root] = heap[child];
+ heap[child] = dummy;
- dummy2 = list->heapindex[c1];
- list->heapindex[c1] = list->heapindex[c2];
- list->heapindex[c2] = dummy2;
+ dummy2 = heapindex[c1];
+ heapindex[c1] = heapindex[c2];
+ heapindex[c2] = dummy2;
root = child;
} else break;
@@ -178,21 +190,23 @@ void igraph_i_fastgreedy_community_list_sift_up(
long int root, parent, c1, c2;
igraph_i_fastgreedy_community* dummy;
igraph_integer_t dummy2;
+ igraph_i_fastgreedy_community** heap = list->heap;
+ igraph_integer_t* heapindex = list->heapindex;
root = idx;
while (root>0) {
parent = (root-1)/2;
- if (*list->heap[parent]->maxdq->dq < *list->heap[root]->maxdq->dq) {
- c1 = list->heap[root]->maxdq->first;
- c2 = list->heap[parent]->maxdq->first;
+ if (*heap[parent]->maxdq->dq < *heap[root]->maxdq->dq) {
+ c1 = heap[root]->maxdq->first;
+ c2 = heap[parent]->maxdq->first;
- dummy = list->heap[parent];
- list->heap[parent] = list->heap[root];
- list->heap[root] = dummy;
+ dummy = heap[parent];
+ heap[parent] = heap[root];
+ heap[root] = dummy;
- dummy2 = list->heapindex[c1];
- list->heapindex[c1] = list->heapindex[c2];
- list->heapindex[c2] = dummy2;
+ dummy2 = heapindex[c1];
+ heapindex[c1] = heapindex[c2];
+ heapindex[c2] = dummy2;
root = parent;
} else break;
@@ -338,6 +352,86 @@ void igraph_i_fastgreedy_community_remove_nei(
}
}
+/* Auxiliary function to sort a community pair list with respect to the
+ * `second` field */
+int igraph_i_fastgreedy_commpair_cmp(const void* p1, const void* p2) {
+ igraph_i_fastgreedy_commpair *cp1, *cp2;
+ cp1=*(igraph_i_fastgreedy_commpair**)p1;
+ cp2=*(igraph_i_fastgreedy_commpair**)p2;
+ return (int) (cp1->second - cp2->second);
+}
+
+/* Sorts the neighbor list of the community with the given index, optionally
+ * optimizing the process if we know that the list is nearly sorted and only
+ * a given pair is in the wrong place. */
+void igraph_i_fastgreedy_community_sort_neighbors_of(
+ igraph_i_fastgreedy_community_list* list, long int index,
+ igraph_i_fastgreedy_commpair* changed_pair) {
+ igraph_vector_ptr_t* vec;
+ long int i, n;
+ igraph_bool_t can_skip_sort = 0;
+ igraph_i_fastgreedy_commpair *other_pair;
+
+ vec = &list->e[index].neis;
+ if (changed_pair != 0) {
+ /* Optimized sorting */
+
+ /* First we look for changed_pair in vec */
+ n = igraph_vector_ptr_size(vec);
+ for (i = 0; i < n; i++) {
+ if (VECTOR(*vec)[i] == changed_pair) {
+ break;
+ }
+ }
+
+ /* Did we find it? We should have -- otherwise it's a bug */
+ if (i >= n) {
+ IGRAPH_WARNING("changed_pair not found in neighbor vector while re-sorting "
+ "the neighbors of a community; this is probably a bug. Falling back to "
+ "full sort instead."
+ );
+ } else {
+ /* Okay, the pair that changed is at index i. We need to figure out where
+ * its new place should be. We can simply try moving the item all the way
+ * to the left as long as the comparison function tells so (since the
+ * rest of the vector is sorted), and then move all the way to the right
+ * as long as the comparison function tells so, and we will be okay. */
+
+ /* Shifting to the left */
+ while (i > 0) {
+ other_pair = VECTOR(*vec)[i-1];
+ if (other_pair->second > changed_pair->second) {
+ VECTOR(*vec)[i] = other_pair;
+ i--;
+ } else {
+ break;
+ }
+ }
+ VECTOR(*vec)[i] = changed_pair;
+
+ /* Shifting to the right */
+ while (i < n-1) {
+ other_pair = VECTOR(*vec)[i+1];
+ if (other_pair->second < changed_pair->second) {
+ VECTOR(*vec)[i] = other_pair;
+ i++;
+ } else {
+ break;
+ }
+ }
+ VECTOR(*vec)[i] = changed_pair;
+
+ /* Mark that we don't need a full sort */
+ can_skip_sort = 1;
+ }
+ }
+
+ if (!can_skip_sort) {
+ /* Fallback to full sorting */
+ igraph_vector_ptr_sort(vec, igraph_i_fastgreedy_commpair_cmp);
+ }
+}
+
/* Updates the dq value of community pair p in the community with index p->first
* of the community list clist to newdq and restores the heap property
* in community c if necessary. Returns 1 if the maximum in the row had
@@ -454,15 +548,6 @@ int igraph_i_fastgreedy_community_update_dq(
return 1;
}
-/* Auxiliary function to sort a community pair list with respect to the
- * `second` field */
-int igraph_i_fastgreedy_commpair_cmp(const void* p1, const void* p2) {
- igraph_i_fastgreedy_commpair *cp1, *cp2;
- cp1=*(igraph_i_fastgreedy_commpair**)p1;
- cp2=*(igraph_i_fastgreedy_commpair**)p2;
- return (int) (cp1->second - cp2->second);
-}
-
/**
* \function igraph_community_fastgreedy
* \brief Finding community structure by greedy optimization of modularity
@@ -519,14 +604,15 @@ int igraph_community_fastgreedy(const igraph_t *graph,
igraph_vector_t *modularity,
igraph_vector_t *membership) {
long int no_of_edges, no_of_nodes, no_of_joins, total_joins;
- long int i, j, k, n, m, from, to, dummy;
+ long int i, j, k, n, m, from, to, dummy, best_no_of_joins;
igraph_integer_t ffrom, fto;
igraph_eit_t edgeit;
igraph_i_fastgreedy_commpair *pairs, *p1, *p2;
igraph_i_fastgreedy_community_list communities;
igraph_vector_t a;
- igraph_real_t q, *dq, weight_sum, loop_weight_sum;
+ igraph_real_t q, *dq, bestq, weight_sum, loop_weight_sum;
igraph_bool_t has_multiple;
+ igraph_matrix_t merges_local;
/*long int join_order[] = { 16,5, 5,6, 6,0, 4,0, 10,0, 26,29, 29,33, 23,33, 27,33, 25,24, 24,31, 12,3, 21,1, 30,8, 8,32, 9,2, 17,1, 11,0, 7,3, 3,2, 13,2, 1,2, 28,31, 31,33, 22,32, 18,32, 20,32, 32,33, 15,33, 14,33, 0,19, 19,2, -1,-1 };*/
/*long int join_order[] = { 43,42, 42,41, 44,41, 41,36, 35,36, 37,36, 36,29, 38,29, 34,29, 39,29, 33,29, 40,29, 32,29, 14,29, 30,29, 31,29, 6,18, 18,4, 23,4, 21,4, 19,4, 27,4, 20,4, 22,4, 26,4, 25,4, 24,4, 17,4, 0,13, 13,2, 1,2, 11,2, 8,2, 5,2, 3,2, 10,2, 9,2, 7,2, 2,28, 28,15, 12,15, 29,16, 4,15, -1,-1 };*/
@@ -553,10 +639,19 @@ int igraph_community_fastgreedy(const igraph_t *graph,
IGRAPH_ERROR("fast-greedy community finding works only on graphs without multiple edges", IGRAPH_EINVAL);
}
+ if (membership != 0 && merges == 0) {
+ /* We need the merge matrix because the user wants the membership
+ * vector, so we allocate one on our own */
+ IGRAPH_CHECK(igraph_matrix_init(&merges_local, total_joins, 2));
+ IGRAPH_FINALLY(igraph_matrix_destroy, &merges_local);
+ merges = &merges_local;
+ }
+
if (merges != 0) {
IGRAPH_CHECK(igraph_matrix_resize(merges, total_joins, 2));
igraph_matrix_null(merges);
}
+
if (modularity != 0) {
IGRAPH_CHECK(igraph_vector_resize(modularity, total_joins+1));
}
@@ -658,7 +753,7 @@ int igraph_community_fastgreedy(const igraph_t *graph,
/* Sorting community neighbor lists by community IDs */
debug("Sorting community neighbor lists\n");
for (i=0, j=0; i<no_of_nodes; i++) {
- igraph_vector_ptr_sort(&communities.e[i].neis, igraph_i_fastgreedy_commpair_cmp);
+ igraph_i_fastgreedy_community_sort_neighbors_of(&communities, i, 0);
/* Isolated vertices and vertices with loop edges only won't be stored in
* the heap (to avoid maxdq == 0) */
if (communities.e[i].maxdq != 0) {
@@ -682,6 +777,10 @@ int igraph_community_fastgreedy(const igraph_t *graph,
q -= VECTOR(a)[i]*VECTOR(a)[i];
}
+ /* Initialize "best modularity" value and best merge counter */
+ bestq = q;
+ best_no_of_joins = 0;
+
/* Initializing community heap */
debug("Initializing community heap\n");
igraph_i_fastgreedy_community_list_build_heap(&communities);
@@ -698,6 +797,12 @@ int igraph_community_fastgreedy(const igraph_t *graph,
if (modularity)
VECTOR(*modularity)[no_of_joins] = q;
+ /* Update best modularity if needed */
+ if (q >= bestq) {
+ bestq = q;
+ best_no_of_joins = no_of_joins;
+ }
+
/* Some debug info if needed */
/* igraph_i_fastgreedy_community_list_check_heap(&communities); */
#ifdef DEBUG
@@ -785,11 +890,15 @@ int igraph_community_fastgreedy(const igraph_t *graph,
debug(" CHAIN(2): %ld %ld-%ld, newdq(%ld,%ld)=%.7f\n",
to, p2->second, from, to, p2->second, *p2->dq-2*VECTOR(a)[to]*VECTOR(a)[p2->second]);
p2->opposite->second=to;
- /* need to re-sort community nei list `p2->second` */
- /* TODO: quicksort is O(n*logn), although we could do a deletion and
- * insertion which can be done in O(logn) if deletion is O(1) */
- debug(" Re-sorting community %ld\n", p2->second);
- igraph_vector_ptr_sort(&communities.e[p2->second].neis, igraph_i_fastgreedy_commpair_cmp);
+ /* p2->opposite->second changed, so it means that
+ * communities.e[p2->second].neis (which contains p2->opposite) is
+ * not sorted any more. We have to find the index of p2->opposite in
+ * this vector and move it to the correct place. Moving should be an
+ * O(n) operation; re-sorting would be O(n*logn) or even worse,
+ * depending on the pivoting strategy used by qsort() since the
+ * vector is nearly sorted */
+ igraph_i_fastgreedy_community_sort_neighbors_of(
+ &communities, p2->second, p2->opposite);
/* link from.neis[j] to the current place in to.neis if
* from.neis[j] != to */
p2->first=to;
@@ -826,10 +935,7 @@ int igraph_community_fastgreedy(const igraph_t *graph,
to, p2->second, from, p1->first, p2->second, *p2->dq-2*VECTOR(a)[to]*VECTOR(a)[p2->second]);
p2->opposite->second=to;
/* need to re-sort community nei list `p2->second` */
- /* TODO: quicksort is O(n*logn), although we could do a deletion and
- * insertion which can be done in O(logn) if deletion is O(1) */
- debug(" Re-sorting community %ld\n", p2->second);
- igraph_vector_ptr_sort(&communities.e[p2->second].neis, igraph_i_fastgreedy_commpair_cmp);
+ igraph_i_fastgreedy_community_sort_neighbors_of(&communities, p2->second, p2->opposite);
/* link from.neis[j] to the current place in to.neis if
* from.neis[j] != to */
p2->first=to;
@@ -903,14 +1009,18 @@ int igraph_community_fastgreedy(const igraph_t *graph,
IGRAPH_FINALLY_CLEAN(4);
if (membership) {
- long int m=igraph_vector_which_max(modularity);
IGRAPH_CHECK(igraph_community_to_membership(merges,
(igraph_integer_t) no_of_nodes,
- /*steps=*/ (igraph_integer_t) m,
+ /*steps=*/ (igraph_integer_t) best_no_of_joins,
membership,
/*csize=*/ 0));
}
+ if (merges == &merges_local) {
+ igraph_matrix_destroy(&merges_local);
+ IGRAPH_FINALLY_CLEAN(1);
+ }
+
return 0;
}
diff --git a/src/feedback_arc_set.c b/src/feedback_arc_set.c
index 81b0c4a..ae4e7cb 100644
--- a/src/feedback_arc_set.c
+++ b/src/feedback_arc_set.c
@@ -540,9 +540,11 @@ int igraph_i_feedback_arc_set_ip(const igraph_t *graph, igraph_vector_t *result,
/* Set up variables */
k = n*(n-1)/2;
- glp_add_cols(ip, (int) k);
- for (j = 1; j <= k; j++)
- glp_set_col_kind(ip, (int) j, GLP_BV);
+ if (k > 0) {
+ glp_add_cols(ip, (int) k);
+ for (j = 1; j <= k; j++)
+ glp_set_col_kind(ip, (int) j, GLP_BV);
+ }
/* Set up coefficients in the goal function */
k = igraph_vector_size(edges_in_comp);
@@ -565,28 +567,30 @@ int igraph_i_feedback_arc_set_ip(const igraph_t *graph, igraph_vector_t *result,
}
/* Add constraints */
- glp_add_rows(ip, (int)(n*(n-1)/2 + n*(n-1)*(n-2)/3));
- m = 1;
- for (j = 0; j < n; j++) {
- int ind[4];
- double val[4] = {0, 1, 1, -1};
- for (k = j+1; k < n; k++) {
- ind[1] = (int) VAR2IDX(j, k);
- /* Type (2a) */
- val[2] = 1;
- for (l = k+1; l < n; l++, m++) {
- ind[2] = (int) VAR2IDX(k, l);
- ind[3] = (int) VAR2IDX(j, l);
- glp_set_row_bnds(ip, (int) m, GLP_UP, 1, 1);
- glp_set_mat_row(ip, (int) m, 3, ind, val);
- }
- /* Type (2b) */
- val[2] = -1;
- for (l = j+1; l < k; l++, m++) {
- ind[2] = (int) VAR2IDX(l, k);
- ind[3] = (int) VAR2IDX(j, l);
- glp_set_row_bnds(ip, (int) m, GLP_UP, 0, 0);
- glp_set_mat_row(ip, (int) m, 3, ind, val);
+ if (n > 1) {
+ glp_add_rows(ip, (int)(n*(n-1)/2 + n*(n-1)*(n-2)/3));
+ m = 1;
+ for (j = 0; j < n; j++) {
+ int ind[4];
+ double val[4] = {0, 1, 1, -1};
+ for (k = j+1; k < n; k++) {
+ ind[1] = (int) VAR2IDX(j, k);
+ /* Type (2a) */
+ val[2] = 1;
+ for (l = k+1; l < n; l++, m++) {
+ ind[2] = (int) VAR2IDX(k, l);
+ ind[3] = (int) VAR2IDX(j, l);
+ glp_set_row_bnds(ip, (int) m, GLP_UP, 1, 1);
+ glp_set_mat_row(ip, (int) m, 3, ind, val);
+ }
+ /* Type (2b) */
+ val[2] = -1;
+ for (l = j+1; l < k; l++, m++) {
+ ind[2] = (int) VAR2IDX(l, k);
+ ind[3] = (int) VAR2IDX(j, l);
+ glp_set_row_bnds(ip, (int) m, GLP_UP, 0, 0);
+ glp_set_mat_row(ip, (int) m, 3, ind, val);
+ }
}
}
}
diff --git a/src/flow.c b/src/flow.c
index e506ddd..9b97db0 100644
--- a/src/flow.c
+++ b/src/flow.c
@@ -1974,6 +1974,13 @@ int igraph_i_connectivity_checks(const igraph_t *graph,
igraph_bool_t *found) {
igraph_bool_t conn;
*found=0;
+
+ if (igraph_vcount(graph) == 0) {
+ *res=0;
+ *found=1;
+ return 0;
+ }
+
IGRAPH_CHECK(igraph_is_connected(graph, &conn, IGRAPH_STRONG));
if (!conn) {
*res=0;
diff --git a/src/foreign-dl-parser.c b/src/foreign-dl-parser.c
index 6078cb7..da6306e 100644
--- a/src/foreign-dl-parser.c
+++ b/src/foreign-dl-parser.c
@@ -445,7 +445,7 @@ union yyalloc
/* YYNRULES -- Number of rules. */
#define YYNRULES 66
/* YYNRULES -- Number of states. */
-#define YYNSTATES 137
+#define YYNSTATES 138
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -495,10 +495,10 @@ static const yytype_uint8 yyprhs[] =
0, 0, 3, 11, 12, 15, 16, 18, 20, 22,
24, 28, 30, 31, 33, 37, 45, 51, 52, 56,
57, 61, 62, 65, 67, 69, 73, 74, 78, 80,
- 82, 85, 89, 93, 96, 104, 110, 120, 130, 131,
- 134, 139, 143, 145, 146, 149, 154, 158, 160, 162,
- 166, 169, 177, 183, 193, 203, 204, 207, 211, 213,
- 214, 217, 218, 221, 225, 227, 228
+ 82, 85, 89, 93, 97, 105, 111, 121, 131, 132,
+ 135, 140, 144, 146, 147, 150, 155, 159, 161, 163,
+ 167, 170, 178, 184, 194, 204, 205, 208, 212, 214,
+ 215, 218, 219, 222, 226, 228, 229
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -513,21 +513,21 @@ static const yytype_int8 yyrhs[] =
-1, -1, 26, 27, -1, 13, -1, 29, -1, 30,
4, 32, -1, -1, 30, 22, 31, -1, 14, -1,
33, -1, 32, 33, -1, 14, 26, 4, -1, 11,
- 22, 35, -1, 7, 36, -1, 8, 22, 24, 22,
- 7, 22, 36, -1, 9, 22, 7, 22, 39, -1,
- 8, 22, 24, 22, 9, 22, 7, 22, 39, -1,
- 9, 22, 8, 22, 24, 22, 7, 22, 39, -1,
- -1, 36, 37, -1, 38, 38, 41, 4, -1, 38,
- 38, 4, -1, 3, -1, -1, 39, 40, -1, 42,
- 42, 41, 4, -1, 42, 42, 4, -1, 3, -1,
- 14, -1, 12, 22, 44, -1, 7, 45, -1, 8,
- 22, 24, 22, 7, 22, 45, -1, 9, 22, 7,
- 22, 49, -1, 8, 22, 24, 22, 9, 22, 7,
- 22, 49, -1, 9, 22, 8, 22, 24, 22, 7,
- 22, 49, -1, -1, 45, 46, -1, 47, 48, 4,
- -1, 3, -1, -1, 48, 38, -1, -1, 49, 50,
- -1, 51, 52, 4, -1, 42, -1, -1, 52, 42,
- -1
+ 22, 35, -1, 7, 22, 36, -1, 8, 22, 24,
+ 22, 7, 22, 36, -1, 9, 22, 7, 22, 39,
+ -1, 8, 22, 24, 22, 9, 22, 7, 22, 39,
+ -1, 9, 22, 8, 22, 24, 22, 7, 22, 39,
+ -1, -1, 36, 37, -1, 38, 38, 41, 4, -1,
+ 38, 38, 4, -1, 3, -1, -1, 39, 40, -1,
+ 42, 42, 41, 4, -1, 42, 42, 4, -1, 3,
+ -1, 14, -1, 12, 22, 44, -1, 7, 45, -1,
+ 8, 22, 24, 22, 7, 22, 45, -1, 9, 22,
+ 7, 22, 49, -1, 8, 22, 24, 22, 9, 22,
+ 7, 22, 49, -1, 9, 22, 8, 22, 24, 22,
+ 7, 22, 49, -1, -1, 45, 46, -1, 47, 48,
+ 4, -1, 3, -1, -1, 48, 38, -1, -1, 49,
+ 50, -1, 51, 52, 4, -1, 42, -1, -1, 52,
+ 42, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -591,7 +591,7 @@ static const yytype_uint8 yyr2[] =
0, 2, 7, 0, 2, 0, 1, 1, 1, 1,
3, 1, 0, 1, 3, 7, 5, 0, 3, 0,
3, 0, 2, 1, 1, 3, 0, 3, 1, 1,
- 2, 3, 3, 2, 7, 5, 9, 9, 0, 2,
+ 2, 3, 3, 3, 7, 5, 9, 9, 0, 2,
4, 3, 1, 0, 2, 4, 3, 1, 1, 3,
2, 7, 5, 9, 9, 0, 2, 3, 1, 0,
2, 0, 2, 3, 1, 0, 2
@@ -605,17 +605,17 @@ static const yytype_uint8 yydefact[] =
0, 0, 0, 0, 1, 42, 0, 0, 12, 12,
12, 12, 12, 12, 3, 7, 11, 8, 9, 13,
19, 17, 0, 0, 0, 0, 5, 14, 12, 12,
- 10, 38, 12, 12, 32, 55, 12, 12, 49, 6,
- 2, 4, 0, 0, 26, 33, 17, 0, 50, 17,
- 0, 20, 23, 22, 12, 18, 16, 24, 12, 39,
- 0, 12, 12, 12, 58, 56, 59, 12, 12, 12,
- 19, 0, 0, 0, 0, 43, 17, 0, 0, 61,
- 17, 15, 21, 25, 29, 28, 27, 47, 41, 0,
- 12, 12, 35, 12, 57, 60, 12, 12, 52, 12,
- 0, 30, 40, 38, 0, 48, 44, 0, 0, 55,
- 0, 64, 62, 65, 0, 31, 34, 12, 0, 12,
- 51, 12, 0, 12, 43, 46, 0, 43, 61, 63,
- 66, 61, 36, 45, 37, 53, 54
+ 10, 12, 12, 12, 32, 55, 12, 12, 49, 6,
+ 2, 4, 0, 0, 26, 38, 17, 0, 50, 17,
+ 0, 20, 23, 22, 12, 18, 16, 24, 12, 33,
+ 12, 12, 12, 58, 56, 59, 12, 12, 12, 19,
+ 0, 0, 39, 0, 0, 43, 17, 0, 0, 61,
+ 17, 15, 21, 25, 29, 28, 27, 0, 12, 12,
+ 35, 12, 57, 60, 12, 12, 52, 12, 0, 30,
+ 47, 41, 0, 38, 0, 48, 44, 0, 0, 55,
+ 0, 64, 62, 65, 0, 31, 40, 34, 12, 0,
+ 12, 51, 12, 0, 12, 43, 46, 0, 43, 61,
+ 63, 66, 61, 36, 45, 37, 53, 54
};
/* YYDEFGOTO[NTERM-NUM]. */
@@ -623,38 +623,38 @@ static const yytype_int8 yydefgoto[] =
{
-1, 2, 26, 40, 14, 15, 20, 16, 28, 27,
42, 53, 56, 57, 58, 86, 83, 84, 17, 34,
- 45, 59, 60, 92, 106, 89, 107, 18, 38, 48,
- 65, 66, 77, 98, 112, 113, 122
+ 59, 72, 73, 90, 106, 102, 107, 18, 38, 48,
+ 64, 65, 77, 96, 112, 113, 123
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -93
+#define YYPACT_NINF -114
static const yytype_int8 yypact[] =
{
- 41, 3, 38, 47, -93, -93, 57, 56, 76, 76,
- 76, 76, 76, 76, -93, -93, -93, -93, -93, -93,
- -93, -93, 89, 48, 66, 69, 7, 70, 76, 76,
- -93, -93, 76, 76, -93, -93, 76, 76, -93, -93,
- -93, -93, 8, 19, -93, 47, -93, 6, 86, -93,
- 63, -93, -93, -93, 76, -93, -93, -93, 91, -93,
- 47, 76, 76, 76, -93, -93, -93, 76, 76, 76,
- -93, 83, 84, 82, 22, -93, -93, 88, 25, -93,
- -93, 70, -93, 83, -93, -93, -93, -93, -93, 95,
- 76, 76, 87, 76, -93, -93, 76, 76, 87, 76,
- 12, -93, -93, -93, 93, -93, -93, 87, 28, -93,
- 96, -93, -93, -93, 33, -93, 47, 76, 90, 76,
- 86, 76, 4, 76, -93, -93, 98, -93, -93, -93,
- -93, -93, 87, -93, 87, 87, 87
+ 8, 38, 11, 43, -114, -114, 44, 57, 46, 46,
+ 46, 46, 46, 46, -114, -114, -114, -114, -114, -114,
+ -114, -114, 69, 53, 63, 66, 6, 65, 46, 46,
+ -114, 46, 46, 46, -114, -114, 46, 46, -114, -114,
+ -114, -114, 5, 19, -114, -114, -114, 76, 84, -114,
+ 82, -114, -114, -114, 46, -114, -114, -114, 93, 43,
+ 46, 46, 46, -114, -114, -114, 46, 46, 46, -114,
+ 85, 86, -114, 43, 23, -114, -114, 88, 33, -114,
+ -114, 65, -114, 85, -114, -114, -114, 90, 46, 46,
+ 87, 46, -114, -114, 46, 46, 87, 46, 25, -114,
+ -114, -114, 94, -114, 95, -114, -114, 87, 29, -114,
+ 96, -114, -114, -114, 49, -114, -114, 43, 46, 92,
+ 46, 84, 46, 2, 46, -114, -114, 100, -114, -114,
+ -114, -114, -114, 87, -114, 87, 87, 87
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
- -93, -93, -93, -93, -93, -93, -9, 81, -39, 35,
- 24, -93, -93, -93, -93, -93, -93, 26, -93, -93,
- 10, -93, 2, -76, -93, -11, -92, -93, -93, 9,
- -93, -93, -93, -59, -93, -93, -93
+ -114, -114, -114, -114, -114, -114, -9, 83, -41, 36,
+ 26, -114, -114, -114, -114, -114, -114, 24, -114, -114,
+ 7, -114, 4, -113, -114, -7, -82, -114, -114, 9,
+ -114, -114, -114, -98, -114, -114, -114
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -664,34 +664,34 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -22
static const yytype_int16 yytable[] =
{
- 21, 22, 23, 24, 25, 6, 111, 61, 129, 3,
- 67, 19, 51, 62, 63, 118, 115, 41, 105, 43,
- 44, 52, 39, 46, 47, 52, 54, 49, 50, 90,
- 130, 91, 96, 55, 97, 119, 55, 93, 4, 55,
- 123, 99, 55, 111, 111, 70, 1, 55, 132, 72,
- 5, 134, 74, 75, 76, 8, 9, 10, 78, 79,
- 80, 7, 73, 8, 9, 10, 11, 12, 13, 135,
- 68, 69, 136, 31, 32, 33, 35, 36, 37, 95,
- 19, 103, 104, -21, 108, 87, 88, 109, 110, 64,
- 114, 5, 94, 87, 125, 71, 29, 82, 85, 102,
- 117, 105, 133, 121, 30, 81, 100, 126, 124, 101,
- 127, 0, 128, 116, 131, 0, 0, 0, 120
+ 21, 22, 23, 24, 25, 60, 130, 6, 66, 51,
+ 19, 4, 133, 1, 111, 135, 105, 41, 52, 43,
+ 44, 39, 45, 46, 47, 119, 54, 49, 50, 115,
+ 88, 136, 89, 55, 137, 91, 120, 55, 52, 97,
+ 94, 131, 95, 55, 3, 69, 5, 55, 7, 71,
+ 19, 74, 75, 76, 111, 111, 124, 78, 79, 80,
+ 8, 9, 10, 55, 8, 9, 10, 11, 12, 13,
+ 31, 32, 33, 35, 36, 37, 29, 87, -21, 103,
+ 104, 93, 108, 61, 62, 109, 110, 63, 114, 67,
+ 68, 5, 92, 100, 101, 100, 126, 70, 116, 82,
+ 85, 105, 118, 122, 134, 81, 30, 99, 98, 125,
+ 117, 128, 127, 129, 0, 132, 0, 0, 121
};
static const yytype_int16 yycheck[] =
{
- 9, 10, 11, 12, 13, 3, 98, 46, 4, 6,
- 49, 4, 4, 7, 8, 107, 4, 26, 14, 28,
- 29, 13, 15, 32, 33, 13, 7, 36, 37, 7,
- 122, 9, 7, 14, 9, 7, 14, 76, 0, 14,
- 7, 80, 14, 135, 136, 54, 5, 14, 124, 58,
- 3, 127, 61, 62, 63, 7, 8, 9, 67, 68,
- 69, 4, 60, 7, 8, 9, 10, 11, 12, 128,
- 7, 8, 131, 7, 8, 9, 7, 8, 9, 77,
- 4, 90, 91, 13, 93, 3, 4, 96, 97, 3,
- 99, 3, 4, 3, 4, 4, 7, 14, 14, 4,
- 7, 14, 4, 7, 23, 70, 82, 118, 117, 83,
- 119, -1, 121, 103, 123, -1, -1, -1, 109
+ 9, 10, 11, 12, 13, 46, 4, 3, 49, 4,
+ 4, 0, 125, 5, 96, 128, 14, 26, 13, 28,
+ 29, 15, 31, 32, 33, 107, 7, 36, 37, 4,
+ 7, 129, 9, 14, 132, 76, 7, 14, 13, 80,
+ 7, 123, 9, 14, 6, 54, 3, 14, 4, 58,
+ 4, 60, 61, 62, 136, 137, 7, 66, 67, 68,
+ 7, 8, 9, 14, 7, 8, 9, 10, 11, 12,
+ 7, 8, 9, 7, 8, 9, 7, 73, 13, 88,
+ 89, 77, 91, 7, 8, 94, 95, 3, 97, 7,
+ 8, 3, 4, 3, 4, 3, 4, 4, 4, 14,
+ 14, 14, 7, 7, 4, 69, 23, 83, 82, 118,
+ 103, 120, 119, 122, -1, 124, -1, -1, 109
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -702,16 +702,16 @@ static const yytype_uint8 yystos[] =
9, 10, 11, 12, 20, 21, 23, 34, 43, 4,
22, 22, 22, 22, 22, 22, 18, 25, 24, 7,
23, 7, 8, 9, 35, 7, 8, 9, 44, 15,
- 19, 22, 26, 22, 22, 36, 22, 22, 45, 22,
- 22, 4, 13, 27, 7, 14, 28, 29, 30, 37,
- 38, 24, 7, 8, 3, 46, 47, 24, 7, 8,
- 22, 4, 22, 38, 22, 22, 22, 48, 22, 22,
- 22, 25, 14, 32, 33, 14, 31, 3, 4, 41,
- 7, 9, 39, 24, 4, 38, 7, 9, 49, 24,
- 26, 33, 4, 22, 22, 14, 40, 42, 22, 22,
- 22, 42, 50, 51, 22, 4, 36, 7, 42, 7,
- 45, 7, 52, 7, 22, 4, 41, 22, 22, 4,
- 42, 22, 39, 4, 39, 49, 49
+ 19, 22, 26, 22, 22, 22, 22, 22, 45, 22,
+ 22, 4, 13, 27, 7, 14, 28, 29, 30, 36,
+ 24, 7, 8, 3, 46, 47, 24, 7, 8, 22,
+ 4, 22, 37, 38, 22, 22, 22, 48, 22, 22,
+ 22, 25, 14, 32, 33, 14, 31, 38, 7, 9,
+ 39, 24, 4, 38, 7, 9, 49, 24, 26, 33,
+ 3, 4, 41, 22, 22, 14, 40, 42, 22, 22,
+ 22, 42, 50, 51, 22, 4, 4, 36, 7, 42,
+ 7, 45, 7, 52, 7, 22, 4, 41, 22, 22,
+ 4, 42, 22, 39, 4, 39, 49, 49
};
#define yyerrok (yyerrstatus = 0)
diff --git a/src/foreign-dl-parser.y b/src/foreign-dl-parser.y
index 8a04651..5c3bbd6 100644
--- a/src/foreign-dl-parser.y
+++ b/src/foreign-dl-parser.y
@@ -181,7 +181,7 @@ labeledmatrixline: LABEL zerooneseq NEWLINE { } ;
edgelist1: FORMATEDGELIST1 newline edgelist1rest {} ;
-edgelist1rest: DATA edgelist1data {}
+edgelist1rest: DATA newline edgelist1data {}
| LABELS newline labels newline DATA newline edgelist1data {}
| LABELSEMBEDDED newline DATA newline labelededgelist1data {}
| LABELS newline labels newline LABELSEMBEDDED newline DATA newline labelededgelist1data {}
diff --git a/src/foreign-graphml.c b/src/foreign-graphml.c
index 84c7855..b9d69ee 100644
--- a/src/foreign-graphml.c
+++ b/src/foreign-graphml.c
@@ -1043,6 +1043,7 @@ void igraph_i_graphml_sax_handler_start_element_ns(
}
state->st=INSIDE_EDGE;
} else if (xmlStrEqual(localname, toXmlChar("node"))) {
+ id1=-1;
for (i=0, it=(xmlChar**)attributes; i < nb_attributes; i++, it+=5) {
if (XML_ATTR_URI(it) != 0 &&
!xmlStrEqual(toXmlChar(GRAPHML_NAMESPACE_URI), XML_ATTR_URI(it))) {
@@ -1056,8 +1057,14 @@ void igraph_i_graphml_sax_handler_start_element_ns(
break;
}
}
+ if (id1 >= 0) {
+ state->act_node = id1;
+ } else {
+ state->act_node = -1;
+ igraph_i_graphml_sax_handler_error(state, "Node with missing id encountered");
+ return;
+ }
state->st=INSIDE_NODE;
- state->act_node = id1;
} else if (xmlStrEqual(localname, toXmlChar("data"))) {
igraph_i_graphml_attribute_data_setup(state, attributes, nb_attributes,
IGRAPH_ATTRIBUTE_GRAPH);
@@ -1398,13 +1405,13 @@ int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream,
ret=fprintf(outstream, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
- ret=fprintf(outstream, "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\"\n");
+ ret=fprintf(outstream, "<graphml xmlns=\"" GRAPHML_NAMESPACE_URI "\"\n");
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
ret=fprintf(outstream, " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
- ret=fprintf(outstream, " xsi:schemaLocation=\"http://graphml.graphdrawing.org/xmlns\n");
+ ret=fprintf(outstream, " xsi:schemaLocation=\"" GRAPHML_NAMESPACE_URI "\n");
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
- ret=fprintf(outstream, " http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd\">\n");
+ ret=fprintf(outstream, " " GRAPHML_NAMESPACE_URI "/1.0/graphml.xsd\">\n");
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
ret=fprintf(outstream, "<!-- Created by igraph -->\n");
if (ret<0) IGRAPH_ERROR("Write failed", IGRAPH_EFILE);
diff --git a/src/foreign-pajek-parser.c b/src/foreign-pajek-parser.c
index a90c01e..96da0b7 100644
--- a/src/foreign-pajek-parser.c
+++ b/src/foreign-pajek-parser.c
@@ -663,19 +663,19 @@ static const yytype_int8 yyrhs[] =
static const yytype_uint16 yyrline[] =
{
0, 196, 196, 200, 200, 202, 204, 208, 214, 214,
- 216, 217, 218, 218, 221, 223, 227, 228, 232, 238,
- 238, 242, 242, 245, 246, 249, 252, 257, 262, 267,
- 270, 273, 276, 279, 282, 285, 288, 291, 296, 296,
- 300, 300, 304, 304, 308, 308, 313, 313, 320, 322,
- 322, 322, 322, 322, 322, 324, 325, 327, 327, 329,
- 330, 330, 336, 338, 340, 341, 343, 343, 345, 346,
- 346, 352, 354, 356, 356, 360, 360, 363, 364, 369,
- 372, 375, 378, 381, 384, 387, 390, 393, 396, 399,
- 402, 405, 408, 411, 416, 416, 420, 420, 424, 424,
- 428, 428, 432, 432, 438, 440, 442, 442, 444, 444,
- 446, 446, 448, 450, 455, 457, 457, 459, 459, 461,
- 461, 463, 465, 472, 474, 479, 479, 481, 483, 483,
- 485, 505, 508, 511, 511, 513, 515, 517
+ 216, 217, 218, 218, 221, 223, 228, 229, 233, 239,
+ 239, 243, 243, 246, 247, 250, 253, 258, 263, 268,
+ 271, 274, 277, 280, 283, 286, 289, 292, 297, 297,
+ 301, 301, 305, 305, 309, 309, 314, 314, 321, 323,
+ 323, 323, 323, 323, 323, 325, 326, 328, 328, 330,
+ 331, 331, 337, 339, 341, 342, 344, 344, 346, 347,
+ 347, 353, 355, 357, 357, 361, 361, 364, 365, 370,
+ 373, 376, 379, 382, 385, 388, 391, 394, 397, 400,
+ 403, 406, 409, 412, 417, 417, 421, 421, 425, 425,
+ 429, 429, 433, 433, 439, 441, 443, 443, 445, 445,
+ 447, 447, 449, 451, 456, 458, 458, 460, 460, 462,
+ 462, 464, 466, 473, 475, 480, 480, 482, 484, 484,
+ 486, 506, 509, 512, 512, 514, 516, 518
};
#endif
@@ -1812,11 +1812,12 @@ yyreduce:
#line 223 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_string_vertex_attribute("id", (yyvsp[(1) - (1)].string).str, (yyvsp[(1) - (1)].string).len, context);
+ igraph_i_pajek_add_string_vertex_attribute("name", (yyvsp[(1) - (1)].string).str, (yyvsp[(1) - (1)].string).len, context);
;}
break;
case 17:
-#line 228 "src/foreign-pajek-parser.y"
+#line 229 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("x", (yyvsp[(1) - (2)].realnum), context);
igraph_i_pajek_add_numeric_vertex_attribute("y", (yyvsp[(2) - (2)].realnum), context);
@@ -1824,7 +1825,7 @@ yyreduce:
break;
case 18:
-#line 232 "src/foreign-pajek-parser.y"
+#line 233 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("x", (yyvsp[(1) - (3)].realnum), context);
igraph_i_pajek_add_numeric_vertex_attribute("y", (yyvsp[(2) - (3)].realnum), context);
@@ -1833,28 +1834,28 @@ yyreduce:
break;
case 20:
-#line 238 "src/foreign-pajek-parser.y"
+#line 239 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_string_vertex_attribute("shape", (yyvsp[(1) - (1)].string).str, (yyvsp[(1) - (1)].string).len, context);
;}
break;
case 24:
-#line 246 "src/foreign-pajek-parser.y"
+#line 247 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("xfact", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 25:
-#line 249 "src/foreign-pajek-parser.y"
+#line 250 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("yfact", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 26:
-#line 252 "src/foreign-pajek-parser.y"
+#line 253 "src/foreign-pajek-parser.y"
{ /* RGB color */
igraph_i_pajek_add_numeric_vertex_attribute("color-red", (yyvsp[(2) - (4)].realnum), context);
igraph_i_pajek_add_numeric_vertex_attribute("color-green", (yyvsp[(3) - (4)].realnum), context);
@@ -1863,7 +1864,7 @@ yyreduce:
break;
case 27:
-#line 257 "src/foreign-pajek-parser.y"
+#line 258 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("framecolor-red", (yyvsp[(2) - (4)].realnum), context);
igraph_i_pajek_add_numeric_vertex_attribute("framecolor-green", (yyvsp[(3) - (4)].realnum), context);
@@ -1872,7 +1873,7 @@ yyreduce:
break;
case 28:
-#line 262 "src/foreign-pajek-parser.y"
+#line 263 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("labelcolor-red", (yyvsp[(2) - (4)].realnum), context);
igraph_i_pajek_add_numeric_vertex_attribute("labelcolor-green", (yyvsp[(3) - (4)].realnum), context);
@@ -1881,75 +1882,75 @@ yyreduce:
break;
case 29:
-#line 267 "src/foreign-pajek-parser.y"
+#line 268 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("labeldist", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 30:
-#line 270 "src/foreign-pajek-parser.y"
+#line 271 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("labeldegree2", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 31:
-#line 273 "src/foreign-pajek-parser.y"
+#line 274 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("framewidth", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 32:
-#line 276 "src/foreign-pajek-parser.y"
+#line 277 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("fontsize", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 33:
-#line 279 "src/foreign-pajek-parser.y"
+#line 280 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("rotation", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 34:
-#line 282 "src/foreign-pajek-parser.y"
+#line 283 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("radius", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 35:
-#line 285 "src/foreign-pajek-parser.y"
+#line 286 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("diamondratio", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 36:
-#line 288 "src/foreign-pajek-parser.y"
+#line 289 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("labeldegree", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 37:
-#line 291 "src/foreign-pajek-parser.y"
+#line 292 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_vertex_attribute("vertexsize", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 38:
-#line 296 "src/foreign-pajek-parser.y"
+#line 297 "src/foreign-pajek-parser.y"
{ context->mode=3; ;}
break;
case 39:
-#line 296 "src/foreign-pajek-parser.y"
+#line 297 "src/foreign-pajek-parser.y"
{
context->mode=1;
igraph_i_pajek_add_string_vertex_attribute("font", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -1957,12 +1958,12 @@ yyreduce:
break;
case 40:
-#line 300 "src/foreign-pajek-parser.y"
+#line 301 "src/foreign-pajek-parser.y"
{ context->mode=3; ;}
break;
case 41:
-#line 300 "src/foreign-pajek-parser.y"
+#line 301 "src/foreign-pajek-parser.y"
{
context->mode=1;
igraph_i_pajek_add_string_vertex_attribute("url", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -1970,12 +1971,12 @@ yyreduce:
break;
case 42:
-#line 304 "src/foreign-pajek-parser.y"
+#line 305 "src/foreign-pajek-parser.y"
{ context->mode=3; ;}
break;
case 43:
-#line 304 "src/foreign-pajek-parser.y"
+#line 305 "src/foreign-pajek-parser.y"
{
context->mode=1;
igraph_i_pajek_add_string_vertex_attribute("color", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -1983,12 +1984,12 @@ yyreduce:
break;
case 44:
-#line 308 "src/foreign-pajek-parser.y"
+#line 309 "src/foreign-pajek-parser.y"
{ context->mode=3; ;}
break;
case 45:
-#line 308 "src/foreign-pajek-parser.y"
+#line 309 "src/foreign-pajek-parser.y"
{
context->mode=1;
igraph_i_pajek_add_string_vertex_attribute("framecolor",
@@ -1997,12 +1998,12 @@ yyreduce:
break;
case 46:
-#line 313 "src/foreign-pajek-parser.y"
+#line 314 "src/foreign-pajek-parser.y"
{ context->mode=3; ;}
break;
case 47:
-#line 313 "src/foreign-pajek-parser.y"
+#line 314 "src/foreign-pajek-parser.y"
{
context->mode=1;
igraph_i_pajek_add_string_vertex_attribute("labelcolor",
@@ -2011,65 +2012,65 @@ yyreduce:
break;
case 48:
-#line 320 "src/foreign-pajek-parser.y"
+#line 321 "src/foreign-pajek-parser.y"
{ (yyval.string)=(yyvsp[(1) - (1)].string); ;}
break;
case 55:
-#line 324 "src/foreign-pajek-parser.y"
+#line 325 "src/foreign-pajek-parser.y"
{ context->directed=1; ;}
break;
case 56:
-#line 325 "src/foreign-pajek-parser.y"
+#line 326 "src/foreign-pajek-parser.y"
{ context->directed=1; ;}
break;
case 60:
-#line 330 "src/foreign-pajek-parser.y"
+#line 331 "src/foreign-pajek-parser.y"
{ context->actedge++;
context->mode=2; ;}
break;
case 61:
-#line 331 "src/foreign-pajek-parser.y"
+#line 332 "src/foreign-pajek-parser.y"
{
igraph_vector_push_back(context->vector, (yyvsp[(1) - (6)].intnum)-1);
igraph_vector_push_back(context->vector, (yyvsp[(2) - (6)].intnum)-1); ;}
break;
case 64:
-#line 340 "src/foreign-pajek-parser.y"
+#line 341 "src/foreign-pajek-parser.y"
{ context->directed=0; ;}
break;
case 65:
-#line 341 "src/foreign-pajek-parser.y"
+#line 342 "src/foreign-pajek-parser.y"
{ context->directed=0; ;}
break;
case 69:
-#line 346 "src/foreign-pajek-parser.y"
+#line 347 "src/foreign-pajek-parser.y"
{ context->actedge++;
context->mode=2; ;}
break;
case 70:
-#line 347 "src/foreign-pajek-parser.y"
+#line 348 "src/foreign-pajek-parser.y"
{
igraph_vector_push_back(context->vector, (yyvsp[(1) - (6)].intnum)-1);
igraph_vector_push_back(context->vector, (yyvsp[(2) - (6)].intnum)-1); ;}
break;
case 74:
-#line 356 "src/foreign-pajek-parser.y"
+#line 357 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("weight", (yyvsp[(1) - (1)].realnum), context);
;}
break;
case 78:
-#line 364 "src/foreign-pajek-parser.y"
+#line 365 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("color-red", (yyvsp[(2) - (4)].realnum), context);
igraph_i_pajek_add_numeric_edge_attribute("color-green", (yyvsp[(3) - (4)].realnum), context);
@@ -2078,117 +2079,117 @@ yyreduce:
break;
case 79:
-#line 369 "src/foreign-pajek-parser.y"
+#line 370 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("arrowsize", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 80:
-#line 372 "src/foreign-pajek-parser.y"
+#line 373 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("edgewidth", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 81:
-#line 375 "src/foreign-pajek-parser.y"
+#line 376 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("hook1", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 82:
-#line 378 "src/foreign-pajek-parser.y"
+#line 379 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("hook2", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 83:
-#line 381 "src/foreign-pajek-parser.y"
+#line 382 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("angle1", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 84:
-#line 384 "src/foreign-pajek-parser.y"
+#line 385 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("angle2", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 85:
-#line 387 "src/foreign-pajek-parser.y"
+#line 388 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("velocity1", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 86:
-#line 390 "src/foreign-pajek-parser.y"
+#line 391 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("velocity2", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 87:
-#line 393 "src/foreign-pajek-parser.y"
+#line 394 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("arrowpos", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 88:
-#line 396 "src/foreign-pajek-parser.y"
+#line 397 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("labelpos", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 89:
-#line 399 "src/foreign-pajek-parser.y"
+#line 400 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("labelangle", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 90:
-#line 402 "src/foreign-pajek-parser.y"
+#line 403 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("labelangle2", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 91:
-#line 405 "src/foreign-pajek-parser.y"
+#line 406 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("labeldegree", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 92:
-#line 408 "src/foreign-pajek-parser.y"
+#line 409 "src/foreign-pajek-parser.y"
{ /* what is this??? */
igraph_i_pajek_add_numeric_edge_attribute("arrowsize", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 93:
-#line 411 "src/foreign-pajek-parser.y"
+#line 412 "src/foreign-pajek-parser.y"
{
igraph_i_pajek_add_numeric_edge_attribute("fontsize", (yyvsp[(2) - (2)].realnum), context);
;}
break;
case 94:
-#line 416 "src/foreign-pajek-parser.y"
+#line 417 "src/foreign-pajek-parser.y"
{ context->mode=4; ;}
break;
case 95:
-#line 416 "src/foreign-pajek-parser.y"
+#line 417 "src/foreign-pajek-parser.y"
{
context->mode=2;
igraph_i_pajek_add_string_edge_attribute("arrowtype", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -2196,12 +2197,12 @@ yyreduce:
break;
case 96:
-#line 420 "src/foreign-pajek-parser.y"
+#line 421 "src/foreign-pajek-parser.y"
{ context->mode=4; ;}
break;
case 97:
-#line 420 "src/foreign-pajek-parser.y"
+#line 421 "src/foreign-pajek-parser.y"
{
context->mode=2;
igraph_i_pajek_add_string_edge_attribute("linepattern", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -2209,12 +2210,12 @@ yyreduce:
break;
case 98:
-#line 424 "src/foreign-pajek-parser.y"
+#line 425 "src/foreign-pajek-parser.y"
{ context->mode=4; ;}
break;
case 99:
-#line 424 "src/foreign-pajek-parser.y"
+#line 425 "src/foreign-pajek-parser.y"
{
context->mode=2;
igraph_i_pajek_add_string_edge_attribute("label", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -2222,12 +2223,12 @@ yyreduce:
break;
case 100:
-#line 428 "src/foreign-pajek-parser.y"
+#line 429 "src/foreign-pajek-parser.y"
{ context->mode=4; ;}
break;
case 101:
-#line 428 "src/foreign-pajek-parser.y"
+#line 429 "src/foreign-pajek-parser.y"
{
context->mode=2;
igraph_i_pajek_add_string_edge_attribute("labelcolor", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -2235,12 +2236,12 @@ yyreduce:
break;
case 102:
-#line 432 "src/foreign-pajek-parser.y"
+#line 433 "src/foreign-pajek-parser.y"
{ context->mode=4; ;}
break;
case 103:
-#line 432 "src/foreign-pajek-parser.y"
+#line 433 "src/foreign-pajek-parser.y"
{
context->mode=2;
igraph_i_pajek_add_string_edge_attribute("color", (yyvsp[(3) - (3)].string).str, (yyvsp[(3) - (3)].string).len, context);
@@ -2248,22 +2249,22 @@ yyreduce:
break;
case 104:
-#line 438 "src/foreign-pajek-parser.y"
+#line 439 "src/foreign-pajek-parser.y"
{ context->mode=2; (yyval.string)=(yyvsp[(1) - (1)].string); ;}
break;
case 105:
-#line 440 "src/foreign-pajek-parser.y"
+#line 441 "src/foreign-pajek-parser.y"
{ context->directed=1; ;}
break;
case 112:
-#line 448 "src/foreign-pajek-parser.y"
+#line 449 "src/foreign-pajek-parser.y"
{ context->mode=0; context->actfrom=fabs((yyvsp[(1) - (1)].intnum))-1; ;}
break;
case 113:
-#line 450 "src/foreign-pajek-parser.y"
+#line 451 "src/foreign-pajek-parser.y"
{
igraph_vector_push_back(context->vector, context->actfrom);
igraph_vector_push_back(context->vector, fabs((yyvsp[(1) - (1)].intnum))-1);
@@ -2271,17 +2272,17 @@ yyreduce:
break;
case 114:
-#line 455 "src/foreign-pajek-parser.y"
+#line 456 "src/foreign-pajek-parser.y"
{ context->directed=0; ;}
break;
case 121:
-#line 463 "src/foreign-pajek-parser.y"
+#line 464 "src/foreign-pajek-parser.y"
{ context->mode=0; context->actfrom=fabs((yyvsp[(1) - (1)].intnum))-1; ;}
break;
case 122:
-#line 465 "src/foreign-pajek-parser.y"
+#line 466 "src/foreign-pajek-parser.y"
{
igraph_vector_push_back(context->vector, context->actfrom);
igraph_vector_push_back(context->vector, fabs((yyvsp[(1) - (1)].intnum))-1);
@@ -2289,7 +2290,7 @@ yyreduce:
break;
case 124:
-#line 474 "src/foreign-pajek-parser.y"
+#line 475 "src/foreign-pajek-parser.y"
{ context->actfrom=0;
context->actto=0;
context->directed=(context->vcount2==0);
@@ -2297,12 +2298,12 @@ yyreduce:
break;
case 127:
-#line 481 "src/foreign-pajek-parser.y"
+#line 482 "src/foreign-pajek-parser.y"
{ context->actfrom++; context->actto=0; ;}
break;
case 130:
-#line 485 "src/foreign-pajek-parser.y"
+#line 486 "src/foreign-pajek-parser.y"
{
if ((yyvsp[(1) - (1)].realnum) != 0) {
if (context->vcount2==0) {
@@ -2323,38 +2324,38 @@ yyreduce:
break;
case 131:
-#line 505 "src/foreign-pajek-parser.y"
+#line 506 "src/foreign-pajek-parser.y"
{ (yyval.intnum)=igraph_pajek_get_number(igraph_pajek_yyget_text(scanner),
igraph_pajek_yyget_leng(scanner)); ;}
break;
case 132:
-#line 508 "src/foreign-pajek-parser.y"
+#line 509 "src/foreign-pajek-parser.y"
{ (yyval.realnum)=igraph_pajek_get_number(igraph_pajek_yyget_text(scanner),
igraph_pajek_yyget_leng(scanner)); ;}
break;
case 135:
-#line 513 "src/foreign-pajek-parser.y"
+#line 514 "src/foreign-pajek-parser.y"
{ (yyval.string).str=igraph_pajek_yyget_text(scanner);
(yyval.string).len=igraph_pajek_yyget_leng(scanner); ;}
break;
case 136:
-#line 515 "src/foreign-pajek-parser.y"
+#line 516 "src/foreign-pajek-parser.y"
{ (yyval.string).str=igraph_pajek_yyget_text(scanner);
(yyval.string).len=igraph_pajek_yyget_leng(scanner); ;}
break;
case 137:
-#line 517 "src/foreign-pajek-parser.y"
+#line 518 "src/foreign-pajek-parser.y"
{ (yyval.string).str=igraph_pajek_yyget_text(scanner)+1;
(yyval.string).len=igraph_pajek_yyget_leng(scanner)-2; ;}
break;
/* Line 1267 of yacc.c. */
-#line 2358 "y.tab.c"
+#line 2359 "y.tab.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2574,7 +2575,7 @@ yyreturn:
}
-#line 520 "src/foreign-pajek-parser.y"
+#line 521 "src/foreign-pajek-parser.y"
int igraph_pajek_yyerror(YYLTYPE* locp,
diff --git a/src/foreign-pajek-parser.y b/src/foreign-pajek-parser.y
index 7233077..80ce9ff 100644
--- a/src/foreign-pajek-parser.y
+++ b/src/foreign-pajek-parser.y
@@ -222,6 +222,7 @@ vertex: longint { $$=$1; context->mode=1; };
vertexid: word {
igraph_i_pajek_add_string_vertex_attribute("id", $1.str, $1.len, context);
+ igraph_i_pajek_add_string_vertex_attribute("name", $1.str, $1.len, context);
};
vertexcoords: /* empty */
diff --git a/src/foreign.c b/src/foreign.c
index 738ad5f..03e9f33 100644
--- a/src/foreign.c
+++ b/src/foreign.c
@@ -2727,6 +2727,17 @@ int igraph_i_dot_escape(const char *orig, char **result) {
/* do we have to escape the string at all? */
long int i, j, len=(long int) strlen(orig), newlen=0;
igraph_bool_t need_quote=0, is_number=1;
+
+ /* first, check whether the string is equal to some reserved word */
+ if (!strcasecmp(orig, "graph") || !strcasecmp(orig, "digraph") ||
+ !strcasecmp(orig, "node") || !strcasecmp(orig, "edge") ||
+ !strcasecmp(orig, "strict") || !strcasecmp(orig, "subgraph")) {
+ need_quote=1;
+ is_number=0;
+ }
+
+ /* next, check whether we need to escape the string for any other reason.
+ * Also update is_number and newlen */
for (i=0; i<len; i++) {
if (isdigit(orig[i])) { newlen++; }
else if (orig[i] == '-' && i==0) { newlen++; }
diff --git a/src/games.c b/src/games.c
index 413c233..f1b9068 100644
--- a/src/games.c
+++ b/src/games.c
@@ -3524,13 +3524,15 @@ int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
igraph_vector_t* fitness_out, igraph_vector_t* fitness_in,
igraph_bool_t loops, igraph_bool_t multiple) {
igraph_vector_t edges=IGRAPH_VECTOR_NULL;
- igraph_integer_t no_of_nodes;
+ igraph_integer_t no_of_nodes, max_no_of_edges;
+ igraph_integer_t outnodes, innodes, nodes;
igraph_vector_t cum_fitness_in, cum_fitness_out;
igraph_vector_t *p_cum_fitness_in, *p_cum_fitness_out;
igraph_real_t x, max_in, max_out;
igraph_bool_t is_directed = (fitness_in != 0);
float num_steps;
- long int from, to, pos;
+ igraph_integer_t step_counter = 0;
+ long int i, from, to, pos;
if (fitness_out == 0) {
IGRAPH_ERROR("fitness_out must not be null", IGRAPH_EINVAL);
@@ -3545,6 +3547,10 @@ int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
IGRAPH_CHECK(igraph_empty(graph, 0, is_directed));
return IGRAPH_SUCCESS;
}
+
+ if (is_directed && igraph_vector_size(fitness_in) != no_of_nodes) {
+ IGRAPH_ERROR("fitness_in must have the same size as fitness_out", IGRAPH_EINVAL);
+ }
/* Sanity checks for the fitnesses */
if (igraph_vector_min(fitness_out) < 0) {
@@ -3553,6 +3559,31 @@ int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
if (fitness_in != 0 && igraph_vector_min(fitness_in) < 0) {
IGRAPH_ERROR("Fitness scores must be non-negative", IGRAPH_EINVAL);
}
+
+ /* Avoid getting into an infinite loop when too many edges are requested */
+ if (!multiple) {
+ if (is_directed) {
+ outnodes = innodes = nodes = 0;
+ for (i=0; i < no_of_nodes; i++) {
+ if (VECTOR(*fitness_out)[i] != 0)
+ outnodes++;
+ if (VECTOR(*fitness_in)[i] != 0)
+ innodes++;
+ if (VECTOR(*fitness_out)[i] != 0 && VECTOR(*fitness_in)[i] != 0)
+ nodes++;
+ }
+ max_no_of_edges = outnodes * innodes - (loops ? 0 : nodes);
+ } else {
+ nodes = 0;
+ for (i=0; i < no_of_nodes; i++) {
+ if (VECTOR(*fitness_out)[i] != 0)
+ nodes++;
+ }
+ max_no_of_edges = loops ? nodes*(nodes+1)/2 : nodes*(nodes-1)/2;
+ }
+ if (no_of_edges > max_no_of_edges)
+ IGRAPH_ERROR("Too many edges requested", IGRAPH_EINVAL);
+ }
/* Calculate the cumulative fitness scores */
IGRAPH_VECTOR_INIT_FINALLY(&cum_fitness_out, no_of_nodes);
@@ -3579,7 +3610,7 @@ int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
while (no_of_edges > 0) {
/* Report progress after every 10000 edges */
- if (no_of_edges % 10000 == 0) {
+ if ((step_counter++) % 10000 == 0) {
IGRAPH_PROGRESS("Static fitness game", 100.0*(1 - no_of_edges/num_steps), NULL);
IGRAPH_ALLOW_INTERRUPTION();
}
@@ -3614,7 +3645,7 @@ int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
IGRAPH_FINALLY(igraph_adjlist_destroy, &al);
while (no_of_edges > 0) {
/* Report progress after every 10000 edges */
- if (no_of_edges % 10000 == 0) {
+ if ((step_counter++) % 10000 == 0) {
IGRAPH_PROGRESS("Static fitness game", 100.0*(1 - no_of_edges/num_steps), NULL);
IGRAPH_ALLOW_INTERRUPTION();
}
diff --git a/src/gengraph_box_list.h b/src/gengraph_box_list.h
index b3bc4f1..e650b20 100644
--- a/src/gengraph_box_list.h
+++ b/src/gengraph_box_list.h
@@ -28,7 +28,11 @@
#ifndef _BOX_LIST_H
#define _BOX_LIST_H
+#ifndef _MSC_VER
+#ifndef register
#define register
+#endif
+#endif
namespace gengraph {
diff --git a/src/gengraph_definitions.h b/src/gengraph_definitions.h
index 80e177a..e89afd3 100644
--- a/src/gengraph_definitions.h
+++ b/src/gengraph_definitions.h
@@ -21,9 +21,11 @@
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
+#ifndef _MSC_VER
#ifndef register
#define register
#endif
+#endif
#include <stdio.h>
#include <math.h>
diff --git a/src/glet.c b/src/glet.c
index 8b0f627..f04836c 100644
--- a/src/glet.c
+++ b/src/glet.c
@@ -55,38 +55,38 @@
*/
typedef struct {
- igraph_vector_int_t *newidvectors;
- igraph_t *newgraphs;
- igraph_vector_t *newweights;
+ igraph_vector_int_t *resultids;
+ igraph_t *result;
+ igraph_vector_t *resultweights;
int nc;
} igraph_i_subclique_next_free_t;
void igraph_i_subclique_next_free(void *ptr) {
igraph_i_subclique_next_free_t *data=ptr;
int i;
- if (data->newidvectors) {
+ if (data->resultids) {
for (i=0; i<data->nc; i++) {
- if (data->newidvectors+i) {
- igraph_vector_int_destroy(data->newidvectors+i);
+ if (data->resultids+i) {
+ igraph_vector_int_destroy(data->resultids+i);
}
}
- igraph_Free(data->newidvectors);
+ igraph_Free(data->resultids);
}
- if (data->newgraphs) {
+ if (data->result) {
for (i=0; i<data->nc; i++) {
- if (data->newgraphs+i) {
- igraph_destroy(data->newgraphs+i);
+ if (data->result+i) {
+ igraph_destroy(data->result+i);
}
}
- igraph_Free(data->newgraphs);
+ igraph_Free(data->result);
}
- if (data->newweights) {
+ if (data->resultweights) {
for (i=0; i<data->nc; i++) {
- if (data->newweights+i) {
- igraph_vector_destroy(data->newweights+i);
+ if (data->resultweights+i) {
+ igraph_vector_destroy(data->resultweights+i);
}
}
- igraph_Free(data->newweights);
+ igraph_Free(data->resultweights);
}
}
@@ -109,15 +109,15 @@ void igraph_i_subclique_next_free(void *ptr) {
*
*/
-int igraph_subclique_next(const igraph_t *graph,
- const igraph_vector_t *weights,
- const igraph_vector_int_t *ids,
- const igraph_vector_ptr_t *cliques,
- igraph_vector_ptr_t *result,
- igraph_vector_ptr_t *resultweights,
- igraph_vector_ptr_t *resultids,
- igraph_vector_t *clique_thr,
- igraph_vector_t *next_thr) {
+int igraph_i_subclique_next(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ const igraph_vector_int_t *ids,
+ const igraph_vector_ptr_t *cliques,
+ igraph_t **result,
+ igraph_vector_t **resultweights,
+ igraph_vector_int_t **resultids,
+ igraph_vector_t *clique_thr,
+ igraph_vector_t *next_thr) {
/* The input is a set of cliques, that were found at a previous level.
For each clique, we calculate the next threshold, drop the isolate
@@ -129,11 +129,7 @@ int igraph_subclique_next(const igraph_t *graph,
igraph_integer_t c, nc=igraph_vector_ptr_size(cliques);
igraph_integer_t no_of_nodes=igraph_vcount(graph);
igraph_integer_t no_of_edges=igraph_ecount(graph);
- igraph_vector_int_t *newidvectors=0;
- igraph_t *newgraphs=0;
- igraph_vector_t *newweights=0;
- igraph_i_subclique_next_free_t freedata={ newidvectors, newgraphs,
- newweights, nc };
+ igraph_i_subclique_next_free_t freedata={ 0, 0, 0, nc };
if (igraph_vector_size(weights) != no_of_edges) {
IGRAPH_ERROR("Invalid length of weight vector", IGRAPH_EINVAL);
@@ -143,34 +139,22 @@ int igraph_subclique_next(const igraph_t *graph,
IGRAPH_ERROR("Invalid length of ID vector", IGRAPH_EINVAL);
}
- if (igraph_vector_ptr_size(result) != nc) {
- IGRAPH_ERROR("Invalid graph list size", IGRAPH_EINVAL);
- }
-
- if (igraph_vector_ptr_size(resultweights) != nc) {
- IGRAPH_ERROR("Invalid weight list size", IGRAPH_EINVAL);
- }
-
- if (igraph_vector_ptr_size(resultids) != nc) {
- IGRAPH_ERROR("Invalid id vector size", IGRAPH_EINVAL);
- }
-
IGRAPH_FINALLY(igraph_i_subclique_next_free, &freedata);
- newidvectors=igraph_Calloc(nc, igraph_vector_int_t);
- if (!newidvectors) {
+ *resultids=igraph_Calloc(nc, igraph_vector_int_t);
+ if (!*resultids) {
IGRAPH_ERROR("Cannot calculate next cliques", IGRAPH_ENOMEM);
}
- freedata.newidvectors = newidvectors;
- newweights=igraph_Calloc(nc, igraph_vector_t);
- if (!newweights) {
+ freedata.resultids = *resultids;
+ *resultweights=igraph_Calloc(nc, igraph_vector_t);
+ if (!*resultweights) {
IGRAPH_ERROR("Cannot calculate next cliques", IGRAPH_ENOMEM);
}
- freedata.newweights = newweights;
- newgraphs=igraph_Calloc(nc, igraph_t);
- if (!newgraphs) {
+ freedata.resultweights = *resultweights;
+ *result=igraph_Calloc(nc, igraph_t);
+ if (!*result) {
IGRAPH_ERROR("Cannot calculate next cliques", IGRAPH_ENOMEM);
}
- freedata.newgraphs = newgraphs;
+ freedata.result = *result;
igraph_vector_init(&newedges, 100);
IGRAPH_FINALLY(igraph_vector_destroy, &newedges);
@@ -194,9 +178,9 @@ int igraph_subclique_next(const igraph_t *graph,
igraph_real_t minweight=IGRAPH_INFINITY, nextweight=IGRAPH_INFINITY;
igraph_integer_t e, v, clsize=igraph_vector_size(clique);
igraph_integer_t noe, nov=0;
- igraph_vector_int_t *newids=newidvectors+c;
- igraph_vector_t *neww=newweights+c;
- igraph_t *newgraph=newgraphs+c;
+ igraph_vector_int_t *newids = (*resultids) + c;
+ igraph_vector_t *neww = (*resultweights) + c;
+ igraph_t *newgraph = (*result) + c;
igraph_vector_int_clear(&edges);
igraph_vector_clear(&newedges);
@@ -242,9 +226,7 @@ int igraph_subclique_next(const igraph_t *graph,
threshold, and their incident vertices. */
igraph_vector_int_init(newids, 0);
- VECTOR(*resultids)[c] = newids;
igraph_vector_init(neww, 0);
- VECTOR(*resultweights)[c] = neww;
/* We use mark[] to denote the vertices already mapped to
the new graph. If this is -(c+1), then the vertex was
@@ -275,7 +257,6 @@ int igraph_subclique_next(const igraph_t *graph,
}
igraph_create(newgraph, &newedges, nov, IGRAPH_UNDIRECTED);
- VECTOR(*result)[c] = newgraph;
/* --------------------------------------------------- */
@@ -286,7 +267,7 @@ int igraph_subclique_next(const igraph_t *graph,
igraph_vector_int_destroy(&mark);
igraph_vector_int_destroy(&map);
igraph_vector_destroy(&newedges);
- IGRAPH_FINALLY_CLEAN(6); /* +1 for the result */
+ IGRAPH_FINALLY_CLEAN(6); /* + freedata */
return 0;
}
@@ -300,24 +281,6 @@ void igraph_i_graphlets_destroy_vectorlist(igraph_vector_ptr_t *vl) {
igraph_vector_ptr_destroy(vl);
}
-void igraph_i_graphlets_destroy_intvectorlist(igraph_vector_ptr_t *vl) {
- int i, n=igraph_vector_ptr_size(vl);
- for (i=0; i<n; i++) {
- igraph_vector_int_t *v=(igraph_vector_int_t*) VECTOR(*vl)[i];
- if (v) { igraph_vector_int_destroy(v); }
- }
- igraph_vector_ptr_destroy(vl);
-}
-
-void igraph_i_graphlets_destroy_graphlist(igraph_vector_ptr_t *vl) {
- int i, n=igraph_vector_ptr_size(vl);
- for (i=0; i<n; i++) {
- igraph_t *v=(igraph_t*) VECTOR(*vl)[i];
- if (v) { igraph_destroy(v); }
- }
- igraph_vector_ptr_destroy(vl);
-}
-
int igraph_i_graphlets(const igraph_t *graph,
const igraph_vector_t *weights,
igraph_vector_ptr_t *cliques,
@@ -335,8 +298,11 @@ int igraph_i_graphlets(const igraph_t *graph,
igraph_vector_t subv;
igraph_t subg;
int i, nographs, nocliques;
- igraph_vector_ptr_t newgraphs, newweights, newids;
+ igraph_t *newgraphs = 0;
+ igraph_vector_t *newweights = 0;
+ igraph_vector_int_t *newids = 0;
igraph_vector_t clique_thr, next_thr;
+ igraph_i_subclique_next_free_t freedata = { 0, 0, 0, 0 };
IGRAPH_CHECK(igraph_vector_ptr_init(&mycliques, 0));
IGRAPH_FINALLY(igraph_i_graphlets_destroy_vectorlist, &mycliques);
@@ -350,25 +316,28 @@ int igraph_i_graphlets(const igraph_t *graph,
}
igraph_subgraph_edges(graph, &subg, igraph_ess_vector(&subv),
/*delete_vertices=*/ 0);
+ IGRAPH_FINALLY(igraph_destroy, &subg);
igraph_maximal_cliques(&subg, &mycliques, /*min_size=*/ 0, /*max_size=*/ 0);
+ igraph_destroy(&subg);
+ IGRAPH_FINALLY_CLEAN(1);
nocliques=igraph_vector_ptr_size(&mycliques);
igraph_vector_destroy(&subv);
IGRAPH_FINALLY_CLEAN(1);
/* Get the next cliques and thresholds */
- igraph_vector_ptr_init(&newgraphs, nocliques);
- IGRAPH_FINALLY(igraph_i_graphlets_destroy_graphlist, &newgraphs);
- igraph_vector_ptr_init(&newweights, nocliques);
- IGRAPH_FINALLY(igraph_i_graphlets_destroy_vectorlist, &newweights);
- igraph_vector_ptr_init(&newids, nocliques);
- IGRAPH_FINALLY(igraph_i_graphlets_destroy_intvectorlist, &newids);
IGRAPH_VECTOR_INIT_FINALLY(&next_thr, 0);
IGRAPH_VECTOR_INIT_FINALLY(&clique_thr, 0);
- igraph_subclique_next(graph, weights, ids, &mycliques,
- &newgraphs, &newweights, &newids,
- &clique_thr, &next_thr);
+ igraph_i_subclique_next(graph, weights, ids, &mycliques,
+ &newgraphs, &newweights, &newids,
+ &clique_thr, &next_thr);
+
+ freedata.result = newgraphs;
+ freedata.resultids = newids;
+ freedata.resultweights = newweights;
+ freedata.nc = nocliques;
+ IGRAPH_FINALLY(igraph_i_subclique_next_free, &freedata);
/* Store cliques at the current level */
igraph_vector_append(thresholds, &clique_thr);
@@ -384,23 +353,21 @@ int igraph_i_graphlets(const igraph_t *graph,
igraph_vector_ptr_append(cliques, &mycliques);
/* Recursive calls for cliques found */
- nographs=igraph_vector_ptr_size(&newgraphs);
+ nographs=igraph_vector_ptr_size(&mycliques);
for (i=0; i<nographs; i++) {
- igraph_t *g=VECTOR(newgraphs)[i];
+ igraph_t *g=newgraphs + i;
if (igraph_vcount(g) > 1) {
- igraph_vector_t *w=VECTOR(newweights)[i];
- igraph_vector_int_t *ids=VECTOR(newids)[i];
+ igraph_vector_t *w=newweights + i;
+ igraph_vector_int_t *ids=newids +i;
igraph_i_graphlets(g, w, cliques, thresholds, ids, VECTOR(next_thr)[i]);
}
}
igraph_vector_destroy(&clique_thr);
igraph_vector_destroy(&next_thr);
- igraph_i_graphlets_destroy_intvectorlist(&newids);
- igraph_i_graphlets_destroy_vectorlist(&newweights);
- igraph_i_graphlets_destroy_graphlist(&newgraphs);
+ igraph_i_subclique_next_free(&freedata);
igraph_vector_ptr_destroy(&mycliques); /* contents was copied over */
- IGRAPH_FINALLY_CLEAN(6);
+ IGRAPH_FINALLY_CLEAN(4);
return 0;
}
@@ -497,6 +464,7 @@ int igraph_i_graphlets_filter(igraph_vector_ptr_t *cliques,
if (pi == n_i) {
/* Found, delete immediately */
igraph_vector_destroy(needle);
+ igraph_free(needle);
VECTOR(*cliques)[ri]=0;
break;
}
@@ -552,6 +520,10 @@ int igraph_graphlets_candidate_basis(const igraph_t *graph,
int i;
/* Some checks */
+ if (weights == NULL) {
+ IGRAPH_ERROR("Graphlet functions require weighted graphs", IGRAPH_EINVAL);
+ }
+
if (igraph_vector_size(weights) != no_of_edges) {
IGRAPH_ERROR("Invalid weight vector length", IGRAPH_EINVAL);
}
@@ -593,6 +565,9 @@ int igraph_i_graphlets_project(const igraph_t *graph,
igraph_bool_t simple;
/* Check arguments */
+ if (weights == NULL) {
+ IGRAPH_ERROR("Graphlet functions require weighted graphs", IGRAPH_EINVAL);
+ }
if (no_of_edges != igraph_vector_size(weights)) {
IGRAPH_ERROR("Invalid weight vector size", IGRAPH_EINVAL);
}
diff --git a/src/igraph_cliquer.c b/src/igraph_cliquer.c
new file mode 100644
index 0000000..06ea369
--- /dev/null
+++ b/src/igraph_cliquer.c
@@ -0,0 +1,375 @@
+
+#include "igraph_cliquer.h"
+#include "igraph_memory.h"
+#include "igraph_constants.h"
+#include "igraph_interrupt_internal.h"
+#include "cliquer/cliquer.h"
+#include "config.h"
+
+#include <assert.h>
+
+
+/* Call this to allow for interruption in Cliquer callback functions */
+#define CLIQUER_ALLOW_INTERRUPTION() \
+ { \
+ if (igraph_i_interruption_handler) \
+ if (igraph_allow_interruption(NULL) != IGRAPH_SUCCESS) { \
+ cliquer_interrupted = 1; \
+ return FALSE; \
+ } \
+ }
+
+/* Interruptable Cliquer functions must be wrapped in CLIQUER_INTERRUPTABLE when called */
+#define CLIQUER_INTERRUPTABLE(x) \
+ { \
+ cliquer_interrupted = 0; \
+ x; \
+ if (cliquer_interrupted) return IGRAPH_INTERRUPTED; \
+ }
+
+
+/* Nonzero value signals interuption from Cliquer callback function */
+static IGRAPH_THREAD_LOCAL int cliquer_interrupted;
+
+
+/* For use with IGRAPH_FINALLY */
+static void free_clique_list(igraph_vector_ptr_t *vp) {
+ igraph_integer_t i, len;
+ len = igraph_vector_ptr_size(vp);
+ for (i=0; i < len; ++i)
+ igraph_vector_destroy((igraph_vector_t *) VECTOR(*vp)[i]);
+ igraph_vector_ptr_free_all(vp);
+}
+
+/* We shall use this option struct for all calls to Cliquer */
+static IGRAPH_THREAD_LOCAL clique_options igraph_cliquer_opt = {
+ reorder_by_default, NULL, NULL, NULL, NULL, NULL, NULL, 0
+};
+
+
+/* Convert an igraph graph to a Cliquer graph */
+static void igraph_to_cliquer(const igraph_t *ig, graph_t **cg) {
+ igraph_integer_t vcount, ecount;
+ int i;
+
+ if (igraph_is_directed(ig))
+ IGRAPH_WARNING("Edge directions are ignored for clique calculations");
+
+ vcount = igraph_vcount(ig);
+ ecount = igraph_ecount(ig);
+
+ *cg = graph_new(vcount);
+
+ for (i=0; i < ecount; ++i) {
+ long s, t;
+ s = IGRAPH_FROM(ig, i);
+ t = IGRAPH_TO(ig, i);
+ if (s != t)
+ GRAPH_ADD_EDGE(*cg, s, t);
+ }
+}
+
+
+/* Copy weights to a Cliquer graph */
+static int set_weights(const igraph_vector_t *vertex_weights, graph_t *g) {
+ int i;
+
+ assert(vertex_weights != NULL);
+
+ if (igraph_vector_size(vertex_weights) != g->n)
+ IGRAPH_ERROR("Invalid vertex weight vector length", IGRAPH_EINVAL);
+
+ for (i=0; i < g->n; ++i) {
+ g->weights[i] = VECTOR(*vertex_weights)[i];
+ if (g->weights[i] != VECTOR(*vertex_weights)[i])
+ IGRAPH_WARNING("Only integer vertex weights are supported; weights will be truncated to their integer parts");
+ if (g->weights[i] <= 0)
+ IGRAPH_ERROR("Vertex weights must be positive", IGRAPH_EINVAL);
+ }
+
+ return IGRAPH_SUCCESS;
+}
+
+
+/* Find all cliques. */
+
+static boolean collect_cliques_callback(set_t s, graph_t *g, clique_options *opt) {
+ igraph_vector_ptr_t *list;
+ igraph_vector_t *clique;
+ int i, j;
+
+ CLIQUER_ALLOW_INTERRUPTION();
+
+ list = (igraph_vector_ptr_t *) opt->user_data;
+ clique = (igraph_vector_t *) malloc(sizeof(igraph_vector_t));
+ igraph_vector_init(clique, set_size(s));
+
+ i = -1; j = 0;
+ while ((i = set_return_next(s,i)) >= 0)
+ VECTOR(*clique)[j++] = i;
+
+ igraph_vector_ptr_push_back(list, clique);
+
+ return TRUE;
+}
+
+int igraph_i_cliquer_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
+ igraph_integer_t min_size, igraph_integer_t max_size)
+{
+ graph_t *g;
+ igraph_integer_t vcount = igraph_vcount(graph);
+
+ if (vcount == 0) {
+ igraph_vector_ptr_clear(res);
+ return IGRAPH_SUCCESS;
+ }
+
+ if (min_size <= 0) min_size = 1;
+ if (max_size <= 0) max_size = 0;
+
+ if (max_size > 0 && max_size < min_size)
+ IGRAPH_ERROR("max_size must not be smaller than min_size", IGRAPH_EINVAL);
+
+ igraph_to_cliquer(graph, &g);
+ IGRAPH_FINALLY(graph_free, g);
+
+ igraph_vector_ptr_clear(res);
+ igraph_cliquer_opt.user_data = res;
+ igraph_cliquer_opt.user_function = &collect_cliques_callback;
+
+ IGRAPH_FINALLY(free_clique_list, res);
+ CLIQUER_INTERRUPTABLE(clique_unweighted_find_all(g, min_size, max_size, /* maximal= */ FALSE, &igraph_cliquer_opt));
+ IGRAPH_FINALLY_CLEAN(1);
+
+ graph_free(g);
+ IGRAPH_FINALLY_CLEAN(1);
+
+ return IGRAPH_SUCCESS;
+}
+
+
+/* Count cliques of each size. */
+
+static boolean count_cliques_callback(set_t s, graph_t *g, clique_options *opt) {
+ igraph_vector_t *hist;
+
+ CLIQUER_ALLOW_INTERRUPTION();
+
+ hist = (igraph_vector_t *) opt->user_data;
+ VECTOR(*hist)[set_size(s)-1] += 1;
+
+ return TRUE;
+}
+
+int igraph_i_cliquer_histogram(const igraph_t *graph, igraph_vector_t *hist,
+ igraph_integer_t min_size, igraph_integer_t max_size)
+{
+ graph_t *g;
+ int i;
+ igraph_integer_t vcount = igraph_vcount(graph);
+
+ if (vcount == 0) {
+ igraph_vector_clear(hist);
+ return IGRAPH_SUCCESS;
+ }
+
+ if (min_size <= 0) min_size = 1;
+ if (max_size <= 0) max_size = vcount; /* also used for initial hist vector size, do not set to zero */
+
+ if (max_size < min_size)
+ IGRAPH_ERROR("max_size must not be smaller than min_size", IGRAPH_EINVAL);
+
+ igraph_to_cliquer(graph, &g);
+ IGRAPH_FINALLY(graph_free, g);
+
+ igraph_vector_resize(hist, max_size);
+ igraph_vector_null(hist);
+ igraph_cliquer_opt.user_data = hist;
+ igraph_cliquer_opt.user_function = &count_cliques_callback;
+
+ CLIQUER_INTERRUPTABLE(clique_unweighted_find_all(g, min_size, max_size, /* maximal= */ FALSE, &igraph_cliquer_opt));
+
+ for (i=max_size; i > 0; --i)
+ if (VECTOR(*hist)[i-1] > 0)
+ break;
+ igraph_vector_resize(hist, i);
+ igraph_vector_resize_min(hist);
+
+ graph_free(g);
+ IGRAPH_FINALLY_CLEAN(1);
+
+ return IGRAPH_SUCCESS;
+}
+
+
+/* Call function for each clique. */
+
+struct callback_data {
+ igraph_clique_handler_t *handler;
+ void *arg;
+};
+
+static boolean callback_callback(set_t s, graph_t *g, clique_options *opt) {
+ igraph_vector_t *clique;
+ struct callback_data *cd;
+ int i, j;
+
+ CLIQUER_ALLOW_INTERRUPTION();
+
+ cd = (struct callback_data *) opt->user_data;
+
+ clique = (igraph_vector_t *) malloc(sizeof(igraph_vector_t));
+ igraph_vector_init(clique, set_size(s));
+
+ i = -1; j = 0;
+ while ((i = set_return_next(s,i)) >= 0)
+ VECTOR(*clique)[j++] = i;
+
+ return (*(cd->handler))(clique, cd->arg);
+}
+
+int igraph_i_cliquer_callback(const igraph_t *graph,
+ igraph_integer_t min_size, igraph_integer_t max_size,
+ igraph_clique_handler_t *cliquehandler_fn, void *arg)
+{
+ graph_t *g;
+ struct callback_data cd;
+ igraph_integer_t vcount = igraph_vcount(graph);
+
+ if (vcount == 0)
+ return IGRAPH_SUCCESS;
+
+ if (min_size <= 0) min_size = 1;
+ if (max_size <= 0) max_size = 0;
+
+ if (max_size > 0 && max_size < min_size)
+ IGRAPH_ERROR("max_size must not be smaller than min_size", IGRAPH_EINVAL);
+
+ igraph_to_cliquer(graph, &g);
+ IGRAPH_FINALLY(graph_free, g);
+
+ cd.handler = cliquehandler_fn;
+ cd.arg = arg;
+ igraph_cliquer_opt.user_data = &cd;
+ igraph_cliquer_opt.user_function = &callback_callback;
+
+ CLIQUER_INTERRUPTABLE(clique_unweighted_find_all(g, min_size, max_size, /* maximal= */ FALSE, &igraph_cliquer_opt));
+
+ graph_free(g);
+ IGRAPH_FINALLY_CLEAN(1);
+
+ return IGRAPH_SUCCESS;
+}
+
+
+/* Find weighted cliques in given weight range. */
+
+int igraph_i_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res,
+ igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal)
+{
+ graph_t *g;
+ igraph_integer_t vcount = igraph_vcount(graph);
+
+ if (vcount == 0) {
+ igraph_vector_ptr_clear(res);
+ return IGRAPH_SUCCESS;
+ }
+
+ if (min_weight != (int) min_weight) {
+ IGRAPH_WARNING("Only integer vertex weights are supported; the minimum weight will be truncated to its integer part");
+ min_weight = (int) min_weight;
+ }
+
+ if (max_weight != (int) max_weight) {
+ IGRAPH_WARNING("Only integer vertex weights are supported; the maximum weight will be truncated to its integer part");
+ max_weight = (int) max_weight;
+ }
+
+ if (min_weight <= 0) min_weight = 1;
+ if (max_weight <= 0) max_weight = 0;
+
+ if (max_weight > 0 && max_weight < min_weight)
+ IGRAPH_ERROR("max_weight must not be smaller than min_weight", IGRAPH_EINVAL);
+
+ igraph_to_cliquer(graph, &g);
+ IGRAPH_FINALLY(graph_free, g);
+
+ IGRAPH_CHECK(set_weights(vertex_weights, g));
+
+ igraph_vector_ptr_clear(res);
+ igraph_cliquer_opt.user_data = res;
+ igraph_cliquer_opt.user_function = &collect_cliques_callback;
+
+ IGRAPH_FINALLY(free_clique_list, res);
+ CLIQUER_INTERRUPTABLE(clique_find_all(g, min_weight, max_weight, maximal, &igraph_cliquer_opt));
+ IGRAPH_FINALLY_CLEAN(1);
+
+ graph_free(g);
+ IGRAPH_FINALLY_CLEAN(1);
+
+ return IGRAPH_SUCCESS;
+}
+
+
+/* Find largest weighted cliques. */
+
+int igraph_i_largest_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res)
+{
+ graph_t *g;
+ igraph_integer_t vcount = igraph_vcount(graph);
+
+ if (vcount == 0) {
+ igraph_vector_ptr_clear(res);
+ return IGRAPH_SUCCESS;
+ }
+
+ igraph_to_cliquer(graph, &g);
+ IGRAPH_FINALLY(graph_free, g);
+
+ IGRAPH_CHECK(set_weights(vertex_weights, g));
+
+ igraph_vector_ptr_clear(res);
+ igraph_cliquer_opt.user_data = res;
+ igraph_cliquer_opt.user_function = &collect_cliques_callback;
+
+ IGRAPH_FINALLY(free_clique_list, res);
+ CLIQUER_INTERRUPTABLE(clique_find_all(g, 0, 0, FALSE, &igraph_cliquer_opt));
+ IGRAPH_FINALLY_CLEAN(1);
+
+ graph_free(g);
+ IGRAPH_FINALLY_CLEAN(1);
+
+ return IGRAPH_SUCCESS;
+}
+
+
+/* Find weight of largest weight clique. */
+
+int igraph_i_weighted_clique_number(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_real_t *res)
+{
+ graph_t *g;
+ igraph_integer_t vcount = igraph_vcount(graph);
+
+ if (vcount == 0) {
+ *res = 0;
+ return IGRAPH_SUCCESS;
+ }
+
+ igraph_to_cliquer(graph, &g);
+ IGRAPH_FINALLY(graph_free, g);
+
+ IGRAPH_CHECK(set_weights(vertex_weights, g));
+
+ igraph_cliquer_opt.user_function = NULL;
+
+ /* we are not using a callback function, thus this is not interruptable */
+ *res = clique_max_weight(g, &igraph_cliquer_opt);
+
+ graph_free(g);
+ IGRAPH_FINALLY_CLEAN(1);
+
+ return IGRAPH_SUCCESS;
+}
diff --git a/src/igraph_cliquer.h b/src/igraph_cliquer.h
new file mode 100644
index 0000000..5379aec
--- /dev/null
+++ b/src/igraph_cliquer.h
@@ -0,0 +1,29 @@
+#ifndef IGRAPH_CLIQUER_H
+#define IGRAPH_CLIQUER_H
+
+#include "igraph_types_internal.h"
+#include "igraph_interface.h"
+#include "igraph_cliques.h"
+
+int igraph_i_cliquer_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
+ igraph_integer_t min_size, igraph_integer_t max_size);
+
+int igraph_i_cliquer_histogram(const igraph_t *graph, igraph_vector_t *hist,
+ igraph_integer_t min_size, igraph_integer_t max_size);
+
+int igraph_i_cliquer_callback(const igraph_t *graph,
+ igraph_integer_t min_size, igraph_integer_t max_size,
+ igraph_clique_handler_t *cliquehandler_fn, void *arg);
+
+int igraph_i_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res,
+ igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal);
+
+int igraph_i_largest_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res);
+
+int igraph_i_weighted_clique_number(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_real_t *res);
+
+#endif // IGRAPH_CLIQUER_H
+
diff --git a/src/igraph_math.h b/src/igraph_math.h
index 538d4bf..a1d8d47 100644
--- a/src/igraph_math.h
+++ b/src/igraph_math.h
@@ -69,6 +69,9 @@ double igraph_fmin(double a, double b);
#ifndef M_PI
# define M_PI 3.14159265358979323846
#endif
+#ifndef M_PI_2
+# define M_PI_2 1.57079632679489661923
+#endif
#ifndef M_LN2
# define M_LN2 0.69314718055994530942
#endif
diff --git a/src/igraph_threading.h b/src/igraph_threading.h
index 6359554..12d9d07 100644
--- a/src/igraph_threading.h
+++ b/src/igraph_threading.h
@@ -24,15 +24,7 @@
#ifndef IGRAPH_THREADING_H
#define IGRAPH_THREADING_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
diff --git a/src/igraph_version.h b/src/igraph_version.h
index 4539c61..2ce6ed5 100644
--- a/src/igraph_version.h
+++ b/src/igraph_version.h
@@ -24,7 +24,11 @@
#ifndef IGRAPH_VERSION_H
#define IGRAPH_VERSION_H
-#define IGRAPH_VERSION "1.0.0"
+#include "igraph_decls.h"
+
+__BEGIN_DECLS
+
+#define IGRAPH_VERSION "1.1.1"
#define IGRAPH_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@
#define IGRAPH_VERSION_MINOR @PACKAGE_VERSION_MINOR@
#define IGRAPH_VERSION_PATCH @PACKAGE_VERSION_PATCH@
@@ -35,6 +39,8 @@ int igraph_version(const char **version_string,
int *minor,
int *subminor);
+__END_DECLS
+
#endif
diff --git a/src/include/igraph_adjlist.h b/src/include/igraph_adjlist.h
index 33ee13a..1d4676f 100644
--- a/src/include/igraph_adjlist.h
+++ b/src/include/igraph_adjlist.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_ADJLIST_H
#define IGRAPH_ADJLIST_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
@@ -45,22 +36,25 @@ typedef struct igraph_adjlist_t {
igraph_vector_int_t *adjs;
} igraph_adjlist_t;
-int igraph_adjlist_init(const igraph_t *graph, igraph_adjlist_t *al,
- igraph_neimode_t mode);
-int igraph_adjlist_init_empty(igraph_adjlist_t *al, igraph_integer_t no_of_nodes);
-igraph_integer_t igraph_adjlist_size(const igraph_adjlist_t *al);
-int igraph_adjlist_init_complementer(const igraph_t *graph,
- igraph_adjlist_t *al,
- igraph_neimode_t mode,
- igraph_bool_t loops);
-void igraph_adjlist_destroy(igraph_adjlist_t *al);
-void igraph_adjlist_clear(igraph_adjlist_t *al);
-void igraph_adjlist_sort(igraph_adjlist_t *al);
-int igraph_adjlist_simplify(igraph_adjlist_t *al);
-int igraph_adjlist_remove_duplicate(const igraph_t *graph,
- igraph_adjlist_t *al);
-int igraph_adjlist_print(const igraph_adjlist_t *al);
-int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile);
+DECLDIR int igraph_adjlist_init(const igraph_t *graph, igraph_adjlist_t *al,
+ igraph_neimode_t mode);
+DECLDIR int igraph_adjlist_init_empty(igraph_adjlist_t *al, igraph_integer_t no_of_nodes);
+DECLDIR igraph_integer_t igraph_adjlist_size(const igraph_adjlist_t *al);
+DECLDIR int igraph_adjlist_init_complementer(const igraph_t *graph,
+ igraph_adjlist_t *al,
+ igraph_neimode_t mode,
+ igraph_bool_t loops);
+DECLDIR void igraph_adjlist_destroy(igraph_adjlist_t *al);
+DECLDIR void igraph_adjlist_clear(igraph_adjlist_t *al);
+DECLDIR void igraph_adjlist_sort(igraph_adjlist_t *al);
+DECLDIR int igraph_adjlist_simplify(igraph_adjlist_t *al);
+DECLDIR int igraph_adjlist_remove_duplicate(const igraph_t *graph,
+ igraph_adjlist_t *al);
+DECLDIR int igraph_adjlist_print(const igraph_adjlist_t *al);
+DECLDIR int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile);
+DECLDIR igraph_bool_t igraph_adjlist_has_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t to, igraph_bool_t directed);
+DECLDIR int igraph_adjlist_replace_edge(igraph_adjlist_t* al, igraph_integer_t from, igraph_integer_t oldto, igraph_integer_t newto, igraph_bool_t directed);
+
/* igraph_vector_int_t *igraph_adjlist_get(const igraph_adjlist_t *al, */
/* igraph_integer_t no); */
/**
@@ -78,24 +72,24 @@ int igraph_adjlist_fprint(const igraph_adjlist_t *al, FILE *outfile);
*/
#define igraph_adjlist_get(al,no) (&(al)->adjs[(long int)(no)])
-int igraph_adjlist(igraph_t *graph, const igraph_adjlist_t *adjlist,
- igraph_neimode_t mode, igraph_bool_t duplicate);
+DECLDIR int igraph_adjlist(igraph_t *graph, const igraph_adjlist_t *adjlist,
+ igraph_neimode_t mode, igraph_bool_t duplicate);
typedef struct igraph_inclist_t {
igraph_integer_t length;
igraph_vector_int_t *incs;
} igraph_inclist_t;
-int igraph_inclist_init(const igraph_t *graph,
- igraph_inclist_t *il,
- igraph_neimode_t mode);
-int igraph_inclist_init_empty(igraph_inclist_t *il, igraph_integer_t n);
-void igraph_inclist_destroy(igraph_inclist_t *il);
-void igraph_inclist_clear(igraph_inclist_t *il);
-int igraph_inclist_remove_duplicate(const igraph_t *graph,
- igraph_inclist_t *il);
-int igraph_inclist_print(const igraph_inclist_t *il);
-int igraph_inclist_fprint(const igraph_inclist_t *il, FILE *outfile);
+DECLDIR int igraph_inclist_init(const igraph_t *graph,
+ igraph_inclist_t *il,
+ igraph_neimode_t mode);
+DECLDIR int igraph_inclist_init_empty(igraph_inclist_t *il, igraph_integer_t n);
+DECLDIR void igraph_inclist_destroy(igraph_inclist_t *il);
+DECLDIR void igraph_inclist_clear(igraph_inclist_t *il);
+DECLDIR int igraph_inclist_remove_duplicate(const igraph_t *graph,
+ igraph_inclist_t *il);
+DECLDIR int igraph_inclist_print(const igraph_inclist_t *il);
+DECLDIR int igraph_inclist_fprint(const igraph_inclist_t *il, FILE *outfile);
/**
* \define igraph_inclist_get
@@ -120,12 +114,12 @@ typedef struct igraph_lazy_adjlist_t {
igraph_lazy_adlist_simplify_t simplify;
} igraph_lazy_adjlist_t;
-int igraph_lazy_adjlist_init(const igraph_t *graph,
- igraph_lazy_adjlist_t *al,
- igraph_neimode_t mode,
- igraph_lazy_adlist_simplify_t simplify);
-void igraph_lazy_adjlist_destroy(igraph_lazy_adjlist_t *al);
-void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al);
+DECLDIR int igraph_lazy_adjlist_init(const igraph_t *graph,
+ igraph_lazy_adjlist_t *al,
+ igraph_neimode_t mode,
+ igraph_lazy_adlist_simplify_t simplify);
+DECLDIR void igraph_lazy_adjlist_destroy(igraph_lazy_adjlist_t *al);
+DECLDIR void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al);
/* igraph_vector_t *igraph_lazy_adjlist_get(igraph_lazy_adjlist_t *al, */
/* igraph_integer_t no); */
/**
@@ -147,8 +141,8 @@ void igraph_lazy_adjlist_clear(igraph_lazy_adjlist_t *al);
#define igraph_lazy_adjlist_get(al,no) \
((al)->adjs[(long int)(no)] != 0 ? ((al)->adjs[(long int)(no)]) : \
(igraph_lazy_adjlist_get_real(al, no)))
-igraph_vector_t *igraph_lazy_adjlist_get_real(igraph_lazy_adjlist_t *al,
- igraph_integer_t no);
+DECLDIR igraph_vector_t *igraph_lazy_adjlist_get_real(igraph_lazy_adjlist_t *al,
+ igraph_integer_t no);
typedef struct igraph_lazy_inclist_t {
const igraph_t *graph;
@@ -157,11 +151,11 @@ typedef struct igraph_lazy_inclist_t {
igraph_neimode_t mode;
} igraph_lazy_inclist_t;
-int igraph_lazy_inclist_init(const igraph_t *graph,
- igraph_lazy_inclist_t *il,
- igraph_neimode_t mode);
-void igraph_lazy_inclist_destroy(igraph_lazy_inclist_t *il);
-void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il);
+DECLDIR int igraph_lazy_inclist_init(const igraph_t *graph,
+ igraph_lazy_inclist_t *il,
+ igraph_neimode_t mode);
+DECLDIR void igraph_lazy_inclist_destroy(igraph_lazy_inclist_t *il);
+DECLDIR void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il);
/**
* \define igraph_lazy_inclist_get
@@ -182,8 +176,8 @@ void igraph_lazy_inclist_clear(igraph_lazy_inclist_t *il);
#define igraph_lazy_inclist_get(al,no) \
((al)->incs[(long int)(no)] != 0 ? ((al)->incs[(long int)(no)]) : \
(igraph_lazy_inclist_get_real(al, no)))
-igraph_vector_t *igraph_lazy_inclist_get_real(igraph_lazy_inclist_t *al,
- igraph_integer_t no);
+DECLDIR igraph_vector_t *igraph_lazy_inclist_get_real(igraph_lazy_inclist_t *al,
+ igraph_integer_t no);
/*************************************************************************
* DEPRECATED TYPES AND FUNCTIONS
@@ -191,13 +185,13 @@ igraph_vector_t *igraph_lazy_inclist_get_real(igraph_lazy_inclist_t *al,
typedef igraph_inclist_t igraph_adjedgelist_t;
-int igraph_adjedgelist_init(const igraph_t *graph,
- igraph_inclist_t *il,
- igraph_neimode_t mode);
-void igraph_adjedgelist_destroy(igraph_inclist_t *il);
-int igraph_adjedgelist_remove_duplicate(const igraph_t *graph,
- igraph_inclist_t *il);
-int igraph_adjedgelist_print(const igraph_inclist_t *il, FILE *outfile);
+DECLDIR int igraph_adjedgelist_init(const igraph_t *graph,
+ igraph_inclist_t *il,
+ igraph_neimode_t mode);
+DECLDIR void igraph_adjedgelist_destroy(igraph_inclist_t *il);
+DECLDIR int igraph_adjedgelist_remove_duplicate(const igraph_t *graph,
+ igraph_inclist_t *il);
+DECLDIR int igraph_adjedgelist_print(const igraph_inclist_t *il, FILE *outfile);
/**
* \define igraph_adjedgelist_get
@@ -213,10 +207,10 @@ int igraph_adjedgelist_print(const igraph_inclist_t *il, FILE *outfile);
typedef igraph_lazy_inclist_t igraph_lazy_adjedgelist_t;
-int igraph_lazy_adjedgelist_init(const igraph_t *graph,
- igraph_lazy_inclist_t *il,
- igraph_neimode_t mode);
-void igraph_lazy_adjedgelist_destroy(igraph_lazy_inclist_t *il);
+DECLDIR int igraph_lazy_adjedgelist_init(const igraph_t *graph,
+ igraph_lazy_inclist_t *il,
+ igraph_neimode_t mode);
+DECLDIR void igraph_lazy_adjedgelist_destroy(igraph_lazy_inclist_t *il);
/**
* \define igraph_lazy_adjedgelist_get
@@ -231,8 +225,8 @@ void igraph_lazy_adjedgelist_destroy(igraph_lazy_inclist_t *il);
#define igraph_lazy_adjedgelist_get(al,no) \
((al)->incs[(long int)(no)] != 0 ? ((al)->incs[(long int)(no)]) : \
(igraph_lazy_adjedgelist_get_real(al, no)))
-igraph_vector_t *igraph_lazy_adjedgelist_get_real(igraph_lazy_inclist_t *al,
- igraph_integer_t no);
+DECLDIR igraph_vector_t *igraph_lazy_adjedgelist_get_real(igraph_lazy_inclist_t *al,
+ igraph_integer_t no);
__END_DECLS
#endif
diff --git a/src/include/igraph_arpack.h b/src/include/igraph_arpack.h
index b165665..b31707d 100644
--- a/src/include/igraph_arpack.h
+++ b/src/include/igraph_arpack.h
@@ -28,15 +28,7 @@
#ifndef ARPACK_H
#define ARPACK_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -297,11 +289,11 @@ typedef struct igraph_arpack_storage_t {
igraph_real_t *workev;
} igraph_arpack_storage_t;
-void igraph_arpack_options_init(igraph_arpack_options_t *o);
+DECLDIR void igraph_arpack_options_init(igraph_arpack_options_t *o);
-int igraph_arpack_storage_init(igraph_arpack_storage_t *s, long int maxn,
- long int maxncv, long int maxldv, igraph_bool_t symm);
-void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s);
+DECLDIR int igraph_arpack_storage_init(igraph_arpack_storage_t *s, long int maxn,
+ long int maxncv, long int maxldv, igraph_bool_t symm);
+DECLDIR void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s);
/**
* \typedef igraph_arpack_function_t
@@ -323,18 +315,18 @@ void igraph_arpack_storage_destroy(igraph_arpack_storage_t *s);
typedef int igraph_arpack_function_t(igraph_real_t *to, const igraph_real_t *from,
int n, void *extra);
-int igraph_arpack_rssolve(igraph_arpack_function_t *fun, void *extra,
- igraph_arpack_options_t *options,
- igraph_arpack_storage_t *storage,
- igraph_vector_t *values, igraph_matrix_t *vectors);
+DECLDIR int igraph_arpack_rssolve(igraph_arpack_function_t *fun, void *extra,
+ igraph_arpack_options_t *options,
+ igraph_arpack_storage_t *storage,
+ igraph_vector_t *values, igraph_matrix_t *vectors);
-int igraph_arpack_rnsolve(igraph_arpack_function_t *fun, void *extra,
- igraph_arpack_options_t *options,
- igraph_arpack_storage_t *storage,
- igraph_matrix_t *values, igraph_matrix_t *vectors);
+DECLDIR int igraph_arpack_rnsolve(igraph_arpack_function_t *fun, void *extra,
+ igraph_arpack_options_t *options,
+ igraph_arpack_storage_t *storage,
+ igraph_matrix_t *values, igraph_matrix_t *vectors);
-int igraph_arpack_unpack_complex(igraph_matrix_t *vectors, igraph_matrix_t *values,
- long int nev);
+DECLDIR int igraph_arpack_unpack_complex(igraph_matrix_t *vectors, igraph_matrix_t *values,
+ long int nev);
__END_DECLS
diff --git a/src/include/igraph_array.h b/src/include/igraph_array.h
index 4b8a47e..de9b470 100644
--- a/src/include/igraph_array.h
+++ b/src/include/igraph_array.h
@@ -24,15 +24,7 @@
#ifndef IGRAPH_ARRAY_H
#define IGRAPH_ARRAY_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
diff --git a/src/include/igraph_attributes.h b/src/include/igraph_attributes.h
index 003bc56..c8cad20 100644
--- a/src/include/igraph_attributes.h
+++ b/src/include/igraph_attributes.h
@@ -24,16 +24,7 @@
#ifndef REST_ATTRIBUTES_H
#define REST_ATTRIBUTES_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_datatype.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -139,10 +130,12 @@ typedef enum {
IGRAPH_ATTRIBUTE_COMBINE_MEDIAN=11,
IGRAPH_ATTRIBUTE_COMBINE_CONCAT=12 } igraph_attribute_combination_type_t;
+typedef void (*igraph_function_pointer_t)(void);
+
typedef struct igraph_attribute_combination_record_t {
const char *name; /* can be NULL, meaning: the rest */
igraph_attribute_combination_type_t type;
- void *func;
+ igraph_function_pointer_t func;
} igraph_attribute_combination_record_t;
typedef struct igraph_attribute_combination_t {
@@ -151,19 +144,19 @@ typedef struct igraph_attribute_combination_t {
#define IGRAPH_NO_MORE_ATTRIBUTES ((const char*)0)
-int igraph_attribute_combination_init(igraph_attribute_combination_t *comb);
-int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...);
-void igraph_attribute_combination_destroy(igraph_attribute_combination_t *comb);
-int igraph_attribute_combination_add(igraph_attribute_combination_t *comb,
- const char *name,
- igraph_attribute_combination_type_t type,
- void *func);
-int igraph_attribute_combination_remove(igraph_attribute_combination_t *comb,
- const char *name);
-int igraph_attribute_combination_query(const igraph_attribute_combination_t *comb,
- const char *name,
- igraph_attribute_combination_type_t *type,
- void **func);
+DECLDIR int igraph_attribute_combination_init(igraph_attribute_combination_t *comb);
+DECLDIR int igraph_attribute_combination(igraph_attribute_combination_t *comb, ...);
+DECLDIR void igraph_attribute_combination_destroy(igraph_attribute_combination_t *comb);
+DECLDIR int igraph_attribute_combination_add(igraph_attribute_combination_t *comb,
+ const char *name,
+ igraph_attribute_combination_type_t type,
+ igraph_function_pointer_t func);
+DECLDIR int igraph_attribute_combination_remove(igraph_attribute_combination_t *comb,
+ const char *name);
+DECLDIR int igraph_attribute_combination_query(const igraph_attribute_combination_t *comb,
+ const char *name,
+ igraph_attribute_combination_type_t *type,
+ igraph_function_pointer_t *func);
/**
* \struct igraph_attribute_table_t
@@ -298,10 +291,9 @@ typedef struct igraph_attribute_table_t {
igraph_vector_bool_t *value);
} igraph_attribute_table_t;
-igraph_attribute_table_t *
-igraph_i_set_attribute_table(const igraph_attribute_table_t * table);
+DECLDIR igraph_attribute_table_t * igraph_i_set_attribute_table(const igraph_attribute_table_t * table);
-igraph_bool_t igraph_has_attribute_table(void);
+DECLDIR igraph_bool_t igraph_has_attribute_table(void);
#define IGRAPH_I_ATTRIBUTE_DESTROY(graph) \
do {if ((graph)->attr) igraph_i_attribute_destroy(graph);} while(0)
@@ -392,80 +384,80 @@ int igraph_i_attribute_get_bool_edge_attr(const igraph_t *graph,
extern const igraph_attribute_table_t igraph_cattribute_table;
-igraph_real_t igraph_cattribute_GAN(const igraph_t *graph, const char *name);
-igraph_bool_t igraph_cattribute_GAB(const igraph_t *graph, const char *name);
-const char* igraph_cattribute_GAS(const igraph_t *graph, const char *name);
-igraph_real_t igraph_cattribute_VAN(const igraph_t *graph, const char *name,
- igraph_integer_t vid);
-igraph_bool_t igraph_cattribute_VAB(const igraph_t *graph, const char *name,
- igraph_integer_t vid);
-const char* igraph_cattribute_VAS(const igraph_t *graph, const char *name,
- igraph_integer_t vid);
-igraph_real_t igraph_cattribute_EAN(const igraph_t *graph, const char *name,
- igraph_integer_t eid);
-igraph_bool_t igraph_cattribute_EAB(const igraph_t *graph, const char *name,
- igraph_integer_t eid);
-const char* igraph_cattribute_EAS(const igraph_t *graph, const char *name,
- igraph_integer_t eid);
-
-int igraph_cattribute_VANV(const igraph_t *graph, const char *name,
- igraph_vs_t vids, igraph_vector_t *result);
-int igraph_cattribute_EANV(const igraph_t *graph, const char *name,
- igraph_es_t eids, igraph_vector_t *result);
-int igraph_cattribute_VASV(const igraph_t *graph, const char *name,
- igraph_vs_t vids, igraph_strvector_t *result);
-int igraph_cattribute_EASV(const igraph_t *graph, const char *name,
- igraph_es_t eids, igraph_strvector_t *result);
-int igraph_cattribute_VABV(const igraph_t *graph, const char *name,
- igraph_vs_t vids, igraph_vector_bool_t *result);
-int igraph_cattribute_EABV(const igraph_t *graph, const char *name,
- igraph_es_t eids, igraph_vector_bool_t *result);
-
-int igraph_cattribute_list(const igraph_t *graph,
- igraph_strvector_t *gnames, igraph_vector_t *gtypes,
- igraph_strvector_t *vnames, igraph_vector_t *vtypes,
- igraph_strvector_t *enames, igraph_vector_t *etypes);
-igraph_bool_t igraph_cattribute_has_attr(const igraph_t *graph,
- igraph_attribute_elemtype_t type,
- const char *name);
-
-int igraph_cattribute_GAN_set(igraph_t *graph, const char *name,
- igraph_real_t value);
-int igraph_cattribute_GAB_set(igraph_t *graph, const char *name,
- igraph_bool_t value);
-int igraph_cattribute_GAS_set(igraph_t *graph, const char *name,
- const char *value);
-int igraph_cattribute_VAN_set(igraph_t *graph, const char *name,
- igraph_integer_t vid, igraph_real_t value);
-int igraph_cattribute_VAB_set(igraph_t *graph, const char *name,
- igraph_integer_t vid, igraph_bool_t value);
-int igraph_cattribute_VAS_set(igraph_t *graph, const char *name,
- igraph_integer_t vid, const char *value);
-int igraph_cattribute_EAN_set(igraph_t *graph, const char *name,
- igraph_integer_t eid, igraph_real_t value);
-int igraph_cattribute_EAB_set(igraph_t *graph, const char *name,
- igraph_integer_t eid, igraph_bool_t value);
-int igraph_cattribute_EAS_set(igraph_t *graph, const char *name,
- igraph_integer_t eid, const char *value);
-
-int igraph_cattribute_VAN_setv(igraph_t *graph, const char *name,
- const igraph_vector_t *v);
-int igraph_cattribute_VAB_setv(igraph_t *graph, const char *name,
- const igraph_vector_bool_t *v);
-int igraph_cattribute_VAS_setv(igraph_t *graph, const char *name,
- const igraph_strvector_t *sv);
-int igraph_cattribute_EAN_setv(igraph_t *graph, const char *name,
- const igraph_vector_t *v);
-int igraph_cattribute_EAB_setv(igraph_t *graph, const char *name,
- const igraph_vector_bool_t *v);
-int igraph_cattribute_EAS_setv(igraph_t *graph, const char *name,
- const igraph_strvector_t *sv);
-
-void igraph_cattribute_remove_g(igraph_t *graph, const char *name);
-void igraph_cattribute_remove_v(igraph_t *graph, const char *name);
-void igraph_cattribute_remove_e(igraph_t *graph, const char *name);
-void igraph_cattribute_remove_all(igraph_t *graph, igraph_bool_t g,
- igraph_bool_t v, igraph_bool_t e);
+DECLDIR igraph_real_t igraph_cattribute_GAN(const igraph_t *graph, const char *name);
+DECLDIR igraph_bool_t igraph_cattribute_GAB(const igraph_t *graph, const char *name);
+DECLDIR const char* igraph_cattribute_GAS(const igraph_t *graph, const char *name);
+DECLDIR igraph_real_t igraph_cattribute_VAN(const igraph_t *graph, const char *name,
+ igraph_integer_t vid);
+DECLDIR igraph_bool_t igraph_cattribute_VAB(const igraph_t *graph, const char *name,
+ igraph_integer_t vid);
+DECLDIR const char* igraph_cattribute_VAS(const igraph_t *graph, const char *name,
+ igraph_integer_t vid);
+DECLDIR igraph_real_t igraph_cattribute_EAN(const igraph_t *graph, const char *name,
+ igraph_integer_t eid);
+DECLDIR igraph_bool_t igraph_cattribute_EAB(const igraph_t *graph, const char *name,
+ igraph_integer_t eid);
+DECLDIR const char* igraph_cattribute_EAS(const igraph_t *graph, const char *name,
+ igraph_integer_t eid);
+
+DECLDIR int igraph_cattribute_VANV(const igraph_t *graph, const char *name,
+ igraph_vs_t vids, igraph_vector_t *result);
+DECLDIR int igraph_cattribute_EANV(const igraph_t *graph, const char *name,
+ igraph_es_t eids, igraph_vector_t *result);
+DECLDIR int igraph_cattribute_VASV(const igraph_t *graph, const char *name,
+ igraph_vs_t vids, igraph_strvector_t *result);
+DECLDIR int igraph_cattribute_EASV(const igraph_t *graph, const char *name,
+ igraph_es_t eids, igraph_strvector_t *result);
+DECLDIR int igraph_cattribute_VABV(const igraph_t *graph, const char *name,
+ igraph_vs_t vids, igraph_vector_bool_t *result);
+DECLDIR int igraph_cattribute_EABV(const igraph_t *graph, const char *name,
+ igraph_es_t eids, igraph_vector_bool_t *result);
+
+DECLDIR int igraph_cattribute_list(const igraph_t *graph,
+ igraph_strvector_t *gnames, igraph_vector_t *gtypes,
+ igraph_strvector_t *vnames, igraph_vector_t *vtypes,
+ igraph_strvector_t *enames, igraph_vector_t *etypes);
+DECLDIR igraph_bool_t igraph_cattribute_has_attr(const igraph_t *graph,
+ igraph_attribute_elemtype_t type,
+ const char *name);
+
+DECLDIR int igraph_cattribute_GAN_set(igraph_t *graph, const char *name,
+ igraph_real_t value);
+DECLDIR int igraph_cattribute_GAB_set(igraph_t *graph, const char *name,
+ igraph_bool_t value);
+DECLDIR int igraph_cattribute_GAS_set(igraph_t *graph, const char *name,
+ const char *value);
+DECLDIR int igraph_cattribute_VAN_set(igraph_t *graph, const char *name,
+ igraph_integer_t vid, igraph_real_t value);
+DECLDIR int igraph_cattribute_VAB_set(igraph_t *graph, const char *name,
+ igraph_integer_t vid, igraph_bool_t value);
+DECLDIR int igraph_cattribute_VAS_set(igraph_t *graph, const char *name,
+ igraph_integer_t vid, const char *value);
+DECLDIR int igraph_cattribute_EAN_set(igraph_t *graph, const char *name,
+ igraph_integer_t eid, igraph_real_t value);
+DECLDIR int igraph_cattribute_EAB_set(igraph_t *graph, const char *name,
+ igraph_integer_t eid, igraph_bool_t value);
+DECLDIR int igraph_cattribute_EAS_set(igraph_t *graph, const char *name,
+ igraph_integer_t eid, const char *value);
+
+DECLDIR int igraph_cattribute_VAN_setv(igraph_t *graph, const char *name,
+ const igraph_vector_t *v);
+DECLDIR int igraph_cattribute_VAB_setv(igraph_t *graph, const char *name,
+ const igraph_vector_bool_t *v);
+DECLDIR int igraph_cattribute_VAS_setv(igraph_t *graph, const char *name,
+ const igraph_strvector_t *sv);
+DECLDIR int igraph_cattribute_EAN_setv(igraph_t *graph, const char *name,
+ const igraph_vector_t *v);
+DECLDIR int igraph_cattribute_EAB_setv(igraph_t *graph, const char *name,
+ const igraph_vector_bool_t *v);
+DECLDIR int igraph_cattribute_EAS_setv(igraph_t *graph, const char *name,
+ const igraph_strvector_t *sv);
+
+DECLDIR void igraph_cattribute_remove_g(igraph_t *graph, const char *name);
+DECLDIR void igraph_cattribute_remove_v(igraph_t *graph, const char *name);
+DECLDIR void igraph_cattribute_remove_e(igraph_t *graph, const char *name);
+DECLDIR void igraph_cattribute_remove_all(igraph_t *graph, igraph_bool_t g,
+ igraph_bool_t v, igraph_bool_t e);
/**
* \define GAN
diff --git a/src/include/igraph_bipartite.h b/src/include/igraph_bipartite.h
index 69c2d48..19e50c5 100644
--- a/src/include/igraph_bipartite.h
+++ b/src/include/igraph_bipartite.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_BIPARTITE_H
#define IGRAPH_BIPARTITE_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -46,60 +37,60 @@ __BEGIN_DECLS
/* Bipartite networks */
/* -------------------------------------------------- */
-int igraph_full_bipartite(igraph_t *graph,
- igraph_vector_bool_t *types,
- igraph_integer_t n1, igraph_integer_t n2,
- igraph_bool_t directed,
- igraph_neimode_t mode);
-
-int igraph_create_bipartite(igraph_t *g, const igraph_vector_bool_t *types,
- const igraph_vector_t *edges,
- igraph_bool_t directed);
-
-int igraph_bipartite_projection_size(const igraph_t *graph,
- const igraph_vector_bool_t *types,
- igraph_integer_t *vcount1,
- igraph_integer_t *ecount1,
- igraph_integer_t *vcount2,
- igraph_integer_t *ecount2);
-
-int igraph_bipartite_projection(const igraph_t *graph,
- const igraph_vector_bool_t *types,
- igraph_t *proj1,
- igraph_t *proj2,
- igraph_vector_t *multiplicity1,
- igraph_vector_t *multiplicity2,
- igraph_integer_t probe1);
-
-int igraph_incidence(igraph_t *graph, igraph_vector_bool_t *types,
- const igraph_matrix_t *incidence, igraph_bool_t directed,
- igraph_neimode_t mode, igraph_bool_t multiple);
-
-int igraph_get_incidence(const igraph_t *graph,
- const igraph_vector_bool_t *types,
- igraph_matrix_t *res,
- igraph_vector_t *row_ids,
- igraph_vector_t *col_ids);
-
-int igraph_is_bipartite(const igraph_t *graph,
- igraph_bool_t *res,
- igraph_vector_bool_t *type);
-
-int igraph_bipartite_game(igraph_t *graph, igraph_vector_bool_t *types,
- igraph_erdos_renyi_t type,
- igraph_integer_t n1, igraph_integer_t n2,
- igraph_real_t p, igraph_integer_t m,
- igraph_bool_t directed, igraph_neimode_t mode);
-
-int igraph_bipartite_game_gnp(igraph_t *graph, igraph_vector_bool_t *types,
- igraph_integer_t n1, igraph_integer_t n2,
- igraph_real_t p, igraph_bool_t directed,
- igraph_neimode_t mode);
-
-int igraph_bipartite_game_gnm(igraph_t *graph, igraph_vector_bool_t *types,
- igraph_integer_t n1, igraph_integer_t n2,
- igraph_integer_t m, igraph_bool_t directed,
- igraph_neimode_t mode);
+DECLDIR int igraph_full_bipartite(igraph_t *graph,
+ igraph_vector_bool_t *types,
+ igraph_integer_t n1, igraph_integer_t n2,
+ igraph_bool_t directed,
+ igraph_neimode_t mode);
+
+DECLDIR int igraph_create_bipartite(igraph_t *g, const igraph_vector_bool_t *types,
+ const igraph_vector_t *edges,
+ igraph_bool_t directed);
+
+DECLDIR int igraph_bipartite_projection_size(const igraph_t *graph,
+ const igraph_vector_bool_t *types,
+ igraph_integer_t *vcount1,
+ igraph_integer_t *ecount1,
+ igraph_integer_t *vcount2,
+ igraph_integer_t *ecount2);
+
+DECLDIR int igraph_bipartite_projection(const igraph_t *graph,
+ const igraph_vector_bool_t *types,
+ igraph_t *proj1,
+ igraph_t *proj2,
+ igraph_vector_t *multiplicity1,
+ igraph_vector_t *multiplicity2,
+ igraph_integer_t probe1);
+
+DECLDIR int igraph_incidence(igraph_t *graph, igraph_vector_bool_t *types,
+ const igraph_matrix_t *incidence, igraph_bool_t directed,
+ igraph_neimode_t mode, igraph_bool_t multiple);
+
+DECLDIR int igraph_get_incidence(const igraph_t *graph,
+ const igraph_vector_bool_t *types,
+ igraph_matrix_t *res,
+ igraph_vector_t *row_ids,
+ igraph_vector_t *col_ids);
+
+DECLDIR int igraph_is_bipartite(const igraph_t *graph,
+ igraph_bool_t *res,
+ igraph_vector_bool_t *type);
+
+DECLDIR int igraph_bipartite_game(igraph_t *graph, igraph_vector_bool_t *types,
+ igraph_erdos_renyi_t type,
+ igraph_integer_t n1, igraph_integer_t n2,
+ igraph_real_t p, igraph_integer_t m,
+ igraph_bool_t directed, igraph_neimode_t mode);
+
+DECLDIR int igraph_bipartite_game_gnp(igraph_t *graph, igraph_vector_bool_t *types,
+ igraph_integer_t n1, igraph_integer_t n2,
+ igraph_real_t p, igraph_bool_t directed,
+ igraph_neimode_t mode);
+
+DECLDIR int igraph_bipartite_game_gnm(igraph_t *graph, igraph_vector_bool_t *types,
+ igraph_integer_t n1, igraph_integer_t n2,
+ igraph_integer_t m, igraph_bool_t directed,
+ igraph_neimode_t mode);
__END_DECLS
diff --git a/src/include/igraph_blas.h b/src/include/igraph_blas.h
index 102a6d1..b6c41ca 100644
--- a/src/include/igraph_blas.h
+++ b/src/include/igraph_blas.h
@@ -27,16 +27,7 @@
#include "igraph_types.h"
#include "igraph_vector.h"
#include "igraph_matrix.h"
-
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -60,14 +51,14 @@ __BEGIN_DECLS
* </para>
*/
-void igraph_blas_dgemv(igraph_bool_t transpose, igraph_real_t alpha,
- const igraph_matrix_t* a, const igraph_vector_t* x,
- igraph_real_t beta, igraph_vector_t* y);
-void igraph_blas_dgemv_array(igraph_bool_t transpose, igraph_real_t alpha,
- const igraph_matrix_t* a, const igraph_real_t* x,
- igraph_real_t beta, igraph_real_t* y);
+DECLDIR void igraph_blas_dgemv(igraph_bool_t transpose, igraph_real_t alpha,
+ const igraph_matrix_t* a, const igraph_vector_t* x,
+ igraph_real_t beta, igraph_vector_t* y);
+DECLDIR void igraph_blas_dgemv_array(igraph_bool_t transpose, igraph_real_t alpha,
+ const igraph_matrix_t* a, const igraph_real_t* x,
+ igraph_real_t beta, igraph_real_t* y);
-igraph_real_t igraph_blas_dnrm2(const igraph_vector_t *v);
+DECLDIR igraph_real_t igraph_blas_dnrm2(const igraph_vector_t *v);
__END_DECLS
diff --git a/src/include/igraph_centrality.h b/src/include/igraph_centrality.h
index bd2d88b..1086822 100644
--- a/src/include/igraph_centrality.h
+++ b/src/include/igraph_centrality.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_CENTRALITY_H
#define IGRAPH_CENTRALITY_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
@@ -46,33 +37,33 @@ __BEGIN_DECLS
/* Centrality */
/* -------------------------------------------------- */
-int igraph_closeness(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_neimode_t mode,
- const igraph_vector_t *weights, igraph_bool_t normalized);
-int igraph_closeness_estimate(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_neimode_t mode,
- igraph_real_t cutoff,
- const igraph_vector_t *weights,
- igraph_bool_t normalized);
-
-int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_bool_t directed,
- const igraph_vector_t *weights, igraph_bool_t nobigint);
-int igraph_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_bool_t directed,
- igraph_real_t cutoff,
- const igraph_vector_t *weights,
- igraph_bool_t nobigint);
-int igraph_edge_betweenness(const igraph_t *graph, igraph_vector_t *result,
- igraph_bool_t directed,
- const igraph_vector_t *weigths);
-int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *result,
- igraph_bool_t directed, igraph_real_t cutoff,
- const igraph_vector_t *weights);
-int igraph_pagerank_old(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_bool_t directed,
- igraph_integer_t niter, igraph_real_t eps,
- igraph_real_t damping, igraph_bool_t old);
+DECLDIR int igraph_closeness(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_neimode_t mode,
+ const igraph_vector_t *weights, igraph_bool_t normalized);
+DECLDIR int igraph_closeness_estimate(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_neimode_t mode,
+ igraph_real_t cutoff,
+ const igraph_vector_t *weights,
+ igraph_bool_t normalized);
+
+DECLDIR int igraph_betweenness(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_bool_t directed,
+ const igraph_vector_t *weights, igraph_bool_t nobigint);
+DECLDIR int igraph_betweenness_estimate(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_bool_t directed,
+ igraph_real_t cutoff,
+ const igraph_vector_t *weights,
+ igraph_bool_t nobigint);
+DECLDIR int igraph_edge_betweenness(const igraph_t *graph, igraph_vector_t *result,
+ igraph_bool_t directed,
+ const igraph_vector_t *weigths);
+DECLDIR int igraph_edge_betweenness_estimate(const igraph_t *graph, igraph_vector_t *result,
+ igraph_bool_t directed, igraph_real_t cutoff,
+ const igraph_vector_t *weights);
+DECLDIR int igraph_pagerank_old(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_bool_t directed,
+ igraph_integer_t niter, igraph_real_t eps,
+ igraph_real_t damping, igraph_bool_t old);
/**
* \typedef igraph_pagerank_algo_t
@@ -109,112 +100,112 @@ typedef struct igraph_pagerank_power_options_t {
igraph_real_t eps;
} igraph_pagerank_power_options_t;
-int igraph_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo,
- igraph_vector_t *vector,
- igraph_real_t *value, const igraph_vs_t vids,
- igraph_bool_t directed, igraph_real_t damping,
- const igraph_vector_t *weights, void *options);
-int igraph_personalized_pagerank(const igraph_t *graph,
- igraph_pagerank_algo_t algo, igraph_vector_t *vector,
- igraph_real_t *value, const igraph_vs_t vids,
- igraph_bool_t directed, igraph_real_t damping,
- igraph_vector_t *reset,
- const igraph_vector_t *weights, void *options);
-int igraph_personalized_pagerank_vs(const igraph_t *graph,
- igraph_pagerank_algo_t algo,
- igraph_vector_t *vector,
- igraph_real_t *value, const igraph_vs_t vids,
- igraph_bool_t directed, igraph_real_t damping,
- igraph_vs_t reset_vids,
- const igraph_vector_t *weights, void *options);
-
-int igraph_eigenvector_centrality(const igraph_t *graph, igraph_vector_t *vector,
- igraph_real_t *value,
- igraph_bool_t directed, igraph_bool_t scale,
- const igraph_vector_t *weights,
- igraph_arpack_options_t *options);
-
-int igraph_hub_score(const igraph_t *graph, igraph_vector_t *vector,
- igraph_real_t *value, igraph_bool_t scale,
- const igraph_vector_t *weights,
- igraph_arpack_options_t *options);
-int igraph_authority_score(const igraph_t *graph, igraph_vector_t *vector,
- igraph_real_t *value, igraph_bool_t scale,
- const igraph_vector_t *weights,
- igraph_arpack_options_t *options);
-
-int igraph_constraint(const igraph_t *graph, igraph_vector_t *res,
- igraph_vs_t vids, const igraph_vector_t *weights);
-
-int igraph_strength(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_neimode_t mode,
- igraph_bool_t loops, const igraph_vector_t *weights);
-
-int igraph_convergence_degree(const igraph_t *graph, igraph_vector_t *result,
- igraph_vector_t *ins, igraph_vector_t *outs);
-
-int igraph_sort_vertex_ids_by_degree(const igraph_t *graph,
- igraph_vector_t *outvids,
- igraph_vs_t vids,
- igraph_neimode_t mode,
- igraph_bool_t loops,
- igraph_order_t order,
- igraph_bool_t only_indices);
-
-igraph_real_t igraph_centralization(const igraph_vector_t *scores,
- igraph_real_t theoretical_max,
- igraph_bool_t normalized);
-
-int igraph_centralization_degree(const igraph_t *graph, igraph_vector_t *res,
- igraph_neimode_t mode, igraph_bool_t loops,
- igraph_real_t *centralization,
- igraph_real_t *theoretical_max,
- igraph_bool_t normalized);
-int igraph_centralization_degree_tmax(const igraph_t *graph,
- igraph_integer_t nodes,
- igraph_neimode_t mode,
- igraph_bool_t loops,
- igraph_real_t *res);
-
-int igraph_centralization_betweenness(const igraph_t *graph,
- igraph_vector_t *res,
- igraph_bool_t directed,
- igraph_bool_t nobigint,
- igraph_real_t *centralization,
- igraph_real_t *theoretical_max,
- igraph_bool_t normalized);
-int igraph_centralization_betweenness_tmax(const igraph_t *graph,
- igraph_integer_t nodes,
- igraph_bool_t directed,
- igraph_real_t *res);
-
-int igraph_centralization_closeness(const igraph_t *graph,
- igraph_vector_t *res,
- igraph_neimode_t mode,
- igraph_real_t *centralization,
- igraph_real_t *theoretical_max,
- igraph_bool_t normalized);
-int igraph_centralization_closeness_tmax(const igraph_t *graph,
- igraph_integer_t nodes,
- igraph_neimode_t mode,
- igraph_real_t *res);
-
-int igraph_centralization_eigenvector_centrality(
- const igraph_t *graph,
- igraph_vector_t *vector,
- igraph_real_t *value,
- igraph_bool_t directed,
- igraph_bool_t scale,
- igraph_arpack_options_t *options,
- igraph_real_t *centralization,
- igraph_real_t *theoretical_max,
- igraph_bool_t normalized);
-int igraph_centralization_eigenvector_centrality_tmax(
- const igraph_t *graph,
- igraph_integer_t nodes,
- igraph_bool_t directed,
- igraph_bool_t scale,
- igraph_real_t *res);
+DECLDIR int igraph_pagerank(const igraph_t *graph, igraph_pagerank_algo_t algo,
+ igraph_vector_t *vector,
+ igraph_real_t *value, const igraph_vs_t vids,
+ igraph_bool_t directed, igraph_real_t damping,
+ const igraph_vector_t *weights, void *options);
+DECLDIR int igraph_personalized_pagerank(const igraph_t *graph,
+ igraph_pagerank_algo_t algo, igraph_vector_t *vector,
+ igraph_real_t *value, const igraph_vs_t vids,
+ igraph_bool_t directed, igraph_real_t damping,
+ igraph_vector_t *reset,
+ const igraph_vector_t *weights, void *options);
+DECLDIR int igraph_personalized_pagerank_vs(const igraph_t *graph,
+ igraph_pagerank_algo_t algo,
+ igraph_vector_t *vector,
+ igraph_real_t *value, const igraph_vs_t vids,
+ igraph_bool_t directed, igraph_real_t damping,
+ igraph_vs_t reset_vids,
+ const igraph_vector_t *weights, void *options);
+
+DECLDIR int igraph_eigenvector_centrality(const igraph_t *graph, igraph_vector_t *vector,
+ igraph_real_t *value,
+ igraph_bool_t directed, igraph_bool_t scale,
+ const igraph_vector_t *weights,
+ igraph_arpack_options_t *options);
+
+DECLDIR int igraph_hub_score(const igraph_t *graph, igraph_vector_t *vector,
+ igraph_real_t *value, igraph_bool_t scale,
+ const igraph_vector_t *weights,
+ igraph_arpack_options_t *options);
+DECLDIR int igraph_authority_score(const igraph_t *graph, igraph_vector_t *vector,
+ igraph_real_t *value, igraph_bool_t scale,
+ const igraph_vector_t *weights,
+ igraph_arpack_options_t *options);
+
+DECLDIR int igraph_constraint(const igraph_t *graph, igraph_vector_t *res,
+ igraph_vs_t vids, const igraph_vector_t *weights);
+
+DECLDIR int igraph_strength(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_neimode_t mode,
+ igraph_bool_t loops, const igraph_vector_t *weights);
+
+DECLDIR int igraph_convergence_degree(const igraph_t *graph, igraph_vector_t *result,
+ igraph_vector_t *ins, igraph_vector_t *outs);
+
+DECLDIR int igraph_sort_vertex_ids_by_degree(const igraph_t *graph,
+ igraph_vector_t *outvids,
+ igraph_vs_t vids,
+ igraph_neimode_t mode,
+ igraph_bool_t loops,
+ igraph_order_t order,
+ igraph_bool_t only_indices);
+
+DECLDIR igraph_real_t igraph_centralization(const igraph_vector_t *scores,
+ igraph_real_t theoretical_max,
+ igraph_bool_t normalized);
+
+DECLDIR int igraph_centralization_degree(const igraph_t *graph, igraph_vector_t *res,
+ igraph_neimode_t mode, igraph_bool_t loops,
+ igraph_real_t *centralization,
+ igraph_real_t *theoretical_max,
+ igraph_bool_t normalized);
+DECLDIR int igraph_centralization_degree_tmax(const igraph_t *graph,
+ igraph_integer_t nodes,
+ igraph_neimode_t mode,
+ igraph_bool_t loops,
+ igraph_real_t *res);
+
+DECLDIR int igraph_centralization_betweenness(const igraph_t *graph,
+ igraph_vector_t *res,
+ igraph_bool_t directed,
+ igraph_bool_t nobigint,
+ igraph_real_t *centralization,
+ igraph_real_t *theoretical_max,
+ igraph_bool_t normalized);
+DECLDIR int igraph_centralization_betweenness_tmax(const igraph_t *graph,
+ igraph_integer_t nodes,
+ igraph_bool_t directed,
+ igraph_real_t *res);
+
+DECLDIR int igraph_centralization_closeness(const igraph_t *graph,
+ igraph_vector_t *res,
+ igraph_neimode_t mode,
+ igraph_real_t *centralization,
+ igraph_real_t *theoretical_max,
+ igraph_bool_t normalized);
+DECLDIR int igraph_centralization_closeness_tmax(const igraph_t *graph,
+ igraph_integer_t nodes,
+ igraph_neimode_t mode,
+ igraph_real_t *res);
+
+DECLDIR int igraph_centralization_eigenvector_centrality(
+ const igraph_t *graph,
+ igraph_vector_t *vector,
+ igraph_real_t *value,
+ igraph_bool_t directed,
+ igraph_bool_t scale,
+ igraph_arpack_options_t *options,
+ igraph_real_t *centralization,
+ igraph_real_t *theoretical_max,
+ igraph_bool_t normalized);
+DECLDIR int igraph_centralization_eigenvector_centrality_tmax(
+ const igraph_t *graph,
+ igraph_integer_t nodes,
+ igraph_bool_t directed,
+ igraph_bool_t scale,
+ igraph_real_t *res);
__END_DECLS
diff --git a/src/include/igraph_cliques.h b/src/include/igraph_cliques.h
index eaffc7e..9d2a0d6 100644
--- a/src/include/igraph_cliques.h
+++ b/src/include/igraph_cliques.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_CLIQUES_H
#define IGRAPH_CLIQUES_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
#include "igraph_vector_ptr.h"
@@ -44,38 +35,69 @@ __BEGIN_DECLS
/* Cliques, maximal independent vertex sets */
/* -------------------------------------------------- */
-int igraph_maximal_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
- igraph_integer_t min_size, igraph_integer_t max_size);
-int igraph_maximal_cliques_file(const igraph_t *graph,
- FILE *outfile,
- igraph_integer_t min_size,
- igraph_integer_t max_size);
-int igraph_maximal_cliques_count(const igraph_t *graph,
- igraph_integer_t *res,
- igraph_integer_t min_size,
- igraph_integer_t max_size);
-int igraph_maximal_cliques_subset(const igraph_t *graph,
- igraph_vector_int_t *subset,
- igraph_vector_ptr_t *res,
- igraph_integer_t *no,
- FILE *outfile,
- igraph_integer_t min_size,
- igraph_integer_t max_size);
+DECLDIR int igraph_maximal_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
+ igraph_integer_t min_size, igraph_integer_t max_size);
+DECLDIR int igraph_maximal_cliques_file(const igraph_t *graph,
+ FILE *outfile,
+ igraph_integer_t min_size,
+ igraph_integer_t max_size);
+DECLDIR int igraph_maximal_cliques_count(const igraph_t *graph,
+ igraph_integer_t *res,
+ igraph_integer_t min_size,
+ igraph_integer_t max_size);
+DECLDIR int igraph_maximal_cliques_subset(const igraph_t *graph,
+ igraph_vector_int_t *subset,
+ igraph_vector_ptr_t *res,
+ igraph_integer_t *no,
+ FILE *outfile,
+ igraph_integer_t min_size,
+ igraph_integer_t max_size);
+
+DECLDIR int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
+ igraph_integer_t min_size, igraph_integer_t max_size);
+DECLDIR int igraph_clique_size_hist(const igraph_t *graph, igraph_vector_t *hist,
+ igraph_integer_t min_size, igraph_integer_t max_size);
+DECLDIR int igraph_largest_cliques(const igraph_t *graph,
+ igraph_vector_ptr_t *cliques);
+DECLDIR int igraph_clique_number(const igraph_t *graph, igraph_integer_t *no);
+DECLDIR int igraph_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res,
+ igraph_real_t min_weight, igraph_real_t max_weight, igraph_bool_t maximal);
+DECLDIR int igraph_largest_weighted_cliques(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_vector_ptr_t *res);
+DECLDIR int igraph_weighted_clique_number(const igraph_t *graph,
+ const igraph_vector_t *vertex_weights, igraph_real_t *res);
+DECLDIR int igraph_independent_vertex_sets(const igraph_t *graph,
+ igraph_vector_ptr_t *res,
+ igraph_integer_t min_size,
+ igraph_integer_t max_size);
+DECLDIR int igraph_largest_independent_vertex_sets(const igraph_t *graph,
+ igraph_vector_ptr_t *res);
+DECLDIR int igraph_maximal_independent_vertex_sets(const igraph_t *graph,
+ igraph_vector_ptr_t *res);
+DECLDIR int igraph_independence_number(const igraph_t *graph, igraph_integer_t *no);
+
+/**
+ * \typedef igraph_clique_handler_t
+ * \brief Type of clique handler functions
+ *
+ * Callback type, called when a clique was found.
+ *
+ * See the details at the documentation of \ref
+ * igraph_cliques_callback().
+ *
+ * \param clique The current clique. Destroying and freeing
+ * this vector is left to the user.
+ * \param arg This extra argument was passed to \ref
+ * igraph_cliques_callback() when it was called.
+ * \return Boolean, whether to continue with the clique search.
+ */
+typedef igraph_bool_t igraph_clique_handler_t(igraph_vector_t *clique, void *arg);
+
+DECLDIR int igraph_cliques_callback(const igraph_t *graph,
+ igraph_integer_t min_size, igraph_integer_t max_size,
+ igraph_clique_handler_t *cliquehandler_fn, void *arg);
-int igraph_cliques(const igraph_t *graph, igraph_vector_ptr_t *res,
- igraph_integer_t min_size, igraph_integer_t max_size);
-int igraph_largest_cliques(const igraph_t *graph,
- igraph_vector_ptr_t *cliques);
-int igraph_clique_number(const igraph_t *graph, igraph_integer_t *no);
-int igraph_independent_vertex_sets(const igraph_t *graph,
- igraph_vector_ptr_t *res,
- igraph_integer_t min_size,
- igraph_integer_t max_size);
-int igraph_largest_independent_vertex_sets(const igraph_t *graph,
- igraph_vector_ptr_t *res);
-int igraph_maximal_independent_vertex_sets(const igraph_t *graph,
- igraph_vector_ptr_t *res);
-int igraph_independence_number(const igraph_t *graph, igraph_integer_t *no);
__END_DECLS
diff --git a/src/include/igraph_cocitation.h b/src/include/igraph_cocitation.h
index eff0867..eb1c7cb 100644
--- a/src/include/igraph_cocitation.h
+++ b/src/include/igraph_cocitation.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_COCITATION_H
#define IGRAPH_COCITATION_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_matrix.h"
#include "igraph_datatype.h"
@@ -45,30 +36,30 @@ __BEGIN_DECLS
/* Cocitation and other similarity measures */
/* -------------------------------------------------- */
-int igraph_cocitation(const igraph_t *graph, igraph_matrix_t *res,
- const igraph_vs_t vids);
-int igraph_bibcoupling(const igraph_t *graph, igraph_matrix_t *res,
- const igraph_vs_t vids);
+DECLDIR int igraph_cocitation(const igraph_t *graph, igraph_matrix_t *res,
+ const igraph_vs_t vids);
+DECLDIR int igraph_bibcoupling(const igraph_t *graph, igraph_matrix_t *res,
+ const igraph_vs_t vids);
-int igraph_similarity_jaccard(const igraph_t *graph, igraph_matrix_t *res,
- const igraph_vs_t vids, igraph_neimode_t mode,
- igraph_bool_t loops);
-int igraph_similarity_jaccard_pairs(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops);
-int igraph_similarity_jaccard_es(const igraph_t *graph, igraph_vector_t *res,
- const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops);
+DECLDIR int igraph_similarity_jaccard(const igraph_t *graph, igraph_matrix_t *res,
+ const igraph_vs_t vids, igraph_neimode_t mode,
+ igraph_bool_t loops);
+DECLDIR int igraph_similarity_jaccard_pairs(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops);
+DECLDIR int igraph_similarity_jaccard_es(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops);
-int igraph_similarity_dice(const igraph_t *graph, igraph_matrix_t *res,
- const igraph_vs_t vids, igraph_neimode_t mode,
- igraph_bool_t loops);
-int igraph_similarity_dice_pairs(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops);
-int igraph_similarity_dice_es(const igraph_t *graph, igraph_vector_t *res,
- const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops);
+DECLDIR int igraph_similarity_dice(const igraph_t *graph, igraph_matrix_t *res,
+ const igraph_vs_t vids, igraph_neimode_t mode,
+ igraph_bool_t loops);
+DECLDIR int igraph_similarity_dice_pairs(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vector_t *pairs, igraph_neimode_t mode, igraph_bool_t loops);
+DECLDIR int igraph_similarity_dice_es(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_es_t es, igraph_neimode_t mode, igraph_bool_t loops);
-int igraph_similarity_inverse_log_weighted(const igraph_t *graph,
- igraph_matrix_t *res, const igraph_vs_t vids,
- igraph_neimode_t mode);
+DECLDIR int igraph_similarity_inverse_log_weighted(const igraph_t *graph,
+ igraph_matrix_t *res, const igraph_vs_t vids,
+ igraph_neimode_t mode);
__END_DECLS
diff --git a/src/include/igraph_community.h b/src/include/igraph_community.h
index 5aa9b16..bf971f2 100644
--- a/src/include/igraph_community.h
+++ b/src/include/igraph_community.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_COMMUNITY_H
#define IGRAPH_COMMUNITY_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_datatype.h"
#include "igraph_types.h"
@@ -46,8 +37,8 @@ __BEGIN_DECLS
/* K-Cores */
/* -------------------------------------------------- */
-int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores,
- igraph_neimode_t mode);
+DECLDIR int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores,
+ igraph_neimode_t mode);
/* -------------------------------------------------- */
/* Community Structure */
@@ -57,102 +48,102 @@ int igraph_coreness(const igraph_t *graph, igraph_vector_t *cores,
/* TODO: edge.type.matrix */
/* TODO: */
-int igraph_community_optimal_modularity(const igraph_t *graph,
- igraph_real_t *modularity,
- igraph_vector_t *membership,
- const igraph_vector_t *weights);
-
-int igraph_community_spinglass(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_real_t *modularity,
- igraph_real_t *temperature,
- igraph_vector_t *membership,
- igraph_vector_t *csize,
- igraph_integer_t spins,
- igraph_bool_t parupdate,
- igraph_real_t starttemp,
- igraph_real_t stoptemp,
- igraph_real_t coolfact,
- igraph_spincomm_update_t update_rule,
- igraph_real_t gamma,
- /* the rest is for the NegSpin implementation */
- igraph_spinglass_implementation_t implementation,
-/* igraph_matrix_t *adhesion, */
-/* igraph_matrix_t *normalised_adhesion, */
-/* igraph_real_t *polarization, */
- igraph_real_t lambda);
-
-int igraph_community_spinglass_single(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_integer_t vertex,
- igraph_vector_t *community,
- igraph_real_t *cohesion,
- igraph_real_t *adhesion,
- igraph_integer_t *inner_links,
- igraph_integer_t *outer_links,
- igraph_integer_t spins,
- igraph_spincomm_update_t update_rule,
- igraph_real_t gamma);
+DECLDIR int igraph_community_optimal_modularity(const igraph_t *graph,
+ igraph_real_t *modularity,
+ igraph_vector_t *membership,
+ const igraph_vector_t *weights);
+
+DECLDIR int igraph_community_spinglass(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_real_t *modularity,
+ igraph_real_t *temperature,
+ igraph_vector_t *membership,
+ igraph_vector_t *csize,
+ igraph_integer_t spins,
+ igraph_bool_t parupdate,
+ igraph_real_t starttemp,
+ igraph_real_t stoptemp,
+ igraph_real_t coolfact,
+ igraph_spincomm_update_t update_rule,
+ igraph_real_t gamma,
+ /* the rest is for the NegSpin implementation */
+ igraph_spinglass_implementation_t implementation,
+/* igraph_matrix_t *adhesion, */
+/* igraph_matrix_t *normalised_adhesion, */
+/* igraph_real_t *polarization, */
+ igraph_real_t lambda);
+
+DECLDIR int igraph_community_spinglass_single(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_integer_t vertex,
+ igraph_vector_t *community,
+ igraph_real_t *cohesion,
+ igraph_real_t *adhesion,
+ igraph_integer_t *inner_links,
+ igraph_integer_t *outer_links,
+ igraph_integer_t spins,
+ igraph_spincomm_update_t update_rule,
+ igraph_real_t gamma);
-int igraph_community_walktrap(const igraph_t *graph,
- const igraph_vector_t *weights,
- int steps,
- igraph_matrix_t *merges,
- igraph_vector_t *modularity,
- igraph_vector_t *membership);
-
-int igraph_community_infomap(const igraph_t * graph,
- const igraph_vector_t *e_weights,
- const igraph_vector_t *v_weights,
- int nb_trials,
- igraph_vector_t *membership,
- igraph_real_t *codelength);
-
-int igraph_community_edge_betweenness(const igraph_t *graph,
- igraph_vector_t *result,
- igraph_vector_t *edge_betweenness,
- igraph_matrix_t *merges,
- igraph_vector_t *bridges,
- igraph_vector_t *modularity,
- igraph_vector_t *membership,
- igraph_bool_t directed,
- const igraph_vector_t *weights);
-int igraph_community_eb_get_merges(const igraph_t *graph,
- const igraph_vector_t *edges,
- const igraph_vector_t *weights,
- igraph_matrix_t *merges,
- igraph_vector_t *bridges,
- igraph_vector_t *modularity,
- igraph_vector_t *membership);
-
-int igraph_community_fastgreedy(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_matrix_t *merges,
- igraph_vector_t *modularity,
- igraph_vector_t *membership);
-
-int igraph_community_to_membership(const igraph_matrix_t *merges,
- igraph_integer_t nodes,
- igraph_integer_t steps,
- igraph_vector_t *membership,
- igraph_vector_t *csize);
-int igraph_le_community_to_membership(const igraph_matrix_t *merges,
- igraph_integer_t steps,
- igraph_vector_t *membership,
- igraph_vector_t *csize);
-
-int igraph_modularity(const igraph_t *graph,
- const igraph_vector_t *membership,
- igraph_real_t *modularity,
- const igraph_vector_t *weights);
-
-int igraph_modularity_matrix(const igraph_t *graph,
- const igraph_vector_t *membership,
- igraph_matrix_t *modmat,
- const igraph_vector_t *weights);
-
-int igraph_reindex_membership(igraph_vector_t *membership,
- igraph_vector_t *new_to_old);
+DECLDIR int igraph_community_walktrap(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ int steps,
+ igraph_matrix_t *merges,
+ igraph_vector_t *modularity,
+ igraph_vector_t *membership);
+
+DECLDIR int igraph_community_infomap(const igraph_t * graph,
+ const igraph_vector_t *e_weights,
+ const igraph_vector_t *v_weights,
+ int nb_trials,
+ igraph_vector_t *membership,
+ igraph_real_t *codelength);
+
+DECLDIR int igraph_community_edge_betweenness(const igraph_t *graph,
+ igraph_vector_t *result,
+ igraph_vector_t *edge_betweenness,
+ igraph_matrix_t *merges,
+ igraph_vector_t *bridges,
+ igraph_vector_t *modularity,
+ igraph_vector_t *membership,
+ igraph_bool_t directed,
+ const igraph_vector_t *weights);
+DECLDIR int igraph_community_eb_get_merges(const igraph_t *graph,
+ const igraph_vector_t *edges,
+ const igraph_vector_t *weights,
+ igraph_matrix_t *merges,
+ igraph_vector_t *bridges,
+ igraph_vector_t *modularity,
+ igraph_vector_t *membership);
+
+DECLDIR int igraph_community_fastgreedy(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_matrix_t *merges,
+ igraph_vector_t *modularity,
+ igraph_vector_t *membership);
+
+DECLDIR int igraph_community_to_membership(const igraph_matrix_t *merges,
+ igraph_integer_t nodes,
+ igraph_integer_t steps,
+ igraph_vector_t *membership,
+ igraph_vector_t *csize);
+DECLDIR int igraph_le_community_to_membership(const igraph_matrix_t *merges,
+ igraph_integer_t steps,
+ igraph_vector_t *membership,
+ igraph_vector_t *csize);
+
+DECLDIR int igraph_modularity(const igraph_t *graph,
+ const igraph_vector_t *membership,
+ igraph_real_t *modularity,
+ const igraph_vector_t *weights);
+
+DECLDIR int igraph_modularity_matrix(const igraph_t *graph,
+ const igraph_vector_t *membership,
+ igraph_matrix_t *modmat,
+ const igraph_vector_t *weights);
+
+DECLDIR int igraph_reindex_membership(igraph_vector_t *membership,
+ igraph_vector_t *new_to_old);
typedef enum { IGRAPH_LEVC_HIST_SPLIT=1,
IGRAPH_LEVC_HIST_FAILED,
@@ -197,44 +188,44 @@ typedef int igraph_community_leading_eigenvector_callback_t(
void *arpack_extra,
void *extra);
-int igraph_community_leading_eigenvector(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_matrix_t *merges,
- igraph_vector_t *membership,
- igraph_integer_t steps,
- igraph_arpack_options_t *options,
- igraph_real_t *modularity,
- igraph_bool_t start,
- igraph_vector_t *eigenvalues,
- igraph_vector_ptr_t *eigenvectors,
- igraph_vector_t *history,
- igraph_community_leading_eigenvector_callback_t *callback,
- void *callback_extra);
-
-int igraph_community_label_propagation(const igraph_t *graph,
- igraph_vector_t *membership,
- const igraph_vector_t *weights,
- const igraph_vector_t *initial,
- igraph_vector_bool_t *fixed,
- igraph_real_t *modularity);
-int igraph_community_multilevel(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_vector_t *membership,
- igraph_matrix_t *memberships,
- igraph_vector_t *modularity);
+DECLDIR int igraph_community_leading_eigenvector(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_matrix_t *merges,
+ igraph_vector_t *membership,
+ igraph_integer_t steps,
+ igraph_arpack_options_t *options,
+ igraph_real_t *modularity,
+ igraph_bool_t start,
+ igraph_vector_t *eigenvalues,
+ igraph_vector_ptr_t *eigenvectors,
+ igraph_vector_t *history,
+ igraph_community_leading_eigenvector_callback_t *callback,
+ void *callback_extra);
+
+DECLDIR int igraph_community_label_propagation(const igraph_t *graph,
+ igraph_vector_t *membership,
+ const igraph_vector_t *weights,
+ const igraph_vector_t *initial,
+ igraph_vector_bool_t *fixed,
+ igraph_real_t *modularity);
+DECLDIR int igraph_community_multilevel(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_vector_t *membership,
+ igraph_matrix_t *memberships,
+ igraph_vector_t *modularity);
/* -------------------------------------------------- */
/* Community Structure Comparison */
/* -------------------------------------------------- */
-int igraph_compare_communities(const igraph_vector_t *comm1,
- const igraph_vector_t *comm2,
- igraph_real_t* result,
- igraph_community_comparison_t method);
-int igraph_split_join_distance(const igraph_vector_t *comm1,
- const igraph_vector_t *comm2,
- igraph_integer_t* distance12,
- igraph_integer_t* distance21);
+DECLDIR int igraph_compare_communities(const igraph_vector_t *comm1,
+ const igraph_vector_t *comm2,
+ igraph_real_t* result,
+ igraph_community_comparison_t method);
+DECLDIR int igraph_split_join_distance(const igraph_vector_t *comm1,
+ const igraph_vector_t *comm2,
+ igraph_integer_t* distance12,
+ igraph_integer_t* distance21);
__END_DECLS
diff --git a/src/include/igraph_complex.h b/src/include/igraph_complex.h
index 9821038..4137630 100644
--- a/src/include/igraph_complex.h
+++ b/src/include/igraph_complex.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_COMPLEX_H
#define IGRAPH_COMPLEX_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
__BEGIN_DECLS
@@ -44,67 +35,67 @@ typedef struct igraph_complex_t { igraph_real_t dat[2]; } igraph_complex_t;
#define IGRAPH_IMAG(x) ((x).dat[1])
#define IGRAPH_COMPLEX_EQ(x,y) ((x).dat[0]==(y).dat[0] && (x).dat[1]==(y).dat[1])
-igraph_complex_t igraph_complex(igraph_real_t x, igraph_real_t y);
-igraph_complex_t igraph_complex_polar(igraph_real_t r, igraph_real_t theta);
-
-igraph_bool_t igraph_complex_eq_tol(igraph_complex_t z1,
- igraph_complex_t z2,
- igraph_real_t tol);
-
-igraph_real_t igraph_complex_mod(igraph_complex_t z);
-igraph_real_t igraph_complex_arg(igraph_complex_t z);
-
-igraph_real_t igraph_complex_abs(igraph_complex_t z);
-igraph_real_t igraph_complex_logabs(igraph_complex_t z);
-
-igraph_complex_t igraph_complex_add(igraph_complex_t z1,
- igraph_complex_t z2);
-igraph_complex_t igraph_complex_sub(igraph_complex_t z1,
- igraph_complex_t z2);
-igraph_complex_t igraph_complex_mul(igraph_complex_t z1,
- igraph_complex_t z2);
-igraph_complex_t igraph_complex_div(igraph_complex_t z1,
- igraph_complex_t z2);
-
-igraph_complex_t igraph_complex_add_real(igraph_complex_t z,
- igraph_real_t x);
-igraph_complex_t igraph_complex_add_imag(igraph_complex_t z,
- igraph_real_t y);
-igraph_complex_t igraph_complex_sub_real(igraph_complex_t z,
- igraph_real_t x);
-igraph_complex_t igraph_complex_sub_imag(igraph_complex_t z,
- igraph_real_t y);
-igraph_complex_t igraph_complex_mul_real(igraph_complex_t z,
- igraph_real_t x);
-igraph_complex_t igraph_complex_mul_imag(igraph_complex_t z,
- igraph_real_t y);
-igraph_complex_t igraph_complex_div_real(igraph_complex_t z,
- igraph_real_t x);
-igraph_complex_t igraph_complex_div_imag(igraph_complex_t z,
- igraph_real_t y);
-
-igraph_complex_t igraph_complex_conj(igraph_complex_t z);
-igraph_complex_t igraph_complex_neg(igraph_complex_t z);
-igraph_complex_t igraph_complex_inv(igraph_complex_t z);
-
-igraph_complex_t igraph_complex_sqrt(igraph_complex_t z);
-igraph_complex_t igraph_complex_sqrt_real(igraph_real_t x);
-igraph_complex_t igraph_complex_exp(igraph_complex_t z);
-igraph_complex_t igraph_complex_pow(igraph_complex_t z1,
- igraph_complex_t z2);
-igraph_complex_t igraph_complex_pow_real(igraph_complex_t z,
- igraph_real_t x);
-igraph_complex_t igraph_complex_log(igraph_complex_t z);
-igraph_complex_t igraph_complex_log10(igraph_complex_t z);
-igraph_complex_t igraph_complex_log_b(igraph_complex_t z,
- igraph_complex_t b);
-
-igraph_complex_t igraph_complex_sin(igraph_complex_t z);
-igraph_complex_t igraph_complex_cos(igraph_complex_t z);
-igraph_complex_t igraph_complex_tan(igraph_complex_t z);
-igraph_complex_t igraph_complex_sec(igraph_complex_t z);
-igraph_complex_t igraph_complex_csc(igraph_complex_t z);
-igraph_complex_t igraph_complex_cot(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex(igraph_real_t x, igraph_real_t y);
+DECLDIR igraph_complex_t igraph_complex_polar(igraph_real_t r, igraph_real_t theta);
+
+DECLDIR igraph_bool_t igraph_complex_eq_tol(igraph_complex_t z1,
+ igraph_complex_t z2,
+ igraph_real_t tol);
+
+DECLDIR igraph_real_t igraph_complex_mod(igraph_complex_t z);
+DECLDIR igraph_real_t igraph_complex_arg(igraph_complex_t z);
+
+DECLDIR igraph_real_t igraph_complex_abs(igraph_complex_t z);
+DECLDIR igraph_real_t igraph_complex_logabs(igraph_complex_t z);
+
+DECLDIR igraph_complex_t igraph_complex_add(igraph_complex_t z1,
+ igraph_complex_t z2);
+DECLDIR igraph_complex_t igraph_complex_sub(igraph_complex_t z1,
+ igraph_complex_t z2);
+DECLDIR igraph_complex_t igraph_complex_mul(igraph_complex_t z1,
+ igraph_complex_t z2);
+DECLDIR igraph_complex_t igraph_complex_div(igraph_complex_t z1,
+ igraph_complex_t z2);
+
+DECLDIR igraph_complex_t igraph_complex_add_real(igraph_complex_t z,
+ igraph_real_t x);
+DECLDIR igraph_complex_t igraph_complex_add_imag(igraph_complex_t z,
+ igraph_real_t y);
+DECLDIR igraph_complex_t igraph_complex_sub_real(igraph_complex_t z,
+ igraph_real_t x);
+DECLDIR igraph_complex_t igraph_complex_sub_imag(igraph_complex_t z,
+ igraph_real_t y);
+DECLDIR igraph_complex_t igraph_complex_mul_real(igraph_complex_t z,
+ igraph_real_t x);
+DECLDIR igraph_complex_t igraph_complex_mul_imag(igraph_complex_t z,
+ igraph_real_t y);
+DECLDIR igraph_complex_t igraph_complex_div_real(igraph_complex_t z,
+ igraph_real_t x);
+DECLDIR igraph_complex_t igraph_complex_div_imag(igraph_complex_t z,
+ igraph_real_t y);
+
+DECLDIR igraph_complex_t igraph_complex_conj(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_neg(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_inv(igraph_complex_t z);
+
+DECLDIR igraph_complex_t igraph_complex_sqrt(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_sqrt_real(igraph_real_t x);
+DECLDIR igraph_complex_t igraph_complex_exp(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_pow(igraph_complex_t z1,
+ igraph_complex_t z2);
+DECLDIR igraph_complex_t igraph_complex_pow_real(igraph_complex_t z,
+ igraph_real_t x);
+DECLDIR igraph_complex_t igraph_complex_log(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_log10(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_log_b(igraph_complex_t z,
+ igraph_complex_t b);
+
+DECLDIR igraph_complex_t igraph_complex_sin(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_cos(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_tan(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_sec(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_csc(igraph_complex_t z);
+DECLDIR igraph_complex_t igraph_complex_cot(igraph_complex_t z);
__END_DECLS
diff --git a/src/include/igraph_components.h b/src/include/igraph_components.h
index b243be9..1c61381 100644
--- a/src/include/igraph_components.h
+++ b/src/include/igraph_components.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_COMPONENTS_H
#define IGRAPH_COMPONENTS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -46,23 +37,23 @@ __BEGIN_DECLS
/* Components */
/* -------------------------------------------------- */
-int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership,
- igraph_vector_t *csize, igraph_integer_t *no,
- igraph_connectedness_t mode);
-int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res,
- igraph_connectedness_t mode);
-void igraph_decompose_destroy(igraph_vector_ptr_t *complist);
-int igraph_decompose(const igraph_t *graph, igraph_vector_ptr_t *components,
- igraph_connectedness_t mode,
- long int maxcompno, long int minelements);
-int igraph_articulation_points(const igraph_t *graph,
- igraph_vector_t *res);
-int igraph_biconnected_components(const igraph_t *graph,
- igraph_integer_t *no,
- igraph_vector_ptr_t *tree_edges,
- igraph_vector_ptr_t *component_edges,
- igraph_vector_ptr_t *components,
- igraph_vector_t *articulation_points);
+DECLDIR int igraph_clusters(const igraph_t *graph, igraph_vector_t *membership,
+ igraph_vector_t *csize, igraph_integer_t *no,
+ igraph_connectedness_t mode);
+DECLDIR int igraph_is_connected(const igraph_t *graph, igraph_bool_t *res,
+ igraph_connectedness_t mode);
+DECLDIR void igraph_decompose_destroy(igraph_vector_ptr_t *complist);
+DECLDIR int igraph_decompose(const igraph_t *graph, igraph_vector_ptr_t *components,
+ igraph_connectedness_t mode,
+ long int maxcompno, long int minelements);
+DECLDIR int igraph_articulation_points(const igraph_t *graph,
+ igraph_vector_t *res);
+DECLDIR int igraph_biconnected_components(const igraph_t *graph,
+ igraph_integer_t *no,
+ igraph_vector_ptr_t *tree_edges,
+ igraph_vector_ptr_t *component_edges,
+ igraph_vector_ptr_t *components,
+ igraph_vector_t *articulation_points);
__END_DECLS
diff --git a/src/include/igraph_constants.h b/src/include/igraph_constants.h
index 715f750..ea5b710 100644
--- a/src/include/igraph_constants.h
+++ b/src/include/igraph_constants.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_CONSTANTS_H
#define IGRAPH_CONSTANTS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
diff --git a/src/include/igraph_constructors.h b/src/include/igraph_constructors.h
index e2572c1..a92f0f4 100644
--- a/src/include/igraph_constructors.h
+++ b/src/include/igraph_constructors.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_CONSTRUCTORS_H
#define IGRAPH_CONSTRUCTORS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_matrix.h"
@@ -45,40 +36,40 @@ __BEGIN_DECLS
/* Constructors, deterministic */
/* -------------------------------------------------- */
-int igraph_create(igraph_t *graph, const igraph_vector_t *edges, igraph_integer_t n,
- igraph_bool_t directed);
-int igraph_small(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed,
- ...);
-int igraph_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix,
- igraph_adjacency_t mode);
-int igraph_weighted_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix,
- igraph_adjacency_t mode, const char* attr,
- igraph_bool_t loops);
-int igraph_star(igraph_t *graph, igraph_integer_t n, igraph_star_mode_t mode,
- igraph_integer_t center);
-int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei,
- igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular);
-int igraph_ring(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed,
- igraph_bool_t mutual, igraph_bool_t circular);
-int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children,
- igraph_tree_mode_t type);
-int igraph_full(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t loops);
-int igraph_full_citation(igraph_t *graph, igraph_integer_t n,
- igraph_bool_t directed);
-int igraph_atlas(igraph_t *graph, int number);
-int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes,
- const igraph_matrix_t *W);
-int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order,
- igraph_neimode_t mode);
-int igraph_linegraph(const igraph_t *graph, igraph_t *linegraph);
+DECLDIR int igraph_create(igraph_t *graph, const igraph_vector_t *edges, igraph_integer_t n,
+ igraph_bool_t directed);
+DECLDIR int igraph_small(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed,
+ ...);
+DECLDIR int igraph_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix,
+ igraph_adjacency_t mode);
+DECLDIR int igraph_weighted_adjacency(igraph_t *graph, igraph_matrix_t *adjmatrix,
+ igraph_adjacency_t mode, const char* attr,
+ igraph_bool_t loops);
+DECLDIR int igraph_star(igraph_t *graph, igraph_integer_t n, igraph_star_mode_t mode,
+ igraph_integer_t center);
+DECLDIR int igraph_lattice(igraph_t *graph, const igraph_vector_t *dimvector, igraph_integer_t nei,
+ igraph_bool_t directed, igraph_bool_t mutual, igraph_bool_t circular);
+DECLDIR int igraph_ring(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed,
+ igraph_bool_t mutual, igraph_bool_t circular);
+DECLDIR int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children,
+ igraph_tree_mode_t type);
+DECLDIR int igraph_full(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, igraph_bool_t loops);
+DECLDIR int igraph_full_citation(igraph_t *graph, igraph_integer_t n,
+ igraph_bool_t directed);
+DECLDIR int igraph_atlas(igraph_t *graph, int number);
+DECLDIR int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes,
+ const igraph_matrix_t *W);
+DECLDIR int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order,
+ igraph_neimode_t mode);
+DECLDIR int igraph_linegraph(const igraph_t *graph, igraph_t *linegraph);
-int igraph_de_bruijn(igraph_t *graph, igraph_integer_t m, igraph_integer_t n);
-int igraph_kautz(igraph_t *graph, igraph_integer_t m, igraph_integer_t n);
-int igraph_famous(igraph_t *graph, const char *name);
-int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n,
- const igraph_vector_t *shifts,
- igraph_integer_t repeats);
-int igraph_lcf(igraph_t *graph, igraph_integer_t n, ...);
+DECLDIR int igraph_de_bruijn(igraph_t *graph, igraph_integer_t m, igraph_integer_t n);
+DECLDIR int igraph_kautz(igraph_t *graph, igraph_integer_t m, igraph_integer_t n);
+DECLDIR int igraph_famous(igraph_t *graph, const char *name);
+DECLDIR int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n,
+ const igraph_vector_t *shifts,
+ igraph_integer_t repeats);
+DECLDIR int igraph_lcf(igraph_t *graph, igraph_integer_t n, ...);
__END_DECLS
diff --git a/src/include/igraph_conversion.h b/src/include/igraph_conversion.h
index 9dce4c0..1c3d016 100644
--- a/src/include/igraph_conversion.h
+++ b/src/include/igraph_conversion.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_CONVERSION_H
#define IGRAPH_CONVERSION_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
@@ -48,26 +39,26 @@ __BEGIN_DECLS
/* Conversion */
/* -------------------------------------------------- */
-int igraph_get_adjacency(const igraph_t *graph, igraph_matrix_t *res,
- igraph_get_adjacency_t type, igraph_bool_t eids);
-int igraph_get_adjacency_sparse(const igraph_t *graph, igraph_spmatrix_t *res,
- igraph_get_adjacency_t type);
+DECLDIR int igraph_get_adjacency(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_get_adjacency_t type, igraph_bool_t eids);
+DECLDIR int igraph_get_adjacency_sparse(const igraph_t *graph, igraph_spmatrix_t *res,
+ igraph_get_adjacency_t type);
-int igraph_get_stochastic(const igraph_t *graph,
- igraph_matrix_t *matrix,
- igraph_bool_t column_wise);
+DECLDIR int igraph_get_stochastic(const igraph_t *graph,
+ igraph_matrix_t *matrix,
+ igraph_bool_t column_wise);
-int igraph_get_stochastic_sparsemat(const igraph_t *graph,
- igraph_sparsemat_t *sparsemat,
- igraph_bool_t column_wise);
+DECLDIR int igraph_get_stochastic_sparsemat(const igraph_t *graph,
+ igraph_sparsemat_t *sparsemat,
+ igraph_bool_t column_wise);
-int igraph_get_edgelist(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t bycol);
+DECLDIR int igraph_get_edgelist(const igraph_t *graph, igraph_vector_t *res, igraph_bool_t bycol);
-int igraph_to_directed(igraph_t *graph,
- igraph_to_directed_t flags);
-int igraph_to_undirected(igraph_t *graph,
- igraph_to_undirected_t flags,
- const igraph_attribute_combination_t *edge_comb);
+DECLDIR int igraph_to_directed(igraph_t *graph,
+ igraph_to_directed_t flags);
+DECLDIR int igraph_to_undirected(igraph_t *graph,
+ igraph_to_undirected_t flags,
+ const igraph_attribute_combination_t *edge_comb);
__END_DECLS
diff --git a/src/include/igraph_datatype.h b/src/include/igraph_datatype.h
index 563b8d0..703b7e8 100644
--- a/src/include/igraph_datatype.h
+++ b/src/include/igraph_datatype.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_DATATYPE_H
#define IGRAPH_DATATYPE_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_vector.h"
diff --git a/src/include/igraph_decls.h b/src/include/igraph_decls.h
new file mode 100644
index 0000000..ffb6883
--- /dev/null
+++ b/src/include/igraph_decls.h
@@ -0,0 +1,24 @@
+#undef __BEGIN_DECLS
+#undef __END_DECLS
+#ifdef __cplusplus
+# define __BEGIN_DECLS extern "C" {
+# define __END_DECLS }
+#else
+# define __BEGIN_DECLS /* empty */
+# define __END_DECLS /* empty */
+#endif
+
+#undef DECLDIR
+#if defined (_WIN32) || defined (WIN32) || defined (_WIN64) || defined (WIN64)
+# if defined (__MINGW32__) || defined (__CYGWIN32__)
+# define DECLDIR /**/
+# else
+# ifdef IGRAPH_EXPORTS
+# define DECLDIR __declspec(dllexport)
+# else
+# define DECLDIR __declspec(dllimport)
+# endif
+# endif
+#else
+# define DECLDIR /**/
+#endif
diff --git a/src/include/igraph_dqueue.h b/src/include/igraph_dqueue.h
index 6cfb88d..5777287 100644
--- a/src/include/igraph_dqueue.h
+++ b/src/include/igraph_dqueue.h
@@ -25,16 +25,7 @@
#define IGRAPH_DQUEUE_H
#include "igraph_types.h"
-
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
diff --git a/src/include/igraph_dqueue_pmt.h b/src/include/igraph_dqueue_pmt.h
index 5646408..b729ec7 100644
--- a/src/include/igraph_dqueue_pmt.h
+++ b/src/include/igraph_dqueue_pmt.h
@@ -33,17 +33,17 @@ typedef struct TYPE(igraph_dqueue) {
BASE *stor_end;
} TYPE(igraph_dqueue);
-int FUNCTION(igraph_dqueue,init) (TYPE(igraph_dqueue)* q, long int size);
-void FUNCTION(igraph_dqueue,destroy) (TYPE(igraph_dqueue)* q);
-igraph_bool_t FUNCTION(igraph_dqueue,empty) (const TYPE(igraph_dqueue)* q);
-void FUNCTION(igraph_dqueue,clear) (TYPE(igraph_dqueue)* q);
-igraph_bool_t FUNCTION(igraph_dqueue,full) (TYPE(igraph_dqueue)* q);
-long int FUNCTION(igraph_dqueue,size) (const TYPE(igraph_dqueue)* q);
-BASE FUNCTION(igraph_dqueue,pop) (TYPE(igraph_dqueue)* q);
-BASE FUNCTION(igraph_dqueue,pop_back)(TYPE(igraph_dqueue)* q);
-BASE FUNCTION(igraph_dqueue,head) (const TYPE(igraph_dqueue)* q);
-BASE FUNCTION(igraph_dqueue,back) (const TYPE(igraph_dqueue)* q);
-int FUNCTION(igraph_dqueue,push) (TYPE(igraph_dqueue)* q, BASE elem);
+DECLDIR int FUNCTION(igraph_dqueue,init) (TYPE(igraph_dqueue)* q, long int size);
+DECLDIR void FUNCTION(igraph_dqueue,destroy) (TYPE(igraph_dqueue)* q);
+DECLDIR igraph_bool_t FUNCTION(igraph_dqueue,empty) (const TYPE(igraph_dqueue)* q);
+DECLDIR void FUNCTION(igraph_dqueue,clear) (TYPE(igraph_dqueue)* q);
+DECLDIR igraph_bool_t FUNCTION(igraph_dqueue,full) (TYPE(igraph_dqueue)* q);
+DECLDIR long int FUNCTION(igraph_dqueue,size) (const TYPE(igraph_dqueue)* q);
+DECLDIR BASE FUNCTION(igraph_dqueue,pop) (TYPE(igraph_dqueue)* q);
+DECLDIR BASE FUNCTION(igraph_dqueue,pop_back)(TYPE(igraph_dqueue)* q);
+DECLDIR BASE FUNCTION(igraph_dqueue,head) (const TYPE(igraph_dqueue)* q);
+DECLDIR BASE FUNCTION(igraph_dqueue,back) (const TYPE(igraph_dqueue)* q);
+DECLDIR int FUNCTION(igraph_dqueue,push) (TYPE(igraph_dqueue)* q, BASE elem);
int FUNCTION(igraph_dqueue,print)(const TYPE(igraph_dqueue)* q);
int FUNCTION(igraph_dqueue,fprint)(const TYPE(igraph_dqueue)* q, FILE *file);
-BASE FUNCTION(igraph_dqueue,e)(const TYPE(igraph_dqueue) *q, long int idx);
+DECLDIR BASE FUNCTION(igraph_dqueue,e)(const TYPE(igraph_dqueue) *q, long int idx);
diff --git a/src/include/igraph_eigen.h b/src/include/igraph_eigen.h
index d37e3d9..905469b 100644
--- a/src/include/igraph_eigen.h
+++ b/src/include/igraph_eigen.h
@@ -28,15 +28,7 @@
#ifndef IGRAPH_EIGEN_H
#define IGRAPH_EIGEN_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -71,47 +63,47 @@ typedef struct igraph_eigen_which_t {
} igraph_eigen_which_t;
-int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A,
- const igraph_sparsemat_t *sA,
- igraph_arpack_function_t *fun, int n,
- void *extra,
- igraph_eigen_algorithm_t algorithm,
- const igraph_eigen_which_t *which,
- igraph_arpack_options_t *options,
- igraph_arpack_storage_t *storage,
- igraph_vector_t *values,
- igraph_matrix_t *vectors);
+DECLDIR int igraph_eigen_matrix_symmetric(const igraph_matrix_t *A,
+ const igraph_sparsemat_t *sA,
+ igraph_arpack_function_t *fun, int n,
+ void *extra,
+ igraph_eigen_algorithm_t algorithm,
+ const igraph_eigen_which_t *which,
+ igraph_arpack_options_t *options,
+ igraph_arpack_storage_t *storage,
+ igraph_vector_t *values,
+ igraph_matrix_t *vectors);
-int igraph_eigen_matrix(const igraph_matrix_t *A,
- const igraph_sparsemat_t *sA,
- igraph_arpack_function_t *fun, int n,
- void *extra,
- igraph_eigen_algorithm_t algorithm,
- const igraph_eigen_which_t *which,
- igraph_arpack_options_t *options,
- igraph_arpack_storage_t *storage,
- igraph_vector_complex_t *values,
- igraph_matrix_complex_t *vectors);
+DECLDIR int igraph_eigen_matrix(const igraph_matrix_t *A,
+ const igraph_sparsemat_t *sA,
+ igraph_arpack_function_t *fun, int n,
+ void *extra,
+ igraph_eigen_algorithm_t algorithm,
+ const igraph_eigen_which_t *which,
+ igraph_arpack_options_t *options,
+ igraph_arpack_storage_t *storage,
+ igraph_vector_complex_t *values,
+ igraph_matrix_complex_t *vectors);
-int igraph_eigen_adjacency(const igraph_t *graph,
- igraph_eigen_algorithm_t algorithm,
- const igraph_eigen_which_t *which,
- igraph_arpack_options_t *options,
- igraph_arpack_storage_t *storage,
- igraph_vector_t *values,
- igraph_matrix_t *vectors,
- igraph_vector_complex_t *cmplxvalues,
- igraph_matrix_complex_t *cmplxvectors);
+DECLDIR int igraph_eigen_adjacency(const igraph_t *graph,
+ igraph_eigen_algorithm_t algorithm,
+ const igraph_eigen_which_t *which,
+ igraph_arpack_options_t *options,
+ igraph_arpack_storage_t *storage,
+ igraph_vector_t *values,
+ igraph_matrix_t *vectors,
+ igraph_vector_complex_t *cmplxvalues,
+ igraph_matrix_complex_t *cmplxvectors);
-int igraph_eigen_laplacian(const igraph_t *graph,
- igraph_eigen_algorithm_t algorithm,
- const igraph_eigen_which_t *which,
- igraph_arpack_options_t *options,
- igraph_arpack_storage_t *storage,
- igraph_vector_t *values,
- igraph_matrix_t *vectors,
- igraph_vector_complex_t *cmplxvalues,
- igraph_matrix_complex_t *cmplxvectors);
+DECLDIR int igraph_eigen_laplacian(const igraph_t *graph,
+ igraph_eigen_algorithm_t algorithm,
+ const igraph_eigen_which_t *which,
+ igraph_arpack_options_t *options,
+ igraph_arpack_storage_t *storage,
+ igraph_vector_t *values,
+ igraph_matrix_t *vectors,
+ igraph_vector_complex_t *cmplxvalues,
+ igraph_matrix_complex_t *cmplxvectors);
__END_DECLS
diff --git a/src/include/igraph_embedding.h b/src/include/igraph_embedding.h
index b0e29dc..4306230 100644
--- a/src/include/igraph_embedding.h
+++ b/src/include/igraph_embedding.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_EMBEDDING_H
#define IGRAPH_EMBEDDING_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_datatype.h"
#include "igraph_arpack.h"
#include "igraph_eigen.h"
@@ -41,16 +32,16 @@
__BEGIN_DECLS
-int igraph_adjacency_spectral_embedding(const igraph_t *graph,
- igraph_integer_t no,
- const igraph_vector_t *weights,
- igraph_eigen_which_position_t which,
- igraph_bool_t scaled,
- igraph_matrix_t *X,
- igraph_matrix_t *Y,
- igraph_vector_t *D,
- const igraph_vector_t *cvec,
- igraph_arpack_options_t *options);
+DECLDIR int igraph_adjacency_spectral_embedding(const igraph_t *graph,
+ igraph_integer_t no,
+ const igraph_vector_t *weights,
+ igraph_eigen_which_position_t which,
+ igraph_bool_t scaled,
+ igraph_matrix_t *X,
+ igraph_matrix_t *Y,
+ igraph_vector_t *D,
+ const igraph_vector_t *cvec,
+ igraph_arpack_options_t *options);
typedef enum {
IGRAPH_EMBEDDING_D_A=0,
@@ -58,19 +49,19 @@ typedef enum {
IGRAPH_EMBEDDING_DAD,
IGRAPH_EMBEDDING_OAP } igraph_laplacian_spectral_embedding_type_t;
-int igraph_laplacian_spectral_embedding(const igraph_t *graph,
- igraph_integer_t no,
- const igraph_vector_t *weights,
- igraph_eigen_which_position_t which,
- igraph_neimode_t degmode,
- igraph_laplacian_spectral_embedding_type_t type,
- igraph_bool_t scaled,
- igraph_matrix_t *X,
- igraph_matrix_t *Y,
- igraph_vector_t *D,
- igraph_arpack_options_t *options);
+DECLDIR int igraph_laplacian_spectral_embedding(const igraph_t *graph,
+ igraph_integer_t no,
+ const igraph_vector_t *weights,
+ igraph_eigen_which_position_t which,
+ igraph_neimode_t degmode,
+ igraph_laplacian_spectral_embedding_type_t type,
+ igraph_bool_t scaled,
+ igraph_matrix_t *X,
+ igraph_matrix_t *Y,
+ igraph_vector_t *D,
+ igraph_arpack_options_t *options);
-int igraph_dim_select(const igraph_vector_t *sv, igraph_integer_t *dim);
+DECLDIR int igraph_dim_select(const igraph_vector_t *sv, igraph_integer_t *dim);
__END_DECLS
diff --git a/src/include/igraph_epidemics.h b/src/include/igraph_epidemics.h
index 9b925a5..bc05db1 100644
--- a/src/include/igraph_epidemics.h
+++ b/src/include/igraph_epidemics.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_EPIDEMICS_H
#define IGRAPH_EPIDEMICS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_datatype.h"
#include "igraph_vector.h"
#include "igraph_vector_ptr.h"
@@ -63,12 +54,12 @@ typedef struct igraph_sir_t {
igraph_vector_int_t no_s, no_i, no_r;
} igraph_sir_t;
-int igraph_sir_init(igraph_sir_t *sir);
-void igraph_sir_destroy(igraph_sir_t *sir);
+DECLDIR int igraph_sir_init(igraph_sir_t *sir);
+DECLDIR void igraph_sir_destroy(igraph_sir_t *sir);
-int igraph_sir(const igraph_t *graph, igraph_real_t beta,
- igraph_real_t gamma, igraph_integer_t no_sim,
- igraph_vector_ptr_t *result);
+DECLDIR int igraph_sir(const igraph_t *graph, igraph_real_t beta,
+ igraph_real_t gamma, igraph_integer_t no_sim,
+ igraph_vector_ptr_t *result);
__END_DECLS
diff --git a/src/include/igraph_error.h b/src/include/igraph_error.h
index 880b1bf..1065b3b 100644
--- a/src/include/igraph_error.h
+++ b/src/include/igraph_error.h
@@ -26,15 +26,7 @@
#include <stdarg.h>
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -260,8 +252,7 @@ extern igraph_error_handler_t igraph_error_handler_printignore;
* more.
*/
-igraph_error_handler_t*
-igraph_set_error_handler(igraph_error_handler_t* new_handler);
+DECLDIR igraph_error_handler_t* igraph_set_error_handler(igraph_error_handler_t* new_handler);
/**
* \typedef igraph_error_type_t
@@ -446,8 +437,8 @@ typedef enum {
* \sa igraph_errorf().
*/
-int igraph_error(const char *reason, const char *file, int line,
- int igraph_errno);
+DECLDIR int igraph_error(const char *reason, const char *file, int line,
+ int igraph_errno);
/**
* \function igraph_errorf
@@ -464,11 +455,11 @@ int igraph_error(const char *reason, const char *file, int line,
* \sa igraph_error().
*/
-int igraph_errorf(const char *reason, const char *file, int line,
- int igraph_errno, ...);
+DECLDIR int igraph_errorf(const char *reason, const char *file, int line,
+ int igraph_errno, ...);
-int igraph_errorvf(const char *reason, const char *file, int line,
- int igraph_errno, va_list ap);
+DECLDIR int igraph_errorvf(const char *reason, const char *file, int line,
+ int igraph_errno, va_list ap);
/**
* \function igraph_strerror
@@ -481,7 +472,7 @@ int igraph_errorvf(const char *reason, const char *file, int line,
* \return pointer to the textual description of the error code.
*/
-const char* igraph_strerror(const int igraph_errno);
+DECLDIR const char* igraph_strerror(const int igraph_errno);
#define IGRAPH_ERROR_SELECT_2(a,b) ((a) != IGRAPH_SUCCESS ? (a) : ((b) != IGRAPH_SUCCESS ? (b) : IGRAPH_SUCCESS))
#define IGRAPH_ERROR_SELECT_3(a,b,c) ((a) != IGRAPH_SUCCESS ? (a) : IGRAPH_ERROR_SELECT_2(b,c))
@@ -501,7 +492,7 @@ struct igraph_i_protectedPtr {
typedef void igraph_finally_func_t (void*);
-void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr);
+DECLDIR void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr);
/**
* \function IGRAPH_FINALLY_CLEAN
@@ -514,7 +505,7 @@ void IGRAPH_FINALLY_REAL(void (*func)(void*), void* ptr);
* stack.
*/
-void IGRAPH_FINALLY_CLEAN(int num);
+DECLDIR void IGRAPH_FINALLY_CLEAN(int num);
/**
* \function IGRAPH_FINALLY_FREE
@@ -528,7 +519,7 @@ void IGRAPH_FINALLY_CLEAN(int num);
* as well.
*/
-void IGRAPH_FINALLY_FREE(void);
+DECLDIR void IGRAPH_FINALLY_FREE(void);
/**
* \function IGRAPH_FINALLY_STACK_SIZE
@@ -545,7 +536,7 @@ void IGRAPH_FINALLY_FREE(void);
* write your own test cases and examine \ref IGRAPH_FINALLY_STACK_SIZE
* before and after your test cases - the numbers should be equal.
*/
-int IGRAPH_FINALLY_STACK_SIZE(void);
+DECLDIR int IGRAPH_FINALLY_STACK_SIZE(void);
/**
* \define IGRAPH_FINALLY_STACK_EMPTY
@@ -658,8 +649,7 @@ typedef igraph_error_handler_t igraph_warning_handler_t;
* \return The current warning handler function.
*/
-igraph_warning_handler_t*
-igraph_set_warning_handler(igraph_warning_handler_t* new_handler);
+DECLDIR igraph_warning_handler_t* igraph_set_warning_handler(igraph_warning_handler_t* new_handler);
extern igraph_warning_handler_t igraph_warning_handler_ignore;
extern igraph_warning_handler_t igraph_warning_handler_print;
@@ -679,8 +669,8 @@ extern igraph_warning_handler_t igraph_warning_handler_print;
* \return The supplied error code.
*/
-int igraph_warning(const char *reason, const char *file, int line,
- int igraph_errno);
+DECLDIR int igraph_warning(const char *reason, const char *file, int line,
+ int igraph_errno);
/**
* \function igraph_warningf
@@ -701,8 +691,8 @@ int igraph_warning(const char *reason, const char *file, int line,
* \return The supplied error code.
*/
-int igraph_warningf(const char *reason, const char *file, int line,
- int igraph_errno, ...);
+DECLDIR int igraph_warningf(const char *reason, const char *file, int line,
+ int igraph_errno, ...);
/**
* \define IGRAPH_WARNING
diff --git a/src/include/igraph_flow.h b/src/include/igraph_flow.h
index 5b94cf3..d13e5a5 100644
--- a/src/include/igraph_flow.h
+++ b/src/include/igraph_flow.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_FLOW_H
#define IGRAPH_FLOW_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
@@ -66,112 +57,112 @@ typedef struct {
int nopush, norelabel, nogap, nogapnodes, nobfs;
} igraph_maxflow_stats_t;
-int igraph_maxflow(const igraph_t *graph, igraph_real_t *value,
- igraph_vector_t *flow, igraph_vector_t *cut,
- igraph_vector_t *partition, igraph_vector_t *partition2,
- igraph_integer_t source, igraph_integer_t target,
- const igraph_vector_t *capacity,
- igraph_maxflow_stats_t *stats);
-int igraph_maxflow_value(const igraph_t *graph, igraph_real_t *value,
- igraph_integer_t source, igraph_integer_t target,
- const igraph_vector_t *capacity,
- igraph_maxflow_stats_t *stats);
-
-int igraph_st_mincut(const igraph_t *graph, igraph_real_t *value,
- igraph_vector_t *cut, igraph_vector_t *partition,
- igraph_vector_t *partition2,
- igraph_integer_t source, igraph_integer_t target,
- const igraph_vector_t *capacity);
-int igraph_st_mincut_value(const igraph_t *graph, igraph_real_t *res,
- igraph_integer_t source, igraph_integer_t target,
- const igraph_vector_t *capacity);
-
-int igraph_mincut_value(const igraph_t *graph, igraph_real_t *res,
- const igraph_vector_t *capacity);
-int igraph_mincut(const igraph_t *graph,
- igraph_real_t *value,
- igraph_vector_t *partition,
- igraph_vector_t *partition2,
- igraph_vector_t *cut,
- const igraph_vector_t *capacity);
-
-int igraph_st_vertex_connectivity(const igraph_t *graph,
- igraph_integer_t *res,
- igraph_integer_t source,
- igraph_integer_t target,
- igraph_vconn_nei_t neighbors);
-int igraph_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res,
- igraph_bool_t checks);
-
-int igraph_st_edge_connectivity(const igraph_t *graph, igraph_integer_t *res,
- igraph_integer_t source,
- igraph_integer_t target);
-int igraph_edge_connectivity(const igraph_t *graph, igraph_integer_t *res,
- igraph_bool_t checks);
-
-int igraph_edge_disjoint_paths(const igraph_t *graph, igraph_integer_t *res,
- igraph_integer_t source,
- igraph_integer_t target);
-int igraph_vertex_disjoint_paths(const igraph_t *graph, igraph_integer_t *res,
- igraph_integer_t source,
- igraph_integer_t target);
-
-int igraph_adhesion(const igraph_t *graph, igraph_integer_t *res,
- igraph_bool_t checks);
-int igraph_cohesion(const igraph_t *graph, igraph_integer_t *res,
- igraph_bool_t checks);
+DECLDIR int igraph_maxflow(const igraph_t *graph, igraph_real_t *value,
+ igraph_vector_t *flow, igraph_vector_t *cut,
+ igraph_vector_t *partition, igraph_vector_t *partition2,
+ igraph_integer_t source, igraph_integer_t target,
+ const igraph_vector_t *capacity,
+ igraph_maxflow_stats_t *stats);
+DECLDIR int igraph_maxflow_value(const igraph_t *graph, igraph_real_t *value,
+ igraph_integer_t source, igraph_integer_t target,
+ const igraph_vector_t *capacity,
+ igraph_maxflow_stats_t *stats);
+
+DECLDIR int igraph_st_mincut(const igraph_t *graph, igraph_real_t *value,
+ igraph_vector_t *cut, igraph_vector_t *partition,
+ igraph_vector_t *partition2,
+ igraph_integer_t source, igraph_integer_t target,
+ const igraph_vector_t *capacity);
+DECLDIR int igraph_st_mincut_value(const igraph_t *graph, igraph_real_t *res,
+ igraph_integer_t source, igraph_integer_t target,
+ const igraph_vector_t *capacity);
+
+DECLDIR int igraph_mincut_value(const igraph_t *graph, igraph_real_t *res,
+ const igraph_vector_t *capacity);
+DECLDIR int igraph_mincut(const igraph_t *graph,
+ igraph_real_t *value,
+ igraph_vector_t *partition,
+ igraph_vector_t *partition2,
+ igraph_vector_t *cut,
+ const igraph_vector_t *capacity);
+
+DECLDIR int igraph_st_vertex_connectivity(const igraph_t *graph,
+ igraph_integer_t *res,
+ igraph_integer_t source,
+ igraph_integer_t target,
+ igraph_vconn_nei_t neighbors);
+DECLDIR int igraph_vertex_connectivity(const igraph_t *graph, igraph_integer_t *res,
+ igraph_bool_t checks);
+
+DECLDIR int igraph_st_edge_connectivity(const igraph_t *graph, igraph_integer_t *res,
+ igraph_integer_t source,
+ igraph_integer_t target);
+DECLDIR int igraph_edge_connectivity(const igraph_t *graph, igraph_integer_t *res,
+ igraph_bool_t checks);
+
+DECLDIR int igraph_edge_disjoint_paths(const igraph_t *graph, igraph_integer_t *res,
+ igraph_integer_t source,
+ igraph_integer_t target);
+DECLDIR int igraph_vertex_disjoint_paths(const igraph_t *graph, igraph_integer_t *res,
+ igraph_integer_t source,
+ igraph_integer_t target);
+
+DECLDIR int igraph_adhesion(const igraph_t *graph, igraph_integer_t *res,
+ igraph_bool_t checks);
+DECLDIR int igraph_cohesion(const igraph_t *graph, igraph_integer_t *res,
+ igraph_bool_t checks);
/* s-t cut listing related stuff */
-int igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar,
- igraph_vector_t *capacity);
+DECLDIR int igraph_even_tarjan_reduction(const igraph_t *graph, igraph_t *graphbar,
+ igraph_vector_t *capacity);
-int igraph_residual_graph(const igraph_t *graph,
- const igraph_vector_t *capacity,
- igraph_t *residual,
- igraph_vector_t *residual_capacity,
- const igraph_vector_t *flow);
+DECLDIR int igraph_residual_graph(const igraph_t *graph,
+ const igraph_vector_t *capacity,
+ igraph_t *residual,
+ igraph_vector_t *residual_capacity,
+ const igraph_vector_t *flow);
int igraph_i_residual_graph(const igraph_t *graph,
- const igraph_vector_t *capacity,
- igraph_t *residual,
- igraph_vector_t *residual_capacity,
- const igraph_vector_t *flow,
- igraph_vector_t *tmp);
+ const igraph_vector_t *capacity,
+ igraph_t *residual,
+ igraph_vector_t *residual_capacity,
+ const igraph_vector_t *flow,
+ igraph_vector_t *tmp);
int igraph_i_reverse_residual_graph(const igraph_t *graph,
- const igraph_vector_t *capacity,
- igraph_t *residual,
- const igraph_vector_t *flow,
- igraph_vector_t *tmp);
-int igraph_reverse_residual_graph(const igraph_t *graph,
- const igraph_vector_t *capacity,
- igraph_t *residual,
- const igraph_vector_t *flow);
-
-int igraph_dominator_tree(const igraph_t *graph,
- igraph_integer_t root,
- igraph_vector_t *dom,
- igraph_t *domtree,
- igraph_vector_t *leftout,
- igraph_neimode_t mode);
-
-int igraph_all_st_cuts(const igraph_t *graph,
- igraph_vector_ptr_t *cuts,
- igraph_vector_ptr_t *partition1s,
- igraph_integer_t source,
- igraph_integer_t target);
-
-int igraph_all_st_mincuts(const igraph_t *graph, igraph_real_t *value,
- igraph_vector_ptr_t *cuts,
- igraph_vector_ptr_t *partition1s,
- igraph_integer_t source,
- igraph_integer_t target,
- const igraph_vector_t *capacity);
-
-int igraph_gomory_hu_tree(const igraph_t *graph,
- igraph_t *tree,
- igraph_vector_t *flows,
- const igraph_vector_t *capacity);
+ const igraph_vector_t *capacity,
+ igraph_t *residual,
+ const igraph_vector_t *flow,
+ igraph_vector_t *tmp);
+DECLDIR int igraph_reverse_residual_graph(const igraph_t *graph,
+ const igraph_vector_t *capacity,
+ igraph_t *residual,
+ const igraph_vector_t *flow);
+
+DECLDIR int igraph_dominator_tree(const igraph_t *graph,
+ igraph_integer_t root,
+ igraph_vector_t *dom,
+ igraph_t *domtree,
+ igraph_vector_t *leftout,
+ igraph_neimode_t mode);
+
+DECLDIR int igraph_all_st_cuts(const igraph_t *graph,
+ igraph_vector_ptr_t *cuts,
+ igraph_vector_ptr_t *partition1s,
+ igraph_integer_t source,
+ igraph_integer_t target);
+
+DECLDIR int igraph_all_st_mincuts(const igraph_t *graph, igraph_real_t *value,
+ igraph_vector_ptr_t *cuts,
+ igraph_vector_ptr_t *partition1s,
+ igraph_integer_t source,
+ igraph_integer_t target,
+ const igraph_vector_t *capacity);
+
+DECLDIR int igraph_gomory_hu_tree(const igraph_t *graph,
+ igraph_t *tree,
+ igraph_vector_t *flows,
+ const igraph_vector_t *capacity);
__END_DECLS
diff --git a/src/include/igraph_foreign.h b/src/include/igraph_foreign.h
index 3ef9153..9dd38fd 100644
--- a/src/include/igraph_foreign.h
+++ b/src/include/igraph_foreign.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_FOREIGN_H
#define IGRAPH_FOREIGN_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_datatype.h"
#include "igraph_types.h"
@@ -47,47 +38,47 @@ __BEGIN_DECLS
/* Read and write foreign formats */
/* -------------------------------------------------- */
-int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream,
- igraph_integer_t n, igraph_bool_t directed);
-int igraph_read_graph_ncol(igraph_t *graph, FILE *instream,
- igraph_strvector_t *predefnames, igraph_bool_t names,
- igraph_add_weights_t weights, igraph_bool_t directed);
-int igraph_read_graph_lgl(igraph_t *graph, FILE *instream,
- igraph_bool_t names, igraph_add_weights_t weights,
- igraph_bool_t directed);
-int igraph_read_graph_pajek(igraph_t *graph, FILE *instream);
-int igraph_read_graph_graphml(igraph_t *graph, FILE *instream,
- int index);
-int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream,
- igraph_strvector_t *problem,
- igraph_vector_t *label,
- igraph_integer_t *source,
- igraph_integer_t *target,
- igraph_vector_t *capacity,
- igraph_bool_t directed);
-int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream,
- igraph_bool_t directed);
-int igraph_read_graph_gml(igraph_t *graph, FILE *instream);
-int igraph_read_graph_dl(igraph_t *graph, FILE *instream,
- igraph_bool_t directed);
+DECLDIR int igraph_read_graph_edgelist(igraph_t *graph, FILE *instream,
+ igraph_integer_t n, igraph_bool_t directed);
+DECLDIR int igraph_read_graph_ncol(igraph_t *graph, FILE *instream,
+ igraph_strvector_t *predefnames, igraph_bool_t names,
+ igraph_add_weights_t weights, igraph_bool_t directed);
+DECLDIR int igraph_read_graph_lgl(igraph_t *graph, FILE *instream,
+ igraph_bool_t names, igraph_add_weights_t weights,
+ igraph_bool_t directed);
+DECLDIR int igraph_read_graph_pajek(igraph_t *graph, FILE *instream);
+DECLDIR int igraph_read_graph_graphml(igraph_t *graph, FILE *instream,
+ int index);
+DECLDIR int igraph_read_graph_dimacs(igraph_t *graph, FILE *instream,
+ igraph_strvector_t *problem,
+ igraph_vector_t *label,
+ igraph_integer_t *source,
+ igraph_integer_t *target,
+ igraph_vector_t *capacity,
+ igraph_bool_t directed);
+DECLDIR int igraph_read_graph_graphdb(igraph_t *graph, FILE *instream,
+ igraph_bool_t directed);
+DECLDIR int igraph_read_graph_gml(igraph_t *graph, FILE *instream);
+DECLDIR int igraph_read_graph_dl(igraph_t *graph, FILE *instream,
+ igraph_bool_t directed);
-int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream);
-int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream,
- const char *names, const char *weights);
-int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream,
- const char *names, const char *weights,
- igraph_bool_t isolates);
-int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream,
- igraph_bool_t prefixattr);
-int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream);
-int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream,
- long int source, long int target,
- const igraph_vector_t *capacity);
-int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream,
- const igraph_vector_t *id, const char *creator);
-int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream);
-int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream,
- const char* vertex_attr_name, const char* edge_attr_name);
+DECLDIR int igraph_write_graph_edgelist(const igraph_t *graph, FILE *outstream);
+DECLDIR int igraph_write_graph_ncol(const igraph_t *graph, FILE *outstream,
+ const char *names, const char *weights);
+DECLDIR int igraph_write_graph_lgl(const igraph_t *graph, FILE *outstream,
+ const char *names, const char *weights,
+ igraph_bool_t isolates);
+DECLDIR int igraph_write_graph_graphml(const igraph_t *graph, FILE *outstream,
+ igraph_bool_t prefixattr);
+DECLDIR int igraph_write_graph_pajek(const igraph_t *graph, FILE *outstream);
+DECLDIR int igraph_write_graph_dimacs(const igraph_t *graph, FILE *outstream,
+ long int source, long int target,
+ const igraph_vector_t *capacity);
+DECLDIR int igraph_write_graph_gml(const igraph_t *graph, FILE *outstream,
+ const igraph_vector_t *id, const char *creator);
+DECLDIR int igraph_write_graph_dot(const igraph_t *graph, FILE *outstream);
+DECLDIR int igraph_write_graph_leda(const igraph_t *graph, FILE *outstream,
+ const char* vertex_attr_name, const char* edge_attr_name);
__END_DECLS
diff --git a/src/include/igraph_games.h b/src/include/igraph_games.h
index 311573c..9d6e71f 100644
--- a/src/include/igraph_games.h
+++ b/src/include/igraph_games.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_GAMES_H
#define IGRAPH_GAMES_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_matrix.h"
@@ -47,188 +38,188 @@ __BEGIN_DECLS
/* Constructors, games (=stochastic) */
/* -------------------------------------------------- */
-int igraph_barabasi_game(igraph_t *graph, igraph_integer_t n,
- igraph_real_t power,
- igraph_integer_t m,
- const igraph_vector_t *outseq,
- igraph_bool_t outpref,
- igraph_real_t A,
- igraph_bool_t directed,
- igraph_barabasi_algorithm_t algo,
- const igraph_t *start_from);
-int igraph_nonlinear_barabasi_game(igraph_t *graph, igraph_integer_t n,
- igraph_real_t power,
- igraph_integer_t m,
- const igraph_vector_t *outseq,
- igraph_bool_t outpref,
- igraph_real_t zeroappeal,
- igraph_bool_t directed);
-int igraph_erdos_renyi_game(igraph_t *graph, igraph_erdos_renyi_t type,
- igraph_integer_t n, igraph_real_t p,
- igraph_bool_t directed, igraph_bool_t loops);
-int igraph_erdos_renyi_game_gnp(igraph_t *graph, igraph_integer_t n, igraph_real_t p,
- igraph_bool_t directed, igraph_bool_t loops);
-int igraph_erdos_renyi_game_gnm(igraph_t *graph, igraph_integer_t n, igraph_real_t m,
- igraph_bool_t directed, igraph_bool_t loops);
-int igraph_degree_sequence_game(igraph_t *graph, const igraph_vector_t *out_deg,
- const igraph_vector_t *in_deg,
- igraph_degseq_t method);
-int igraph_growing_random_game(igraph_t *graph, igraph_integer_t n,
- igraph_integer_t m, igraph_bool_t directed, igraph_bool_t citation);
-int igraph_barabasi_aging_game(igraph_t *graph,
- igraph_integer_t nodes,
- igraph_integer_t m,
- const igraph_vector_t *outseq,
- igraph_bool_t outpref,
- igraph_real_t pa_exp,
- igraph_real_t aging_exp,
- igraph_integer_t aging_bin,
- igraph_real_t zero_deg_appeal,
- igraph_real_t zero_age_appeal,
- igraph_real_t deg_coef,
- igraph_real_t age_coef,
- igraph_bool_t directed);
-int igraph_recent_degree_game(igraph_t *graph, igraph_integer_t n,
- igraph_real_t power,
- igraph_integer_t window,
- igraph_integer_t m,
- const igraph_vector_t *outseq,
- igraph_bool_t outpref,
- igraph_real_t zero_appeal,
- igraph_bool_t directed);
-int igraph_recent_degree_aging_game(igraph_t *graph,
- igraph_integer_t nodes,
- igraph_integer_t m,
- const igraph_vector_t *outseq,
- igraph_bool_t outpref,
- igraph_real_t pa_exp,
- igraph_real_t aging_exp,
- igraph_integer_t aging_bin,
- igraph_integer_t window,
- igraph_real_t zero_appeal,
- igraph_bool_t directed);
-int igraph_callaway_traits_game (igraph_t *graph, igraph_integer_t nodes,
- igraph_integer_t types, igraph_integer_t edges_per_step,
- igraph_vector_t *type_dist,
- igraph_matrix_t *pref_matrix,
- igraph_bool_t directed);
-int igraph_establishment_game(igraph_t *graph, igraph_integer_t nodes,
- igraph_integer_t types, igraph_integer_t k,
- igraph_vector_t *type_dist,
- igraph_matrix_t *pref_matrix,
- igraph_bool_t directed);
-int igraph_grg_game(igraph_t *graph, igraph_integer_t nodes,
- igraph_real_t radius, igraph_bool_t torus,
- igraph_vector_t *x, igraph_vector_t *y);
-int igraph_preference_game(igraph_t *graph, igraph_integer_t nodes,
- igraph_integer_t types,
- const igraph_vector_t *type_dist,
- igraph_bool_t fixed_sizes,
- const igraph_matrix_t *pref_matrix,
- igraph_vector_t *node_type_vec,
- igraph_bool_t directed, igraph_bool_t loops);
-int igraph_asymmetric_preference_game(igraph_t *graph, igraph_integer_t nodes,
- igraph_integer_t types,
- igraph_matrix_t *type_dist_matrix,
- igraph_matrix_t *pref_matrix,
- igraph_vector_t *node_type_in_vec,
- igraph_vector_t *node_type_out_vec,
- igraph_bool_t loops);
-
-int igraph_rewire_edges(igraph_t *graph, igraph_real_t prob,
- igraph_bool_t loops, igraph_bool_t multiple);
-int igraph_watts_strogatz_game(igraph_t *graph, igraph_integer_t dim,
- igraph_integer_t size, igraph_integer_t nei,
- igraph_real_t p, igraph_bool_t loops,
- igraph_bool_t multiple);
-
-int igraph_lastcit_game(igraph_t *graph,
- igraph_integer_t nodes, igraph_integer_t edges_per_node,
- igraph_integer_t agebins,
- const igraph_vector_t *preference, igraph_bool_t directed);
-
-int igraph_cited_type_game(igraph_t *graph, igraph_integer_t nodes,
- const igraph_vector_t *types,
- const igraph_vector_t *pref,
- igraph_integer_t edges_per_step,
- igraph_bool_t directed);
-
-int igraph_citing_cited_type_game(igraph_t *graph, igraph_integer_t nodes,
- const igraph_vector_t *types,
- const igraph_matrix_t *pref,
- igraph_integer_t edges_per_step,
- igraph_bool_t directed);
-
-int igraph_forest_fire_game(igraph_t *graph, igraph_integer_t nodes,
- igraph_real_t fw_prob, igraph_real_t bw_factor,
- igraph_integer_t ambs, igraph_bool_t directed);
-
-
-int igraph_simple_interconnected_islands_game(
- igraph_t *graph,
- igraph_integer_t islands_n,
- igraph_integer_t islands_size,
- igraph_real_t islands_pin,
- igraph_integer_t n_inter);
-
-int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
+DECLDIR int igraph_barabasi_game(igraph_t *graph, igraph_integer_t n,
+ igraph_real_t power,
+ igraph_integer_t m,
+ const igraph_vector_t *outseq,
+ igraph_bool_t outpref,
+ igraph_real_t A,
+ igraph_bool_t directed,
+ igraph_barabasi_algorithm_t algo,
+ const igraph_t *start_from);
+DECLDIR int igraph_nonlinear_barabasi_game(igraph_t *graph, igraph_integer_t n,
+ igraph_real_t power,
+ igraph_integer_t m,
+ const igraph_vector_t *outseq,
+ igraph_bool_t outpref,
+ igraph_real_t zeroappeal,
+ igraph_bool_t directed);
+DECLDIR int igraph_erdos_renyi_game(igraph_t *graph, igraph_erdos_renyi_t type,
+ igraph_integer_t n, igraph_real_t p,
+ igraph_bool_t directed, igraph_bool_t loops);
+DECLDIR int igraph_erdos_renyi_game_gnp(igraph_t *graph, igraph_integer_t n, igraph_real_t p,
+ igraph_bool_t directed, igraph_bool_t loops);
+DECLDIR int igraph_erdos_renyi_game_gnm(igraph_t *graph, igraph_integer_t n, igraph_real_t m,
+ igraph_bool_t directed, igraph_bool_t loops);
+DECLDIR int igraph_degree_sequence_game(igraph_t *graph, const igraph_vector_t *out_deg,
+ const igraph_vector_t *in_deg,
+ igraph_degseq_t method);
+DECLDIR int igraph_growing_random_game(igraph_t *graph, igraph_integer_t n,
+ igraph_integer_t m, igraph_bool_t directed, igraph_bool_t citation);
+DECLDIR int igraph_barabasi_aging_game(igraph_t *graph,
+ igraph_integer_t nodes,
+ igraph_integer_t m,
+ const igraph_vector_t *outseq,
+ igraph_bool_t outpref,
+ igraph_real_t pa_exp,
+ igraph_real_t aging_exp,
+ igraph_integer_t aging_bin,
+ igraph_real_t zero_deg_appeal,
+ igraph_real_t zero_age_appeal,
+ igraph_real_t deg_coef,
+ igraph_real_t age_coef,
+ igraph_bool_t directed);
+DECLDIR int igraph_recent_degree_game(igraph_t *graph, igraph_integer_t n,
+ igraph_real_t power,
+ igraph_integer_t window,
+ igraph_integer_t m,
+ const igraph_vector_t *outseq,
+ igraph_bool_t outpref,
+ igraph_real_t zero_appeal,
+ igraph_bool_t directed);
+DECLDIR int igraph_recent_degree_aging_game(igraph_t *graph,
+ igraph_integer_t nodes,
+ igraph_integer_t m,
+ const igraph_vector_t *outseq,
+ igraph_bool_t outpref,
+ igraph_real_t pa_exp,
+ igraph_real_t aging_exp,
+ igraph_integer_t aging_bin,
+ igraph_integer_t window,
+ igraph_real_t zero_appeal,
+ igraph_bool_t directed);
+DECLDIR int igraph_callaway_traits_game (igraph_t *graph, igraph_integer_t nodes,
+ igraph_integer_t types, igraph_integer_t edges_per_step,
+ igraph_vector_t *type_dist,
+ igraph_matrix_t *pref_matrix,
+ igraph_bool_t directed);
+DECLDIR int igraph_establishment_game(igraph_t *graph, igraph_integer_t nodes,
+ igraph_integer_t types, igraph_integer_t k,
+ igraph_vector_t *type_dist,
+ igraph_matrix_t *pref_matrix,
+ igraph_bool_t directed);
+DECLDIR int igraph_grg_game(igraph_t *graph, igraph_integer_t nodes,
+ igraph_real_t radius, igraph_bool_t torus,
+ igraph_vector_t *x, igraph_vector_t *y);
+DECLDIR int igraph_preference_game(igraph_t *graph, igraph_integer_t nodes,
+ igraph_integer_t types,
+ const igraph_vector_t *type_dist,
+ igraph_bool_t fixed_sizes,
+ const igraph_matrix_t *pref_matrix,
+ igraph_vector_t *node_type_vec,
+ igraph_bool_t directed, igraph_bool_t loops);
+DECLDIR int igraph_asymmetric_preference_game(igraph_t *graph, igraph_integer_t nodes,
+ igraph_integer_t types,
+ igraph_matrix_t *type_dist_matrix,
+ igraph_matrix_t *pref_matrix,
+ igraph_vector_t *node_type_in_vec,
+ igraph_vector_t *node_type_out_vec,
+ igraph_bool_t loops);
+
+DECLDIR int igraph_rewire_edges(igraph_t *graph, igraph_real_t prob,
+ igraph_bool_t loops, igraph_bool_t multiple);
+DECLDIR int igraph_watts_strogatz_game(igraph_t *graph, igraph_integer_t dim,
+ igraph_integer_t size, igraph_integer_t nei,
+ igraph_real_t p, igraph_bool_t loops,
+ igraph_bool_t multiple);
+
+DECLDIR int igraph_lastcit_game(igraph_t *graph,
+ igraph_integer_t nodes, igraph_integer_t edges_per_node,
+ igraph_integer_t agebins,
+ const igraph_vector_t *preference, igraph_bool_t directed);
+
+DECLDIR int igraph_cited_type_game(igraph_t *graph, igraph_integer_t nodes,
+ const igraph_vector_t *types,
+ const igraph_vector_t *pref,
+ igraph_integer_t edges_per_step,
+ igraph_bool_t directed);
+
+DECLDIR int igraph_citing_cited_type_game(igraph_t *graph, igraph_integer_t nodes,
+ const igraph_vector_t *types,
+ const igraph_matrix_t *pref,
+ igraph_integer_t edges_per_step,
+ igraph_bool_t directed);
+
+DECLDIR int igraph_forest_fire_game(igraph_t *graph, igraph_integer_t nodes,
+ igraph_real_t fw_prob, igraph_real_t bw_factor,
+ igraph_integer_t ambs, igraph_bool_t directed);
+
+
+DECLDIR int igraph_simple_interconnected_islands_game(
+ igraph_t *graph,
+ igraph_integer_t islands_n,
+ igraph_integer_t islands_size,
+ igraph_real_t islands_pin,
+ igraph_integer_t n_inter);
+
+DECLDIR int igraph_static_fitness_game(igraph_t *graph, igraph_integer_t no_of_edges,
igraph_vector_t* fitness_out, igraph_vector_t* fitness_in,
igraph_bool_t loops, igraph_bool_t multiple);
-int igraph_static_power_law_game(igraph_t *graph,
- igraph_integer_t no_of_nodes, igraph_integer_t no_of_edges,
- igraph_real_t exponent_out, igraph_real_t exponent_in,
- igraph_bool_t loops, igraph_bool_t multiple,
- igraph_bool_t finite_size_correction);
-
-int igraph_k_regular_game(igraph_t *graph,
- igraph_integer_t no_of_nodes, igraph_integer_t k,
- igraph_bool_t directed, igraph_bool_t multiple);
-
-int igraph_sbm_game(igraph_t *graph, igraph_integer_t n,
- const igraph_matrix_t *pref_matrix,
- const igraph_vector_int_t *block_sizes,
- igraph_bool_t directed, igraph_bool_t loops);
-
-int igraph_hsbm_game(igraph_t *graph, igraph_integer_t n,
- igraph_integer_t m, const igraph_vector_t *rho,
- const igraph_matrix_t *C, igraph_real_t p);
-
-int igraph_hsbm_list_game(igraph_t *graph, igraph_integer_t n,
- const igraph_vector_int_t *mlist,
- const igraph_vector_ptr_t *rholist,
- const igraph_vector_ptr_t *Clist,
- igraph_real_t p);
-
-int igraph_correlated_game(const igraph_t *old_graph, igraph_t *new_graph,
- igraph_real_t corr, igraph_real_t p,
- const igraph_vector_t *permutation);
-
-int igraph_correlated_pair_game(igraph_t *graph1, igraph_t *graph2,
- int n, igraph_real_t corr, igraph_real_t p,
- igraph_bool_t directed,
- const igraph_vector_t *permutation);
-
-int igraph_dot_product_game(igraph_t *graph, const igraph_matrix_t *vecs,
- igraph_bool_t directed);
-
-int igraph_sample_sphere_surface(igraph_integer_t dim, igraph_integer_t n,
- igraph_real_t radius,
- igraph_bool_t positive,
- igraph_matrix_t *res);
-
-int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n,
- igraph_real_t radius,
- igraph_bool_t positive,
- igraph_matrix_t *res);
-
-int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n,
- igraph_real_t radius,
- igraph_bool_t positive,
- igraph_matrix_t *res);
-
-int igraph_sample_dirichlet(igraph_integer_t n, const igraph_vector_t *alpha,
- igraph_matrix_t *res);
+DECLDIR int igraph_static_power_law_game(igraph_t *graph,
+ igraph_integer_t no_of_nodes, igraph_integer_t no_of_edges,
+ igraph_real_t exponent_out, igraph_real_t exponent_in,
+ igraph_bool_t loops, igraph_bool_t multiple,
+ igraph_bool_t finite_size_correction);
+
+DECLDIR int igraph_k_regular_game(igraph_t *graph,
+ igraph_integer_t no_of_nodes, igraph_integer_t k,
+ igraph_bool_t directed, igraph_bool_t multiple);
+
+DECLDIR int igraph_sbm_game(igraph_t *graph, igraph_integer_t n,
+ const igraph_matrix_t *pref_matrix,
+ const igraph_vector_int_t *block_sizes,
+ igraph_bool_t directed, igraph_bool_t loops);
+
+DECLDIR int igraph_hsbm_game(igraph_t *graph, igraph_integer_t n,
+ igraph_integer_t m, const igraph_vector_t *rho,
+ const igraph_matrix_t *C, igraph_real_t p);
+
+DECLDIR int igraph_hsbm_list_game(igraph_t *graph, igraph_integer_t n,
+ const igraph_vector_int_t *mlist,
+ const igraph_vector_ptr_t *rholist,
+ const igraph_vector_ptr_t *Clist,
+ igraph_real_t p);
+
+DECLDIR int igraph_correlated_game(const igraph_t *old_graph, igraph_t *new_graph,
+ igraph_real_t corr, igraph_real_t p,
+ const igraph_vector_t *permutation);
+
+DECLDIR int igraph_correlated_pair_game(igraph_t *graph1, igraph_t *graph2,
+ int n, igraph_real_t corr, igraph_real_t p,
+ igraph_bool_t directed,
+ const igraph_vector_t *permutation);
+
+DECLDIR int igraph_dot_product_game(igraph_t *graph, const igraph_matrix_t *vecs,
+ igraph_bool_t directed);
+
+DECLDIR int igraph_sample_sphere_surface(igraph_integer_t dim, igraph_integer_t n,
+ igraph_real_t radius,
+ igraph_bool_t positive,
+ igraph_matrix_t *res);
+
+DECLDIR int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n,
+ igraph_real_t radius,
+ igraph_bool_t positive,
+ igraph_matrix_t *res);
+
+DECLDIR int igraph_sample_sphere_volume(igraph_integer_t dim, igraph_integer_t n,
+ igraph_real_t radius,
+ igraph_bool_t positive,
+ igraph_matrix_t *res);
+
+DECLDIR int igraph_sample_dirichlet(igraph_integer_t n, const igraph_vector_t *alpha,
+ igraph_matrix_t *res);
__END_DECLS
diff --git a/src/include/igraph_graphlets.h b/src/include/igraph_graphlets.h
index e3479fc..c332df4 100644
--- a/src/include/igraph_graphlets.h
+++ b/src/include/igraph_graphlets.h
@@ -24,47 +24,28 @@
#ifndef IGRAPH_GRAPHLETS_H
#define IGRAPH_GRAPHLETS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_datatype.h"
#include "igraph_vector_ptr.h"
#include "igraph_interface.h"
__BEGIN_DECLS
-int igraph_subclique_next(const igraph_t *graph,
- const igraph_vector_t *weights,
- const igraph_vector_int_t *ids,
- const igraph_vector_ptr_t *cliques,
- igraph_vector_ptr_t *result,
- igraph_vector_ptr_t *resultweights,
- igraph_vector_ptr_t *resultids,
- igraph_vector_t *clique_thr,
- igraph_vector_t *next_thr);
-
-int igraph_graphlets_candidate_basis(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_vector_ptr_t *cliques,
- igraph_vector_t *thresholds);
-
-int igraph_graphlets_project(const igraph_t *graph,
- const igraph_vector_t *weights,
- const igraph_vector_ptr_t *cliques,
- igraph_vector_t *Mu, igraph_bool_t startMu,
- int niter);
-
-int igraph_graphlets(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_vector_ptr_t *cliques,
- igraph_vector_t *Mu, int niter);
+DECLDIR int igraph_graphlets_candidate_basis(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_vector_ptr_t *cliques,
+ igraph_vector_t *thresholds);
+
+DECLDIR int igraph_graphlets_project(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ const igraph_vector_ptr_t *cliques,
+ igraph_vector_t *Mu, igraph_bool_t startMu,
+ int niter);
+
+DECLDIR int igraph_graphlets(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_vector_ptr_t *cliques,
+ igraph_vector_t *Mu, int niter);
__END_DECLS
diff --git a/src/include/igraph_heap.h b/src/include/igraph_heap.h
index 5e46ed9..0f3e921 100644
--- a/src/include/igraph_heap.h
+++ b/src/include/igraph_heap.h
@@ -24,15 +24,7 @@
#ifndef IGRAPH_HEAP_H
#define IGRAPH_HEAP_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
diff --git a/src/include/igraph_heap_pmt.h b/src/include/igraph_heap_pmt.h
index 02a704a..6463a65 100644
--- a/src/include/igraph_heap_pmt.h
+++ b/src/include/igraph_heap_pmt.h
@@ -28,15 +28,15 @@ typedef struct TYPE(igraph_heap) {
int destroy;
} TYPE(igraph_heap);
-int FUNCTION(igraph_heap,init)(TYPE(igraph_heap)* h, long int size);
-int FUNCTION(igraph_heap,init_array)(TYPE(igraph_heap) *t, BASE* data, long int len);
-void FUNCTION(igraph_heap,destroy)(TYPE(igraph_heap)* h);
-igraph_bool_t FUNCTION(igraph_heap,empty)(TYPE(igraph_heap)* h);
-int FUNCTION(igraph_heap,push)(TYPE(igraph_heap)* h, BASE elem);
-BASE FUNCTION(igraph_heap,top)(TYPE(igraph_heap)* h);
-BASE FUNCTION(igraph_heap,delete_top)(TYPE(igraph_heap)* h);
-long int FUNCTION(igraph_heap,size)(TYPE(igraph_heap)* h);
-int FUNCTION(igraph_heap,reserve)(TYPE(igraph_heap)* h, long int size);
+DECLDIR int FUNCTION(igraph_heap,init)(TYPE(igraph_heap)* h, long int size);
+DECLDIR int FUNCTION(igraph_heap,init_array)(TYPE(igraph_heap) *t, BASE* data, long int len);
+DECLDIR void FUNCTION(igraph_heap,destroy)(TYPE(igraph_heap)* h);
+DECLDIR igraph_bool_t FUNCTION(igraph_heap,empty)(TYPE(igraph_heap)* h);
+DECLDIR int FUNCTION(igraph_heap,push)(TYPE(igraph_heap)* h, BASE elem);
+DECLDIR BASE FUNCTION(igraph_heap,top)(TYPE(igraph_heap)* h);
+DECLDIR BASE FUNCTION(igraph_heap,delete_top)(TYPE(igraph_heap)* h);
+DECLDIR long int FUNCTION(igraph_heap,size)(TYPE(igraph_heap)* h);
+DECLDIR int FUNCTION(igraph_heap,reserve)(TYPE(igraph_heap)* h, long int size);
void FUNCTION(igraph_heap,i_build)(BASE* arr, long int size, long int head);
void FUNCTION(igraph_heap,i_shift_up)(BASE* arr, long int size, long int elem);
diff --git a/src/include/igraph_hrg.h b/src/include/igraph_hrg.h
index cb50518..3b3bbc9 100644
--- a/src/include/igraph_hrg.h
+++ b/src/include/igraph_hrg.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_HRG_H
#define IGRAPH_HRG_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_vector.h"
#include "igraph_vector_ptr.h"
#include "igraph_datatype.h"
@@ -77,46 +68,46 @@ typedef struct igraph_hrg_t {
igraph_vector_t left, right, prob, edges, vertices;
} igraph_hrg_t;
-int igraph_hrg_init(igraph_hrg_t *hrg, int n);
-void igraph_hrg_destroy(igraph_hrg_t *hrg);
-int igraph_hrg_size(const igraph_hrg_t *hrg);
-int igraph_hrg_resize(igraph_hrg_t *hrg, int newsize);
-
-int igraph_hrg_fit(const igraph_t *graph,
- igraph_hrg_t *hrg,
- igraph_bool_t start,
- int steps);
-
-int igraph_hrg_sample(const igraph_t *graph,
- igraph_t *sample,
- igraph_vector_ptr_t *samples,
- igraph_hrg_t *hrg,
- igraph_bool_t start);
-
-int igraph_hrg_game(igraph_t *graph,
- const igraph_hrg_t *hrg);
-
-int igraph_hrg_dendrogram(igraph_t *graph,
- const igraph_hrg_t *hrg);
-
-int igraph_hrg_consensus(const igraph_t *graph,
- igraph_vector_t *parents,
- igraph_vector_t *weights,
- igraph_hrg_t *hrg,
- igraph_bool_t start,
- int num_samples);
-
-int igraph_hrg_predict(const igraph_t *graph,
- igraph_vector_t *edges,
- igraph_vector_t *prob,
- igraph_hrg_t *hrg,
- igraph_bool_t start,
- int num_samples,
- int num_bins);
-
-int igraph_hrg_create(igraph_hrg_t *hrg,
- const igraph_t *graph,
- const igraph_vector_t *prob);
+DECLDIR int igraph_hrg_init(igraph_hrg_t *hrg, int n);
+DECLDIR void igraph_hrg_destroy(igraph_hrg_t *hrg);
+DECLDIR int igraph_hrg_size(const igraph_hrg_t *hrg);
+DECLDIR int igraph_hrg_resize(igraph_hrg_t *hrg, int newsize);
+
+DECLDIR int igraph_hrg_fit(const igraph_t *graph,
+ igraph_hrg_t *hrg,
+ igraph_bool_t start,
+ int steps);
+
+DECLDIR int igraph_hrg_sample(const igraph_t *graph,
+ igraph_t *sample,
+ igraph_vector_ptr_t *samples,
+ igraph_hrg_t *hrg,
+ igraph_bool_t start);
+
+DECLDIR int igraph_hrg_game(igraph_t *graph,
+ const igraph_hrg_t *hrg);
+
+DECLDIR int igraph_hrg_dendrogram(igraph_t *graph,
+ const igraph_hrg_t *hrg);
+
+DECLDIR int igraph_hrg_consensus(const igraph_t *graph,
+ igraph_vector_t *parents,
+ igraph_vector_t *weights,
+ igraph_hrg_t *hrg,
+ igraph_bool_t start,
+ int num_samples);
+
+DECLDIR int igraph_hrg_predict(const igraph_t *graph,
+ igraph_vector_t *edges,
+ igraph_vector_t *prob,
+ igraph_hrg_t *hrg,
+ igraph_bool_t start,
+ int num_samples,
+ int num_bins);
+
+DECLDIR int igraph_hrg_create(igraph_hrg_t *hrg,
+ const igraph_t *graph,
+ const igraph_vector_t *prob);
__END_DECLS
diff --git a/src/include/igraph_interface.h b/src/include/igraph_interface.h
index 4031b1f..1e97f2f 100644
--- a/src/include/igraph_interface.h
+++ b/src/include/igraph_interface.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_INTERFACE_H
#define IGRAPH_INTERFACE_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
#include "igraph_iterators.h"
@@ -44,46 +35,46 @@ __BEGIN_DECLS
/* Interface */
/* -------------------------------------------------- */
-int igraph_empty(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed);
-int igraph_empty_attrs(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, void *attr);
-int igraph_destroy(igraph_t *graph);
-int igraph_copy(igraph_t *to, const igraph_t *from);
-int igraph_add_edges(igraph_t *graph, const igraph_vector_t *edges,
- void *attr);
-int igraph_add_vertices(igraph_t *graph, igraph_integer_t nv,
- void *attr);
-int igraph_delete_edges(igraph_t *graph, igraph_es_t edges);
-int igraph_delete_vertices(igraph_t *graph, const igraph_vs_t vertices);
-int igraph_delete_vertices_idx(igraph_t *graph, const igraph_vs_t vertices,
- igraph_vector_t *idx,
- igraph_vector_t *invidx);
-igraph_integer_t igraph_vcount(const igraph_t *graph);
-igraph_integer_t igraph_ecount(const igraph_t *graph);
-int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t vid,
- igraph_neimode_t mode);
-igraph_bool_t igraph_is_directed(const igraph_t *graph);
-int igraph_degree(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vs_t vids, igraph_neimode_t mode,
- igraph_bool_t loops);
-int igraph_edge(const igraph_t *graph, igraph_integer_t eid,
- igraph_integer_t *from, igraph_integer_t *to);
-int igraph_edges(const igraph_t *graph, igraph_es_t eids,
- igraph_vector_t *edges);
-int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid,
- igraph_integer_t from, igraph_integer_t to,
- igraph_bool_t directed, igraph_bool_t error);
-int igraph_get_eids(const igraph_t *graph, igraph_vector_t *eids,
- const igraph_vector_t *pairs,
- const igraph_vector_t *path,
- igraph_bool_t directed, igraph_bool_t error);
-int igraph_get_eids_multi(const igraph_t *graph, igraph_vector_t *eids,
- const igraph_vector_t *pairs,
- const igraph_vector_t *path,
- igraph_bool_t directed, igraph_bool_t error);
-int igraph_adjacent(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid,
- igraph_neimode_t mode); /* deprecated */
-int igraph_incident(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid,
- igraph_neimode_t mode);
+DECLDIR int igraph_empty(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed);
+DECLDIR int igraph_empty_attrs(igraph_t *graph, igraph_integer_t n, igraph_bool_t directed, void *attr);
+DECLDIR int igraph_destroy(igraph_t *graph);
+DECLDIR int igraph_copy(igraph_t *to, const igraph_t *from);
+DECLDIR int igraph_add_edges(igraph_t *graph, const igraph_vector_t *edges,
+ void *attr);
+DECLDIR int igraph_add_vertices(igraph_t *graph, igraph_integer_t nv,
+ void *attr);
+DECLDIR int igraph_delete_edges(igraph_t *graph, igraph_es_t edges);
+DECLDIR int igraph_delete_vertices(igraph_t *graph, const igraph_vs_t vertices);
+DECLDIR int igraph_delete_vertices_idx(igraph_t *graph, const igraph_vs_t vertices,
+ igraph_vector_t *idx,
+ igraph_vector_t *invidx);
+DECLDIR igraph_integer_t igraph_vcount(const igraph_t *graph);
+DECLDIR igraph_integer_t igraph_ecount(const igraph_t *graph);
+DECLDIR int igraph_neighbors(const igraph_t *graph, igraph_vector_t *neis, igraph_integer_t vid,
+ igraph_neimode_t mode);
+DECLDIR igraph_bool_t igraph_is_directed(const igraph_t *graph);
+DECLDIR int igraph_degree(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vs_t vids, igraph_neimode_t mode,
+ igraph_bool_t loops);
+DECLDIR int igraph_edge(const igraph_t *graph, igraph_integer_t eid,
+ igraph_integer_t *from, igraph_integer_t *to);
+DECLDIR int igraph_edges(const igraph_t *graph, igraph_es_t eids,
+ igraph_vector_t *edges);
+DECLDIR int igraph_get_eid(const igraph_t *graph, igraph_integer_t *eid,
+ igraph_integer_t from, igraph_integer_t to,
+ igraph_bool_t directed, igraph_bool_t error);
+DECLDIR int igraph_get_eids(const igraph_t *graph, igraph_vector_t *eids,
+ const igraph_vector_t *pairs,
+ const igraph_vector_t *path,
+ igraph_bool_t directed, igraph_bool_t error);
+DECLDIR int igraph_get_eids_multi(const igraph_t *graph, igraph_vector_t *eids,
+ const igraph_vector_t *pairs,
+ const igraph_vector_t *path,
+ igraph_bool_t directed, igraph_bool_t error);
+DECLDIR int igraph_adjacent(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid,
+ igraph_neimode_t mode); /* deprecated */
+DECLDIR int igraph_incident(const igraph_t *graph, igraph_vector_t *eids, igraph_integer_t vid,
+ igraph_neimode_t mode);
#define IGRAPH_FROM(g,e) ((igraph_integer_t)(VECTOR((g)->from)[(long int)(e)]))
#define IGRAPH_TO(g,e) ((igraph_integer_t)(VECTOR((g)->to) [(long int)(e)]))
diff --git a/src/include/igraph_interrupt.h b/src/include/igraph_interrupt.h
index 8907401..b8b7b22 100644
--- a/src/include/igraph_interrupt.h
+++ b/src/include/igraph_interrupt.h
@@ -25,16 +25,7 @@
#define IGRAPH_INTERRUPT_H
#include "igraph_error.h"
-
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -128,10 +119,9 @@ typedef int igraph_interruption_handler_t (void* data);
* \return \c IGRAPH_SUCCESS if the calculation should go on, anything else otherwise.
*/
-int igraph_allow_interruption(void* data);
+DECLDIR int igraph_allow_interruption(void* data);
-igraph_interruption_handler_t *
-igraph_set_interruption_handler (igraph_interruption_handler_t * new_handler);
+DECLDIR igraph_interruption_handler_t * igraph_set_interruption_handler (igraph_interruption_handler_t * new_handler);
__END_DECLS
diff --git a/src/include/igraph_iterators.h b/src/include/igraph_iterators.h
index 224e9cb..154a2ad 100644
--- a/src/include/igraph_iterators.h
+++ b/src/include/igraph_iterators.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_ITERATORS_H
#define IGRAPH_ITERATORS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
__BEGIN_DECLS
@@ -67,45 +58,45 @@ typedef struct igraph_vs_t {
} data;
} igraph_vs_t;
-int igraph_vs_all(igraph_vs_t *vs);
-igraph_vs_t igraph_vss_all(void);
+DECLDIR int igraph_vs_all(igraph_vs_t *vs);
+DECLDIR igraph_vs_t igraph_vss_all(void);
-int igraph_vs_adj(igraph_vs_t *vs,
- igraph_integer_t vid, igraph_neimode_t mode);
-igraph_vs_t igraph_vss_adj(igraph_integer_t vid, igraph_neimode_t mode);
+DECLDIR int igraph_vs_adj(igraph_vs_t *vs,
+ igraph_integer_t vid, igraph_neimode_t mode);
+DECLDIR igraph_vs_t igraph_vss_adj(igraph_integer_t vid, igraph_neimode_t mode);
-int igraph_vs_nonadj(igraph_vs_t *vs, igraph_integer_t vid,
- igraph_neimode_t mode);
+DECLDIR int igraph_vs_nonadj(igraph_vs_t *vs, igraph_integer_t vid,
+ igraph_neimode_t mode);
-int igraph_vs_none(igraph_vs_t *vs);
-igraph_vs_t igraph_vss_none(void);
+DECLDIR int igraph_vs_none(igraph_vs_t *vs);
+DECLDIR igraph_vs_t igraph_vss_none(void);
-int igraph_vs_1(igraph_vs_t *vs, igraph_integer_t vid);
-igraph_vs_t igraph_vss_1(igraph_integer_t vid);
+DECLDIR int igraph_vs_1(igraph_vs_t *vs, igraph_integer_t vid);
+DECLDIR igraph_vs_t igraph_vss_1(igraph_integer_t vid);
-int igraph_vs_vector(igraph_vs_t *vs,
- const igraph_vector_t *v);
-igraph_vs_t igraph_vss_vector(const igraph_vector_t *v);
+DECLDIR int igraph_vs_vector(igraph_vs_t *vs,
+ const igraph_vector_t *v);
+DECLDIR igraph_vs_t igraph_vss_vector(const igraph_vector_t *v);
-int igraph_vs_vector_small(igraph_vs_t *vs, ...);
+DECLDIR int igraph_vs_vector_small(igraph_vs_t *vs, ...);
-int igraph_vs_vector_copy(igraph_vs_t *vs,
- const igraph_vector_t *v);
+DECLDIR int igraph_vs_vector_copy(igraph_vs_t *vs,
+ const igraph_vector_t *v);
-int igraph_vs_seq(igraph_vs_t *vs, igraph_integer_t from, igraph_integer_t to);
-igraph_vs_t igraph_vss_seq(igraph_integer_t from, igraph_integer_t to);
+DECLDIR int igraph_vs_seq(igraph_vs_t *vs, igraph_integer_t from, igraph_integer_t to);
+DECLDIR igraph_vs_t igraph_vss_seq(igraph_integer_t from, igraph_integer_t to);
-void igraph_vs_destroy(igraph_vs_t *vs);
+DECLDIR void igraph_vs_destroy(igraph_vs_t *vs);
-igraph_bool_t igraph_vs_is_all(const igraph_vs_t *vs);
+DECLDIR igraph_bool_t igraph_vs_is_all(const igraph_vs_t *vs);
-int igraph_vs_copy(igraph_vs_t* dest, const igraph_vs_t* src);
+DECLDIR int igraph_vs_copy(igraph_vs_t* dest, const igraph_vs_t* src);
-int igraph_vs_as_vector(const igraph_t *graph, igraph_vs_t vs,
- igraph_vector_t *v);
-int igraph_vs_size(const igraph_t *graph, const igraph_vs_t *vs,
- igraph_integer_t *result);
-int igraph_vs_type(const igraph_vs_t *vs);
+DECLDIR int igraph_vs_as_vector(const igraph_t *graph, igraph_vs_t vs,
+ igraph_vector_t *v);
+DECLDIR int igraph_vs_size(const igraph_t *graph, const igraph_vs_t *vs,
+ igraph_integer_t *result);
+DECLDIR int igraph_vs_type(const igraph_vs_t *vs);
/* -------------------------------------------------- */
/* Vertex iterators */
@@ -217,11 +208,11 @@ typedef struct igraph_vit_t {
((igraph_integer_t)(((vit).type == IGRAPH_VIT_SEQ) ? (vit).pos : \
VECTOR(*(vit).vec)[(vit).pos]))
-int igraph_vit_create(const igraph_t *graph,
- igraph_vs_t vs, igraph_vit_t *vit);
-void igraph_vit_destroy(const igraph_vit_t *vit);
+DECLDIR int igraph_vit_create(const igraph_t *graph,
+ igraph_vs_t vs, igraph_vit_t *vit);
+DECLDIR void igraph_vit_destroy(const igraph_vit_t *vit);
-int igraph_vit_as_vector(const igraph_vit_t *vit, igraph_vector_t *v);
+DECLDIR int igraph_vit_as_vector(const igraph_vit_t *vit, igraph_vector_t *v);
/* -------------------------------------------------- */
/* Edge Selectors */
@@ -261,55 +252,55 @@ typedef struct igraph_es_t {
} data;
} igraph_es_t;
-int igraph_es_all(igraph_es_t *es,
- igraph_edgeorder_type_t order);
-igraph_es_t igraph_ess_all(igraph_edgeorder_type_t order);
+DECLDIR int igraph_es_all(igraph_es_t *es,
+ igraph_edgeorder_type_t order);
+DECLDIR igraph_es_t igraph_ess_all(igraph_edgeorder_type_t order);
-int igraph_es_adj(igraph_es_t *es,
- igraph_integer_t vid, igraph_neimode_t mode); /* deprecated */
-int igraph_es_incident(igraph_es_t *es,
- igraph_integer_t vid, igraph_neimode_t mode);
+DECLDIR int igraph_es_adj(igraph_es_t *es,
+ igraph_integer_t vid, igraph_neimode_t mode); /* deprecated */
+DECLDIR int igraph_es_incident(igraph_es_t *es,
+ igraph_integer_t vid, igraph_neimode_t mode);
-int igraph_es_none(igraph_es_t *es);
-igraph_es_t igraph_ess_none(void);
+DECLDIR int igraph_es_none(igraph_es_t *es);
+DECLDIR igraph_es_t igraph_ess_none(void);
-int igraph_es_1(igraph_es_t *es, igraph_integer_t eid);
-igraph_es_t igraph_ess_1(igraph_integer_t eid);
+DECLDIR int igraph_es_1(igraph_es_t *es, igraph_integer_t eid);
+DECLDIR igraph_es_t igraph_ess_1(igraph_integer_t eid);
-int igraph_es_vector(igraph_es_t *es,
- const igraph_vector_t *v);
-igraph_es_t igraph_ess_vector(const igraph_vector_t *v);
+DECLDIR int igraph_es_vector(igraph_es_t *es,
+ const igraph_vector_t *v);
+DECLDIR igraph_es_t igraph_ess_vector(const igraph_vector_t *v);
-int igraph_es_fromto(igraph_es_t *es,
- igraph_vs_t from, igraph_vs_t to);
+DECLDIR int igraph_es_fromto(igraph_es_t *es,
+ igraph_vs_t from, igraph_vs_t to);
-int igraph_es_seq(igraph_es_t *es, igraph_integer_t from, igraph_integer_t to);
-igraph_es_t igraph_ess_seq(igraph_integer_t from, igraph_integer_t to);
+DECLDIR int igraph_es_seq(igraph_es_t *es, igraph_integer_t from, igraph_integer_t to);
+DECLDIR igraph_es_t igraph_ess_seq(igraph_integer_t from, igraph_integer_t to);
-int igraph_es_vector_copy(igraph_es_t *es, const igraph_vector_t *v);
+DECLDIR int igraph_es_vector_copy(igraph_es_t *es, const igraph_vector_t *v);
-int igraph_es_pairs(igraph_es_t *es, const igraph_vector_t *v,
+DECLDIR int igraph_es_pairs(igraph_es_t *es, const igraph_vector_t *v,
igraph_bool_t directed);
-int igraph_es_pairs_small(igraph_es_t *es, igraph_bool_t directed, ...);
+DECLDIR int igraph_es_pairs_small(igraph_es_t *es, igraph_bool_t directed, ...);
-int igraph_es_multipairs(igraph_es_t *es, const igraph_vector_t *v,
+DECLDIR int igraph_es_multipairs(igraph_es_t *es, const igraph_vector_t *v,
igraph_bool_t directed);
-int igraph_es_path(igraph_es_t *es, const igraph_vector_t *v,
+DECLDIR int igraph_es_path(igraph_es_t *es, const igraph_vector_t *v,
igraph_bool_t directed);
-int igraph_es_path_small(igraph_es_t *es, igraph_bool_t directed, ...);
+DECLDIR int igraph_es_path_small(igraph_es_t *es, igraph_bool_t directed, ...);
-void igraph_es_destroy(igraph_es_t *es);
+DECLDIR void igraph_es_destroy(igraph_es_t *es);
-igraph_bool_t igraph_es_is_all(const igraph_es_t *es);
+DECLDIR igraph_bool_t igraph_es_is_all(const igraph_es_t *es);
-int igraph_es_copy(igraph_es_t* dest, const igraph_es_t* src);
+DECLDIR int igraph_es_copy(igraph_es_t* dest, const igraph_es_t* src);
-int igraph_es_as_vector(const igraph_t *graph, igraph_es_t es,
- igraph_vector_t *v);
-int igraph_es_size(const igraph_t *graph, const igraph_es_t *es,
- igraph_integer_t *result);
-int igraph_es_type(const igraph_es_t *es);
+DECLDIR int igraph_es_as_vector(const igraph_t *graph, igraph_es_t es,
+ igraph_vector_t *v);
+DECLDIR int igraph_es_size(const igraph_t *graph, const igraph_es_t *es,
+ igraph_integer_t *result);
+DECLDIR int igraph_es_type(const igraph_es_t *es);
/* -------------------------------------------------- */
@@ -399,11 +390,11 @@ typedef struct igraph_eit_t {
(igraph_integer_t)((((eit).type == IGRAPH_EIT_SEQ) ? (eit).pos : \
VECTOR(*(eit).vec)[(eit).pos]))
-int igraph_eit_create(const igraph_t *graph,
- igraph_es_t es, igraph_eit_t *eit);
-void igraph_eit_destroy(const igraph_eit_t *eit);
+DECLDIR int igraph_eit_create(const igraph_t *graph,
+ igraph_es_t es, igraph_eit_t *eit);
+DECLDIR void igraph_eit_destroy(const igraph_eit_t *eit);
-int igraph_eit_as_vector(const igraph_eit_t *eit, igraph_vector_t *v);
+DECLDIR int igraph_eit_as_vector(const igraph_eit_t *eit, igraph_vector_t *v);
__END_DECLS
diff --git a/src/include/igraph_lapack.h b/src/include/igraph_lapack.h
index 4c862f4..d9858fc 100644
--- a/src/include/igraph_lapack.h
+++ b/src/include/igraph_lapack.h
@@ -26,16 +26,7 @@
#include "igraph_vector.h"
#include "igraph_matrix.h"
-
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -65,31 +56,31 @@ __BEGIN_DECLS
* </para>
*/
-int igraph_lapack_dgetrf(igraph_matrix_t *a, igraph_vector_int_t *ipiv,
- int *info);
-int igraph_lapack_dgetrs(igraph_bool_t transpose, const igraph_matrix_t *a,
- igraph_vector_int_t *ipiv, igraph_matrix_t *b);
-int igraph_lapack_dgesv(igraph_matrix_t *a, igraph_vector_int_t *ipiv,
- igraph_matrix_t *b, int *info);
+DECLDIR int igraph_lapack_dgetrf(igraph_matrix_t *a, igraph_vector_int_t *ipiv,
+ int *info);
+DECLDIR int igraph_lapack_dgetrs(igraph_bool_t transpose, const igraph_matrix_t *a,
+ igraph_vector_int_t *ipiv, igraph_matrix_t *b);
+DECLDIR int igraph_lapack_dgesv(igraph_matrix_t *a, igraph_vector_int_t *ipiv,
+ igraph_matrix_t *b, int *info);
typedef enum { IGRAPH_LAPACK_DSYEV_ALL,
IGRAPH_LAPACK_DSYEV_INTERVAL,
IGRAPH_LAPACK_DSYEV_SELECT } igraph_lapack_dsyev_which_t;
-int igraph_lapack_dsyevr(const igraph_matrix_t *A,
- igraph_lapack_dsyev_which_t which,
- igraph_real_t vl, igraph_real_t vu, int vestimate,
- int il, int iu, igraph_real_t abstol,
- igraph_vector_t *values, igraph_matrix_t *vectors,
- igraph_vector_int_t *support);
+DECLDIR int igraph_lapack_dsyevr(const igraph_matrix_t *A,
+ igraph_lapack_dsyev_which_t which,
+ igraph_real_t vl, igraph_real_t vu, int vestimate,
+ int il, int iu, igraph_real_t abstol,
+ igraph_vector_t *values, igraph_matrix_t *vectors,
+ igraph_vector_int_t *support);
/* TODO: should we use complex vectors/matrices? */
-int igraph_lapack_dgeev(const igraph_matrix_t *A,
- igraph_vector_t *valuesreal,
- igraph_vector_t *valuesimag,
- igraph_matrix_t *vectorsleft,
- igraph_matrix_t *vectorsright, int *info);
+DECLDIR int igraph_lapack_dgeev(const igraph_matrix_t *A,
+ igraph_vector_t *valuesreal,
+ igraph_vector_t *valuesimag,
+ igraph_matrix_t *vectorsleft,
+ igraph_matrix_t *vectorsright, int *info);
typedef enum { IGRAPH_LAPACK_DGEEVX_BALANCE_NONE=0,
IGRAPH_LAPACK_DGEEVX_BALANCE_PERM,
@@ -97,24 +88,24 @@ typedef enum { IGRAPH_LAPACK_DGEEVX_BALANCE_NONE=0,
IGRAPH_LAPACK_DGEEVX_BALANCE_BOTH }
igraph_lapack_dgeevx_balance_t;
-int igraph_lapack_dgeevx(igraph_lapack_dgeevx_balance_t balance,
- const igraph_matrix_t *A,
- igraph_vector_t *valuesreal,
- igraph_vector_t *valuesimag,
- igraph_matrix_t *vectorsleft,
- igraph_matrix_t *vectorsright,
- int *ilo, int *ihi, igraph_vector_t *scale,
- igraph_real_t *abnrm,
- igraph_vector_t *rconde,
- igraph_vector_t *rcondv,
- int *info);
-
-int igraph_lapack_dgehrd(const igraph_matrix_t *A,
- int ilo, int ihi,
- igraph_matrix_t *result);
-
-int igraph_lapack_ddot(const igraph_vector_t *v1, const igraph_vector_t *v2,
- igraph_real_t *res);
+DECLDIR int igraph_lapack_dgeevx(igraph_lapack_dgeevx_balance_t balance,
+ const igraph_matrix_t *A,
+ igraph_vector_t *valuesreal,
+ igraph_vector_t *valuesimag,
+ igraph_matrix_t *vectorsleft,
+ igraph_matrix_t *vectorsright,
+ int *ilo, int *ihi, igraph_vector_t *scale,
+ igraph_real_t *abnrm,
+ igraph_vector_t *rconde,
+ igraph_vector_t *rcondv,
+ int *info);
+
+DECLDIR int igraph_lapack_dgehrd(const igraph_matrix_t *A,
+ int ilo, int ihi,
+ igraph_matrix_t *result);
+
+DECLDIR int igraph_lapack_ddot(const igraph_vector_t *v1, const igraph_vector_t *v2,
+ igraph_real_t *res);
__END_DECLS
diff --git a/src/include/igraph_layout.h b/src/include/igraph_layout.h
index 17cd17b..c0fdbf6 100644
--- a/src/include/igraph_layout.h
+++ b/src/include/igraph_layout.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_LAYOUT_H
#define IGRAPH_LAYOUT_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -49,93 +40,93 @@ __BEGIN_DECLS
/* Layouts */
/* -------------------------------------------------- */
-int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res);
-int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res,
- igraph_vs_t order);
-int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res,
- igraph_integer_t center, const igraph_vector_t *order);
-int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width);
-int igraph_layout_fruchterman_reingold(const igraph_t *graph,
- igraph_matrix_t *res,
- igraph_bool_t use_seed,
- igraph_integer_t niter,
- igraph_real_t start_temp,
- igraph_layout_grid_t grid,
- const igraph_vector_t *weight,
- const igraph_vector_t *minx,
- const igraph_vector_t *maxx,
- const igraph_vector_t *miny,
- const igraph_vector_t *maxy);
-
-int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
- igraph_bool_t use_seed, igraph_integer_t maxiter,
- igraph_real_t epsilon, igraph_real_t kkconst,
- const igraph_vector_t *weights,
- const igraph_vector_t *minx, const igraph_vector_t *maxx,
- const igraph_vector_t *miny, const igraph_vector_t *maxy);
-
-int igraph_layout_springs(const igraph_t *graph, igraph_matrix_t *res,
- igraph_real_t mass, igraph_real_t equil, igraph_real_t k,
- igraph_real_t repeqdis, igraph_real_t kfr, igraph_bool_t repulse);
-int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res,
- igraph_integer_t maxiter, igraph_real_t maxdelta,
- igraph_real_t area, igraph_real_t coolexp,
- igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t root);
-int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res,
- igraph_neimode_t mode,
- const igraph_vector_t *roots,
- const igraph_vector_t *rootlevel);
-int igraph_layout_reingold_tilford_circular(const igraph_t *graph,
- igraph_matrix_t *res,
- igraph_neimode_t mode,
- const igraph_vector_t *roots,
- const igraph_vector_t *rootlevel);
-int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res,
- igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids,
- const igraph_vector_t* layers, igraph_real_t hgap,
- igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights);
-
-int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res);
-int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res);
-int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res,
- long int width, long int height);
-int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph,
- igraph_matrix_t *res,
- igraph_bool_t use_seed,
- igraph_integer_t niter,
- igraph_real_t start_temp,
- const igraph_vector_t *weight,
- const igraph_vector_t *minx,
- const igraph_vector_t *maxx,
- const igraph_vector_t *miny,
- const igraph_vector_t *maxy,
- const igraph_vector_t *minz,
- const igraph_vector_t *maxz);
-
-int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res,
- igraph_bool_t use_seed, igraph_integer_t maxiter,
- igraph_real_t epsilon, igraph_real_t kkconst,
- const igraph_vector_t *weights,
- const igraph_vector_t *minx, const igraph_vector_t *maxx,
- const igraph_vector_t *miny, const igraph_vector_t *maxy,
- const igraph_vector_t *minz, const igraph_vector_t *maxz);
-
-int igraph_layout_graphopt(const igraph_t *graph,
- igraph_matrix_t *res, igraph_integer_t niter,
- igraph_real_t node_charge, igraph_real_t node_mass,
- igraph_real_t spring_length,
- igraph_real_t spring_constant,
- igraph_real_t max_sa_movement,
- igraph_bool_t use_seed);
-
-int igraph_layout_mds(const igraph_t *graph, igraph_matrix_t *res,
- const igraph_matrix_t *dist, long int dim,
- igraph_arpack_options_t *options);
-
-int igraph_layout_bipartite(const igraph_t *graph,
- const igraph_vector_bool_t *types,
- igraph_matrix_t *res, igraph_real_t hgap,
- igraph_real_t vgap, long int maxiter);
+DECLDIR int igraph_layout_random(const igraph_t *graph, igraph_matrix_t *res);
+DECLDIR int igraph_layout_circle(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_vs_t order);
+DECLDIR int igraph_layout_star(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_integer_t center, const igraph_vector_t *order);
+DECLDIR int igraph_layout_grid(const igraph_t *graph, igraph_matrix_t *res, long int width);
+DECLDIR int igraph_layout_fruchterman_reingold(const igraph_t *graph,
+ igraph_matrix_t *res,
+ igraph_bool_t use_seed,
+ igraph_integer_t niter,
+ igraph_real_t start_temp,
+ igraph_layout_grid_t grid,
+ const igraph_vector_t *weight,
+ const igraph_vector_t *minx,
+ const igraph_vector_t *maxx,
+ const igraph_vector_t *miny,
+ const igraph_vector_t *maxy);
+
+DECLDIR int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_bool_t use_seed, igraph_integer_t maxiter,
+ igraph_real_t epsilon, igraph_real_t kkconst,
+ const igraph_vector_t *weights,
+ const igraph_vector_t *minx, const igraph_vector_t *maxx,
+ const igraph_vector_t *miny, const igraph_vector_t *maxy);
+
+DECLDIR int igraph_layout_springs(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_real_t mass, igraph_real_t equil, igraph_real_t k,
+ igraph_real_t repeqdis, igraph_real_t kfr, igraph_bool_t repulse);
+DECLDIR int igraph_layout_lgl(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_integer_t maxiter, igraph_real_t maxdelta,
+ igraph_real_t area, igraph_real_t coolexp,
+ igraph_real_t repulserad, igraph_real_t cellsize, igraph_integer_t root);
+DECLDIR int igraph_layout_reingold_tilford(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_neimode_t mode,
+ const igraph_vector_t *roots,
+ const igraph_vector_t *rootlevel);
+DECLDIR int igraph_layout_reingold_tilford_circular(const igraph_t *graph,
+ igraph_matrix_t *res,
+ igraph_neimode_t mode,
+ const igraph_vector_t *roots,
+ const igraph_vector_t *rootlevel);
+DECLDIR int igraph_layout_sugiyama(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_t *extd_graph, igraph_vector_t *extd_to_orig_eids,
+ const igraph_vector_t* layers, igraph_real_t hgap,
+ igraph_real_t vgap, long int maxiter, const igraph_vector_t *weights);
+
+DECLDIR int igraph_layout_random_3d(const igraph_t *graph, igraph_matrix_t *res);
+DECLDIR int igraph_layout_sphere(const igraph_t *graph, igraph_matrix_t *res);
+DECLDIR int igraph_layout_grid_3d(const igraph_t *graph, igraph_matrix_t *res,
+ long int width, long int height);
+DECLDIR int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph,
+ igraph_matrix_t *res,
+ igraph_bool_t use_seed,
+ igraph_integer_t niter,
+ igraph_real_t start_temp,
+ const igraph_vector_t *weight,
+ const igraph_vector_t *minx,
+ const igraph_vector_t *maxx,
+ const igraph_vector_t *miny,
+ const igraph_vector_t *maxy,
+ const igraph_vector_t *minz,
+ const igraph_vector_t *maxz);
+
+DECLDIR int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_bool_t use_seed, igraph_integer_t maxiter,
+ igraph_real_t epsilon, igraph_real_t kkconst,
+ const igraph_vector_t *weights,
+ const igraph_vector_t *minx, const igraph_vector_t *maxx,
+ const igraph_vector_t *miny, const igraph_vector_t *maxy,
+ const igraph_vector_t *minz, const igraph_vector_t *maxz);
+
+DECLDIR int igraph_layout_graphopt(const igraph_t *graph,
+ igraph_matrix_t *res, igraph_integer_t niter,
+ igraph_real_t node_charge, igraph_real_t node_mass,
+ igraph_real_t spring_length,
+ igraph_real_t spring_constant,
+ igraph_real_t max_sa_movement,
+ igraph_bool_t use_seed);
+
+DECLDIR int igraph_layout_mds(const igraph_t *graph, igraph_matrix_t *res,
+ const igraph_matrix_t *dist, long int dim,
+ igraph_arpack_options_t *options);
+
+DECLDIR int igraph_layout_bipartite(const igraph_t *graph,
+ const igraph_vector_bool_t *types,
+ igraph_matrix_t *res, igraph_real_t hgap,
+ igraph_real_t vgap, long int maxiter);
/**
* \struct igraph_layout_drl_options_t
@@ -222,36 +213,36 @@ typedef enum { IGRAPH_LAYOUT_DRL_DEFAULT=0,
IGRAPH_LAYOUT_DRL_REFINE,
IGRAPH_LAYOUT_DRL_FINAL } igraph_layout_drl_default_t;
-int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options,
- igraph_layout_drl_default_t templ);
-int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res,
- igraph_bool_t use_seed,
- igraph_layout_drl_options_t *options,
- const igraph_vector_t *weights,
- const igraph_vector_bool_t *fixed);
-
-int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res,
- igraph_bool_t use_seed,
- igraph_layout_drl_options_t *options,
- const igraph_vector_t *weights,
- const igraph_vector_bool_t *fixed);
-
-int igraph_layout_merge_dla(igraph_vector_ptr_t *graphs,
- igraph_vector_ptr_t *coords,
- igraph_matrix_t *res);
-
-int igraph_layout_gem(const igraph_t *graph, igraph_matrix_t *res,
- igraph_bool_t use_seed, igraph_integer_t maxiter,
- igraph_real_t temp_max, igraph_real_t temp_min,
- igraph_real_t temp_init);
-
-int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res,
- igraph_bool_t use_seed, igraph_integer_t maxiter,
- igraph_integer_t fineiter, igraph_real_t cool_fact,
- igraph_real_t weight_node_dist, igraph_real_t weight_border,
- igraph_real_t weight_edge_lengths,
- igraph_real_t weight_edge_crossings,
- igraph_real_t weight_node_edge_dist);
+DECLDIR int igraph_layout_drl_options_init(igraph_layout_drl_options_t *options,
+ igraph_layout_drl_default_t templ);
+DECLDIR int igraph_layout_drl(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_bool_t use_seed,
+ igraph_layout_drl_options_t *options,
+ const igraph_vector_t *weights,
+ const igraph_vector_bool_t *fixed);
+
+DECLDIR int igraph_layout_drl_3d(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_bool_t use_seed,
+ igraph_layout_drl_options_t *options,
+ const igraph_vector_t *weights,
+ const igraph_vector_bool_t *fixed);
+
+DECLDIR int igraph_layout_merge_dla(igraph_vector_ptr_t *graphs,
+ igraph_vector_ptr_t *coords,
+ igraph_matrix_t *res);
+
+DECLDIR int igraph_layout_gem(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_bool_t use_seed, igraph_integer_t maxiter,
+ igraph_real_t temp_max, igraph_real_t temp_min,
+ igraph_real_t temp_init);
+
+DECLDIR int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_bool_t use_seed, igraph_integer_t maxiter,
+ igraph_integer_t fineiter, igraph_real_t cool_fact,
+ igraph_real_t weight_node_dist, igraph_real_t weight_border,
+ igraph_real_t weight_edge_lengths,
+ igraph_real_t weight_edge_crossings,
+ igraph_real_t weight_node_edge_dist);
__END_DECLS
diff --git a/src/include/igraph_matching.h b/src/include/igraph_matching.h
index 46194be..dbd1a14 100644
--- a/src/include/igraph_matching.h
+++ b/src/include/igraph_matching.h
@@ -23,16 +23,7 @@
#ifndef IGRAPH_MATCHING_H
#define IGRAPH_MATCHING_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_datatype.h"
#include "igraph_types.h"
@@ -44,21 +35,21 @@ __BEGIN_DECLS
/* Matchings in graphs */
/* -------------------------------------------------- */
-int igraph_is_matching(const igraph_t* graph,
- const igraph_vector_bool_t* types, const igraph_vector_long_t* matching,
- igraph_bool_t* result);
-int igraph_is_maximal_matching(const igraph_t* graph,
- const igraph_vector_bool_t* types, const igraph_vector_long_t* matching,
- igraph_bool_t* result);
-
-int igraph_maximum_bipartite_matching(const igraph_t* graph,
- const igraph_vector_bool_t* types, igraph_integer_t* matching_size,
- igraph_real_t* matching_weight, igraph_vector_long_t* matching,
- const igraph_vector_t* weights, igraph_real_t eps);
-
-int igraph_maximum_matching(const igraph_t* graph, igraph_integer_t* matching_size,
- igraph_real_t* matching_weight, igraph_vector_long_t* matching,
- const igraph_vector_t* weights);
+DECLDIR int igraph_is_matching(const igraph_t* graph,
+ const igraph_vector_bool_t* types, const igraph_vector_long_t* matching,
+ igraph_bool_t* result);
+DECLDIR int igraph_is_maximal_matching(const igraph_t* graph,
+ const igraph_vector_bool_t* types, const igraph_vector_long_t* matching,
+ igraph_bool_t* result);
+
+DECLDIR int igraph_maximum_bipartite_matching(const igraph_t* graph,
+ const igraph_vector_bool_t* types, igraph_integer_t* matching_size,
+ igraph_real_t* matching_weight, igraph_vector_long_t* matching,
+ const igraph_vector_t* weights, igraph_real_t eps);
+
+DECLDIR int igraph_maximum_matching(const igraph_t* graph, igraph_integer_t* matching_size,
+ igraph_real_t* matching_weight, igraph_vector_long_t* matching,
+ const igraph_vector_t* weights);
__END_DECLS
diff --git a/src/include/igraph_matrix.h b/src/include/igraph_matrix.h
index fc57d9a..c9229e7 100644
--- a/src/include/igraph_matrix.h
+++ b/src/include/igraph_matrix.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_MATRIX_H
#define IGRAPH_MATRIX_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_vector.h"
__BEGIN_DECLS
diff --git a/src/include/igraph_matrix_pmt.h b/src/include/igraph_matrix_pmt.h
index c3dd7e2..eed5e3e 100644
--- a/src/include/igraph_matrix_pmt.h
+++ b/src/include/igraph_matrix_pmt.h
@@ -30,31 +30,31 @@ typedef struct TYPE(igraph_matrix) {
/* Allocation */
/*---------------*/
-int FUNCTION(igraph_matrix,init)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,init)(TYPE(igraph_matrix) *m,
long int nrow, long int ncol);
-int FUNCTION(igraph_matrix,copy)(TYPE(igraph_matrix) *to,
+DECLDIR int FUNCTION(igraph_matrix,copy)(TYPE(igraph_matrix) *to,
const TYPE(igraph_matrix) *from);
-void FUNCTION(igraph_matrix,destroy)(TYPE(igraph_matrix) *m);
-long int FUNCTION(igraph_matrix,capacity)(const TYPE(igraph_matrix) *m);
+DECLDIR void FUNCTION(igraph_matrix,destroy)(TYPE(igraph_matrix) *m);
+DECLDIR long int FUNCTION(igraph_matrix,capacity)(const TYPE(igraph_matrix) *m);
/*--------------------*/
/* Accessing elements */
/*--------------------*/
/* MATRIX */
-BASE FUNCTION(igraph_matrix,e)(const TYPE(igraph_matrix) *m,
+DECLDIR BASE FUNCTION(igraph_matrix,e)(const TYPE(igraph_matrix) *m,
long int row, long int col);
BASE* FUNCTION(igraph_matrix,e_ptr)(const TYPE(igraph_matrix) *m,
long int row, long int col);
-void FUNCTION(igraph_matrix,set)(TYPE(igraph_matrix)* m, long int row, long int col,
+DECLDIR void FUNCTION(igraph_matrix,set)(TYPE(igraph_matrix)* m, long int row, long int col,
BASE value);
/*------------------------------*/
/* Initializing matrix elements */
/*------------------------------*/
-void FUNCTION(igraph_matrix,null)(TYPE(igraph_matrix) *m);
-void FUNCTION(igraph_matrix,fill)(TYPE(igraph_matrix) *m, BASE e);
+DECLDIR void FUNCTION(igraph_matrix,null)(TYPE(igraph_matrix) *m);
+DECLDIR void FUNCTION(igraph_matrix,fill)(TYPE(igraph_matrix) *m, BASE e);
/*-----------------------*/
/* Matrix views */
@@ -69,34 +69,34 @@ const TYPE(igraph_matrix) *FUNCTION(igraph_matrix,view)(const TYPE(igraph_matrix
/* Copying matrices */
/*------------------*/
-void FUNCTION(igraph_matrix,copy_to)(const TYPE(igraph_matrix) *m, BASE *to);
-int FUNCTION(igraph_matrix,update)(TYPE(igraph_matrix) *to,
+DECLDIR void FUNCTION(igraph_matrix,copy_to)(const TYPE(igraph_matrix) *m, BASE *to);
+DECLDIR int FUNCTION(igraph_matrix,update)(TYPE(igraph_matrix) *to,
const TYPE(igraph_matrix) *from);
-int FUNCTION(igraph_matrix,rbind)(TYPE(igraph_matrix) *to,
+DECLDIR int FUNCTION(igraph_matrix,rbind)(TYPE(igraph_matrix) *to,
const TYPE(igraph_matrix) *from);
-int FUNCTION(igraph_matrix,cbind)(TYPE(igraph_matrix) *to,
+DECLDIR int FUNCTION(igraph_matrix,cbind)(TYPE(igraph_matrix) *to,
const TYPE(igraph_matrix) *from);
-int FUNCTION(igraph_matrix,swap)(TYPE(igraph_matrix) *m1, TYPE(igraph_matrix) *m2);
+DECLDIR int FUNCTION(igraph_matrix,swap)(TYPE(igraph_matrix) *m1, TYPE(igraph_matrix) *m2);
/*--------------------------*/
/* Copying rows and columns */
/*--------------------------*/
-int FUNCTION(igraph_matrix,get_row)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,get_row)(const TYPE(igraph_matrix) *m,
TYPE(igraph_vector) *res, long int index);
-int FUNCTION(igraph_matrix,get_col)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,get_col)(const TYPE(igraph_matrix) *m,
TYPE(igraph_vector) *res, long int index);
-int FUNCTION(igraph_matrix,set_row)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,set_row)(TYPE(igraph_matrix) *m,
const TYPE(igraph_vector) *v, long int index);
-int FUNCTION(igraph_matrix,set_col)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,set_col)(TYPE(igraph_matrix) *m,
const TYPE(igraph_vector) *v, long int index);
-int FUNCTION(igraph_matrix,select_rows)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,select_rows)(const TYPE(igraph_matrix) *m,
TYPE(igraph_matrix) *res,
const igraph_vector_t *rows);
-int FUNCTION(igraph_matrix,select_cols)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,select_cols)(const TYPE(igraph_matrix) *m,
TYPE(igraph_matrix) *res,
const igraph_vector_t *cols);
-int FUNCTION(igraph_matrix,select_rows_cols)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,select_rows_cols)(const TYPE(igraph_matrix) *m,
TYPE(igraph_matrix) *res,
const igraph_vector_t *rows,
const igraph_vector_t *cols);
@@ -105,42 +105,42 @@ int FUNCTION(igraph_matrix,select_rows_cols)(const TYPE(igraph_matrix) *m,
/* Exchanging rows and columns */
/*-----------------------------*/
-int FUNCTION(igraph_matrix,swap_rows)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,swap_rows)(TYPE(igraph_matrix) *m,
long int i, long int j);
-int FUNCTION(igraph_matrix,swap_cols)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,swap_cols)(TYPE(igraph_matrix) *m,
long int i, long int j);
-int FUNCTION(igraph_matrix,swap_rowcol)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,swap_rowcol)(TYPE(igraph_matrix) *m,
long int i, long int j);
-int FUNCTION(igraph_matrix,transpose)(TYPE(igraph_matrix) *m);
+DECLDIR int FUNCTION(igraph_matrix,transpose)(TYPE(igraph_matrix) *m);
/*-----------------------------*/
/* Matrix operations */
/*-----------------------------*/
-int FUNCTION(igraph_matrix,add)(TYPE(igraph_matrix) *m1,
+DECLDIR int FUNCTION(igraph_matrix,add)(TYPE(igraph_matrix) *m1,
const TYPE(igraph_matrix) *m2);
-int FUNCTION(igraph_matrix,sub)(TYPE(igraph_matrix) *m1,
+DECLDIR int FUNCTION(igraph_matrix,sub)(TYPE(igraph_matrix) *m1,
const TYPE(igraph_matrix) *m2);
-int FUNCTION(igraph_matrix,mul_elements)(TYPE(igraph_matrix) *m1,
+DECLDIR int FUNCTION(igraph_matrix,mul_elements)(TYPE(igraph_matrix) *m1,
const TYPE(igraph_matrix) *m2);
-int FUNCTION(igraph_matrix,div_elements)(TYPE(igraph_matrix) *m1,
+DECLDIR int FUNCTION(igraph_matrix,div_elements)(TYPE(igraph_matrix) *m1,
const TYPE(igraph_matrix) *m2);
-void FUNCTION(igraph_matrix,scale)(TYPE(igraph_matrix) *m, BASE by);
-void FUNCTION(igraph_matrix,add_constant)(TYPE(igraph_matrix) *m, BASE plus);
+DECLDIR void FUNCTION(igraph_matrix,scale)(TYPE(igraph_matrix) *m, BASE by);
+DECLDIR void FUNCTION(igraph_matrix,add_constant)(TYPE(igraph_matrix) *m, BASE plus);
/*-----------------------------*/
/* Finding minimum and maximum */
/*-----------------------------*/
-igraph_real_t FUNCTION(igraph_matrix,min)(const TYPE(igraph_matrix) *m);
-igraph_real_t FUNCTION(igraph_matrix,max)(const TYPE(igraph_matrix) *m);
-int FUNCTION(igraph_matrix,which_min)(const TYPE(igraph_matrix) *m,
+DECLDIR igraph_real_t FUNCTION(igraph_matrix,min)(const TYPE(igraph_matrix) *m);
+DECLDIR igraph_real_t FUNCTION(igraph_matrix,max)(const TYPE(igraph_matrix) *m);
+DECLDIR int FUNCTION(igraph_matrix,which_min)(const TYPE(igraph_matrix) *m,
long int *i, long int *j);
-int FUNCTION(igraph_matrix,which_max)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,which_max)(const TYPE(igraph_matrix) *m,
long int *i, long int *j);
-int FUNCTION(igraph_matrix,minmax)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,minmax)(const TYPE(igraph_matrix) *m,
BASE *min, BASE *max);
-int FUNCTION(igraph_matrix,which_minmax)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,which_minmax)(const TYPE(igraph_matrix) *m,
long int *imin, long int *jmin,
long int *imax, long int *jmax);
@@ -148,45 +148,45 @@ int FUNCTION(igraph_matrix,which_minmax)(const TYPE(igraph_matrix) *m,
/* Comparison */
/*------------------------------*/
-igraph_bool_t FUNCTION(igraph_matrix,all_e)(const TYPE(igraph_matrix) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_e)(const TYPE(igraph_matrix) *lhs,
const TYPE(igraph_matrix) *rhs);
-igraph_bool_t FUNCTION(igraph_matrix,all_l)(const TYPE(igraph_matrix) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_l)(const TYPE(igraph_matrix) *lhs,
const TYPE(igraph_matrix) *rhs);
-igraph_bool_t FUNCTION(igraph_matrix,all_g)(const TYPE(igraph_matrix) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_g)(const TYPE(igraph_matrix) *lhs,
const TYPE(igraph_matrix) *rhs);
-igraph_bool_t FUNCTION(igraph_matrix,all_le)(const TYPE(igraph_matrix) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_le)(const TYPE(igraph_matrix) *lhs,
const TYPE(igraph_matrix) *rhs);
-igraph_bool_t FUNCTION(igraph_matrix,all_ge)(const TYPE(igraph_matrix) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,all_ge)(const TYPE(igraph_matrix) *lhs,
const TYPE(igraph_matrix) *rhs);
/*-------------------*/
/* Matrix properties */
/*-------------------*/
-igraph_bool_t FUNCTION(igraph_matrix,isnull)(const TYPE(igraph_matrix) *m);
-igraph_bool_t FUNCTION(igraph_matrix,empty)(const TYPE(igraph_matrix) *m);
-long int FUNCTION(igraph_matrix,size)(const TYPE(igraph_matrix) *m);
-long int FUNCTION(igraph_matrix,nrow)(const TYPE(igraph_matrix) *m);
-long int FUNCTION(igraph_matrix,ncol)(const TYPE(igraph_matrix) *m);
-igraph_bool_t FUNCTION(igraph_matrix,is_symmetric)(const TYPE(igraph_matrix) *m);
-BASE FUNCTION(igraph_matrix,sum)(const TYPE(igraph_matrix) *m);
-BASE FUNCTION(igraph_matrix,prod)(const TYPE(igraph_matrix) *m);
-int FUNCTION(igraph_matrix,rowsum)(const TYPE(igraph_matrix) *m,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,isnull)(const TYPE(igraph_matrix) *m);
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,empty)(const TYPE(igraph_matrix) *m);
+DECLDIR long int FUNCTION(igraph_matrix,size)(const TYPE(igraph_matrix) *m);
+DECLDIR long int FUNCTION(igraph_matrix,nrow)(const TYPE(igraph_matrix) *m);
+DECLDIR long int FUNCTION(igraph_matrix,ncol)(const TYPE(igraph_matrix) *m);
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,is_symmetric)(const TYPE(igraph_matrix) *m);
+DECLDIR BASE FUNCTION(igraph_matrix,sum)(const TYPE(igraph_matrix) *m);
+DECLDIR BASE FUNCTION(igraph_matrix,prod)(const TYPE(igraph_matrix) *m);
+DECLDIR int FUNCTION(igraph_matrix,rowsum)(const TYPE(igraph_matrix) *m,
TYPE(igraph_vector) *res);
-int FUNCTION(igraph_matrix,colsum)(const TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,colsum)(const TYPE(igraph_matrix) *m,
TYPE(igraph_vector) *res);
-igraph_bool_t FUNCTION(igraph_matrix,is_equal)(const TYPE(igraph_matrix) *m1,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,is_equal)(const TYPE(igraph_matrix) *m1,
const TYPE(igraph_matrix) *m2);
-BASE FUNCTION(igraph_matrix,maxdifference)(const TYPE(igraph_matrix) *m1,
+DECLDIR BASE FUNCTION(igraph_matrix,maxdifference)(const TYPE(igraph_matrix) *m1,
const TYPE(igraph_matrix) *m2);
/*------------------------*/
/* Searching for elements */
/*------------------------*/
-igraph_bool_t FUNCTION(igraph_matrix,contains)(const TYPE(igraph_matrix) *m,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,contains)(const TYPE(igraph_matrix) *m,
BASE e);
-igraph_bool_t FUNCTION(igraph_matrix,search)(const TYPE(igraph_matrix) *m,
+DECLDIR igraph_bool_t FUNCTION(igraph_matrix,search)(const TYPE(igraph_matrix) *m,
long int from, BASE what,
long int *pos,
long int *row, long int *col);
@@ -195,13 +195,13 @@ igraph_bool_t FUNCTION(igraph_matrix,search)(const TYPE(igraph_matrix) *m,
/* Resizing operations */
/*------------------------*/
-int FUNCTION(igraph_matrix,resize)(TYPE(igraph_matrix) *m,
+DECLDIR int FUNCTION(igraph_matrix,resize)(TYPE(igraph_matrix) *m,
long int nrow, long int ncol);
-int FUNCTION(igraph_matrix,resize_min)(TYPE(igraph_matrix) *m);
-int FUNCTION(igraph_matrix,add_cols)(TYPE(igraph_matrix) *m, long int n);
-int FUNCTION(igraph_matrix,add_rows)(TYPE(igraph_matrix) *m, long int n);
-int FUNCTION(igraph_matrix,remove_col)(TYPE(igraph_matrix) *m, long int col);
-int FUNCTION(igraph_matrix,remove_row)(TYPE(igraph_matrix) *m, long int row);
+DECLDIR int FUNCTION(igraph_matrix,resize_min)(TYPE(igraph_matrix) *m);
+DECLDIR int FUNCTION(igraph_matrix,add_cols)(TYPE(igraph_matrix) *m, long int n);
+DECLDIR int FUNCTION(igraph_matrix,add_rows)(TYPE(igraph_matrix) *m, long int n);
+DECLDIR int FUNCTION(igraph_matrix,remove_col)(TYPE(igraph_matrix) *m, long int col);
+DECLDIR int FUNCTION(igraph_matrix,remove_row)(TYPE(igraph_matrix) *m, long int row);
/*------------------------*/
/* Print as text */
diff --git a/src/include/igraph_memory.h b/src/include/igraph_memory.h
index 02fbf0a..f39c678 100644
--- a/src/include/igraph_memory.h
+++ b/src/include/igraph_memory.h
@@ -25,16 +25,7 @@
#define REST_MEMORY_H
#include <stdlib.h>
-
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -48,7 +39,8 @@ __BEGIN_DECLS
/* # define Free igraph_Free */
/* #endif */
-int igraph_free(void *p);
+DECLDIR int igraph_free(void *p);
+DECLDIR void *igraph_malloc(size_t n);
__END_DECLS
diff --git a/src/include/igraph_microscopic_update.h b/src/include/igraph_microscopic_update.h
index 5789eb9..6f7430c 100644
--- a/src/include/igraph_microscopic_update.h
+++ b/src/include/igraph_microscopic_update.h
@@ -22,16 +22,7 @@
#ifndef IGRAPH_MICROSCOPIC_UPDATE_H
#define IGRAPH_MICROSCOPIC_UPDATE_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_datatype.h"
#include "igraph_iterators.h"
@@ -40,29 +31,29 @@
__BEGIN_DECLS
-int igraph_deterministic_optimal_imitation(const igraph_t *graph,
- igraph_integer_t vid,
- igraph_optimal_t optimality,
- const igraph_vector_t *quantities,
- igraph_vector_t *strategies,
- igraph_neimode_t mode);
-int igraph_moran_process(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_vector_t *quantities,
- igraph_vector_t *strategies,
- igraph_neimode_t mode);
-int igraph_roulette_wheel_imitation(const igraph_t *graph,
- igraph_integer_t vid,
- igraph_bool_t islocal,
- const igraph_vector_t *quantities,
- igraph_vector_t *strategies,
- igraph_neimode_t mode);
-int igraph_stochastic_imitation(const igraph_t *graph,
- igraph_integer_t vid,
- igraph_imitate_algorithm_t algo,
- const igraph_vector_t *quantities,
- igraph_vector_t *strategies,
- igraph_neimode_t mode);
+DECLDIR int igraph_deterministic_optimal_imitation(const igraph_t *graph,
+ igraph_integer_t vid,
+ igraph_optimal_t optimality,
+ const igraph_vector_t *quantities,
+ igraph_vector_t *strategies,
+ igraph_neimode_t mode);
+DECLDIR int igraph_moran_process(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_vector_t *quantities,
+ igraph_vector_t *strategies,
+ igraph_neimode_t mode);
+DECLDIR int igraph_roulette_wheel_imitation(const igraph_t *graph,
+ igraph_integer_t vid,
+ igraph_bool_t islocal,
+ const igraph_vector_t *quantities,
+ igraph_vector_t *strategies,
+ igraph_neimode_t mode);
+DECLDIR int igraph_stochastic_imitation(const igraph_t *graph,
+ igraph_integer_t vid,
+ igraph_imitate_algorithm_t algo,
+ const igraph_vector_t *quantities,
+ igraph_vector_t *strategies,
+ igraph_neimode_t mode);
__END_DECLS
diff --git a/src/include/igraph_mixing.h b/src/include/igraph_mixing.h
index c9d2dc6..d1045d3 100644
--- a/src/include/igraph_mixing.h
+++ b/src/include/igraph_mixing.h
@@ -24,36 +24,27 @@
#ifndef IGRAPH_MIXING_H
#define IGRAPH_MIXING_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
#include "igraph_vector.h"
__BEGIN_DECLS
-int igraph_assortativity_nominal(const igraph_t *graph,
- const igraph_vector_t *types,
- igraph_real_t *res,
- igraph_bool_t directed);
+DECLDIR int igraph_assortativity_nominal(const igraph_t *graph,
+ const igraph_vector_t *types,
+ igraph_real_t *res,
+ igraph_bool_t directed);
-int igraph_assortativity(const igraph_t *graph,
- const igraph_vector_t *types1,
- const igraph_vector_t *types2,
- igraph_real_t *res,
- igraph_bool_t directed);
+DECLDIR int igraph_assortativity(const igraph_t *graph,
+ const igraph_vector_t *types1,
+ const igraph_vector_t *types2,
+ igraph_real_t *res,
+ igraph_bool_t directed);
-int igraph_assortativity_degree(const igraph_t *graph,
- igraph_real_t *res,
- igraph_bool_t directed);
+DECLDIR int igraph_assortativity_degree(const igraph_t *graph,
+ igraph_real_t *res,
+ igraph_bool_t directed);
__END_DECLS
diff --git a/src/include/igraph_motifs.h b/src/include/igraph_motifs.h
index 61f01b8..ddcb7e0 100644
--- a/src/include/igraph_motifs.h
+++ b/src/include/igraph_motifs.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_MOTIFS_H
#define IGRAPH_MOTIFS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
#include "igraph_iterators.h"
@@ -73,33 +64,33 @@ typedef igraph_bool_t igraph_motifs_handler_t(const igraph_t *graph,
int isoclass,
void* extra);
-int igraph_motifs_randesu(const igraph_t *graph, igraph_vector_t *hist,
- int size, const igraph_vector_t *cut_prob);
-
-int igraph_motifs_randesu_callback(const igraph_t *graph, int size,
- const igraph_vector_t *cut_prob,
- igraph_motifs_handler_t *callback,
- void* extra);
-
-int igraph_motifs_randesu_estimate(const igraph_t *graph, igraph_integer_t *est,
- int size, const igraph_vector_t *cut_prob,
- igraph_integer_t sample_size,
- const igraph_vector_t *sample);
-int igraph_motifs_randesu_no(const igraph_t *graph, igraph_integer_t *no,
- int size, const igraph_vector_t *cut_prob);
-
-int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut,
- igraph_integer_t *asym, igraph_integer_t *null);
-int igraph_triad_census(const igraph_t *igraph, igraph_vector_t *res);
-int igraph_triad_census_24(const igraph_t *graph, igraph_integer_t *res2,
- igraph_integer_t *res4);
-
-int igraph_adjacent_triangles(const igraph_t *graph,
- igraph_vector_t *res,
- const igraph_vs_t vids);
-
-int igraph_list_triangles(const igraph_t *graph,
- igraph_vector_int_t *res);
+DECLDIR int igraph_motifs_randesu(const igraph_t *graph, igraph_vector_t *hist,
+ int size, const igraph_vector_t *cut_prob);
+
+DECLDIR int igraph_motifs_randesu_callback(const igraph_t *graph, int size,
+ const igraph_vector_t *cut_prob,
+ igraph_motifs_handler_t *callback,
+ void* extra);
+
+DECLDIR int igraph_motifs_randesu_estimate(const igraph_t *graph, igraph_integer_t *est,
+ int size, const igraph_vector_t *cut_prob,
+ igraph_integer_t sample_size,
+ const igraph_vector_t *sample);
+DECLDIR int igraph_motifs_randesu_no(const igraph_t *graph, igraph_integer_t *no,
+ int size, const igraph_vector_t *cut_prob);
+
+DECLDIR int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut,
+ igraph_integer_t *asym, igraph_integer_t *null);
+DECLDIR int igraph_triad_census(const igraph_t *igraph, igraph_vector_t *res);
+DECLDIR int igraph_triad_census_24(const igraph_t *graph, igraph_real_t *res2,
+ igraph_real_t *res4);
+
+DECLDIR int igraph_adjacent_triangles(const igraph_t *graph,
+ igraph_vector_t *res,
+ const igraph_vs_t vids);
+
+DECLDIR int igraph_list_triangles(const igraph_t *graph,
+ igraph_vector_int_t *res);
__END_DECLS
diff --git a/src/include/igraph_neighborhood.h b/src/include/igraph_neighborhood.h
index c5b6f5d..a18beea 100644
--- a/src/include/igraph_neighborhood.h
+++ b/src/include/igraph_neighborhood.h
@@ -24,28 +24,20 @@
#ifndef IGRAPH_NEIGHBORHOOD_H
#define IGRAPH_NEIGHBORHOOD_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
-int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res,
- igraph_vs_t vids, igraph_integer_t order,
- igraph_neimode_t mode, igraph_integer_t mindist);
-int igraph_neighborhood(const igraph_t *graph, igraph_vector_ptr_t *res,
- igraph_vs_t vids, igraph_integer_t order,
- igraph_neimode_t mode, igraph_integer_t mindist);
-int igraph_neighborhood_graphs(const igraph_t *graph, igraph_vector_ptr_t *res,
- igraph_vs_t vids, igraph_integer_t order,
- igraph_neimode_t mode,
- igraph_integer_t mindist);
+DECLDIR int igraph_neighborhood_size(const igraph_t *graph, igraph_vector_t *res,
+ igraph_vs_t vids, igraph_integer_t order,
+ igraph_neimode_t mode, igraph_integer_t mindist);
+DECLDIR int igraph_neighborhood(const igraph_t *graph, igraph_vector_ptr_t *res,
+ igraph_vs_t vids, igraph_integer_t order,
+ igraph_neimode_t mode, igraph_integer_t mindist);
+DECLDIR int igraph_neighborhood_graphs(const igraph_t *graph, igraph_vector_ptr_t *res,
+ igraph_vs_t vids, igraph_integer_t order,
+ igraph_neimode_t mode,
+ igraph_integer_t mindist);
__END_DECLS
diff --git a/src/include/igraph_nongraph.h b/src/include/igraph_nongraph.h
index 007f275..b4b6efb 100644
--- a/src/include/igraph_nongraph.h
+++ b/src/include/igraph_nongraph.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_NONGRAPH_H
#define IGRAPH_NONGRAPH_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_matrix.h"
#include "igraph_types.h"
@@ -79,23 +70,23 @@ typedef struct igraph_plfit_result_t {
double p;
} igraph_plfit_result_t;
-int igraph_running_mean(const igraph_vector_t *data, igraph_vector_t *res,
- igraph_integer_t binwidth);
-int igraph_fisher_yates_shuffle(igraph_vector_t *seq);
-int igraph_random_sample(igraph_vector_t *res, igraph_real_t l, igraph_real_t h,
- igraph_integer_t length);
-int igraph_convex_hull(const igraph_matrix_t *data, igraph_vector_t *resverts,
- igraph_matrix_t *rescoords);
-int igraph_zeroin(igraph_real_t *ax, igraph_real_t *bx,
- igraph_real_t (*f)(igraph_real_t x, void *info),
- void *info, igraph_real_t *Tol, int *Maxit, igraph_real_t *res);
-int igraph_bfgs(igraph_vector_t *b, igraph_real_t *Fmin,
- igraph_scalar_function_t fminfn, igraph_vector_function_t fmingr,
- int maxit, int trace,
- igraph_real_t abstol, igraph_real_t reltol, int nREPORT, void *ex,
- igraph_integer_t *fncount, igraph_integer_t *grcount);
-int igraph_power_law_fit(const igraph_vector_t* vector, igraph_plfit_result_t* result,
- igraph_real_t xmin, igraph_bool_t force_continuous);
+DECLDIR int igraph_running_mean(const igraph_vector_t *data, igraph_vector_t *res,
+ igraph_integer_t binwidth);
+DECLDIR int igraph_fisher_yates_shuffle(igraph_vector_t *seq);
+DECLDIR int igraph_random_sample(igraph_vector_t *res, igraph_real_t l, igraph_real_t h,
+ igraph_integer_t length);
+DECLDIR int igraph_convex_hull(const igraph_matrix_t *data, igraph_vector_t *resverts,
+ igraph_matrix_t *rescoords);
+DECLDIR int igraph_zeroin(igraph_real_t *ax, igraph_real_t *bx,
+ igraph_real_t (*f)(igraph_real_t x, void *info),
+ void *info, igraph_real_t *Tol, int *Maxit, igraph_real_t *res);
+DECLDIR int igraph_bfgs(igraph_vector_t *b, igraph_real_t *Fmin,
+ igraph_scalar_function_t fminfn, igraph_vector_function_t fmingr,
+ int maxit, int trace,
+ igraph_real_t abstol, igraph_real_t reltol, int nREPORT, void *ex,
+ igraph_integer_t *fncount, igraph_integer_t *grcount);
+DECLDIR int igraph_power_law_fit(const igraph_vector_t* vector, igraph_plfit_result_t* result,
+ igraph_real_t xmin, igraph_bool_t force_continuous);
__END_DECLS
diff --git a/src/include/igraph_operators.h b/src/include/igraph_operators.h
index e2343ae..df7f9fe 100644
--- a/src/include/igraph_operators.h
+++ b/src/include/igraph_operators.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_OPERATORS_H
#define IGRAPH_OPERATORS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
@@ -45,27 +36,27 @@ __BEGIN_DECLS
/* Graph operators */
/* -------------------------------------------------- */
-int igraph_disjoint_union(igraph_t *res,
- const igraph_t *left, const igraph_t *right);
-int igraph_disjoint_union_many(igraph_t *res,
- const igraph_vector_ptr_t *graphs);
-int igraph_union(igraph_t *res, const igraph_t *left, const igraph_t *right,
- igraph_vector_t *edge_map1, igraph_vector_t *edge_map2);
-int igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs,
- igraph_vector_ptr_t *edgemaps);
-int igraph_intersection(igraph_t *res,
- const igraph_t *left, const igraph_t *right,
- igraph_vector_t *edge_map1,
- igraph_vector_t *edge_map2);
-int igraph_intersection_many(igraph_t *res,
- const igraph_vector_ptr_t *graphs,
- igraph_vector_ptr_t *edgemaps);
-int igraph_difference(igraph_t *res,
- const igraph_t *orig, const igraph_t *sub);
-int igraph_complementer(igraph_t *res, const igraph_t *graph,
- igraph_bool_t loops);
-int igraph_compose(igraph_t *res, const igraph_t *g1, const igraph_t *g2,
- igraph_vector_t *edge_map1, igraph_vector_t *edge_map2);
+DECLDIR int igraph_disjoint_union(igraph_t *res,
+ const igraph_t *left, const igraph_t *right);
+DECLDIR int igraph_disjoint_union_many(igraph_t *res,
+ const igraph_vector_ptr_t *graphs);
+DECLDIR int igraph_union(igraph_t *res, const igraph_t *left, const igraph_t *right,
+ igraph_vector_t *edge_map1, igraph_vector_t *edge_map2);
+DECLDIR int igraph_union_many(igraph_t *res, const igraph_vector_ptr_t *graphs,
+ igraph_vector_ptr_t *edgemaps);
+DECLDIR int igraph_intersection(igraph_t *res,
+ const igraph_t *left, const igraph_t *right,
+ igraph_vector_t *edge_map1,
+ igraph_vector_t *edge_map2);
+DECLDIR int igraph_intersection_many(igraph_t *res,
+ const igraph_vector_ptr_t *graphs,
+ igraph_vector_ptr_t *edgemaps);
+DECLDIR int igraph_difference(igraph_t *res,
+ const igraph_t *orig, const igraph_t *sub);
+DECLDIR int igraph_complementer(igraph_t *res, const igraph_t *graph,
+ igraph_bool_t loops);
+DECLDIR int igraph_compose(igraph_t *res, const igraph_t *g1, const igraph_t *g2,
+ igraph_vector_t *edge_map1, igraph_vector_t *edge_map2);
__END_DECLS
diff --git a/src/include/igraph_paths.h b/src/include/igraph_paths.h
index ede598d..402fcd2 100644
--- a/src/include/igraph_paths.h
+++ b/src/include/igraph_paths.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_PATHS_H
#define IGRAPH_PATHS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -43,104 +34,104 @@
__BEGIN_DECLS
-int igraph_diameter(const igraph_t *graph, igraph_integer_t *res,
- igraph_integer_t *from, igraph_integer_t *to,
- igraph_vector_t *path,
- igraph_bool_t directed, igraph_bool_t unconn);
-int igraph_diameter_dijkstra(const igraph_t *graph,
- const igraph_vector_t *weights,
- igraph_real_t *pres,
- igraph_integer_t *pfrom,
- igraph_integer_t *pto,
- igraph_vector_t *path,
- igraph_bool_t directed,
- igraph_bool_t unconn);
+DECLDIR int igraph_diameter(const igraph_t *graph, igraph_integer_t *res,
+ igraph_integer_t *from, igraph_integer_t *to,
+ igraph_vector_t *path,
+ igraph_bool_t directed, igraph_bool_t unconn);
+DECLDIR int igraph_diameter_dijkstra(const igraph_t *graph,
+ const igraph_vector_t *weights,
+ igraph_real_t *pres,
+ igraph_integer_t *pfrom,
+ igraph_integer_t *pto,
+ igraph_vector_t *path,
+ igraph_bool_t directed,
+ igraph_bool_t unconn);
-int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res,
- const igraph_vs_t from, const igraph_vs_t to,
- igraph_neimode_t mode);
-int igraph_get_shortest_paths(const igraph_t *graph,
- igraph_vector_ptr_t *vertices,
- igraph_vector_ptr_t *edges,
- igraph_integer_t from, const igraph_vs_t to,
- igraph_neimode_t mode,
- igraph_vector_long_t *predecessors,
- igraph_vector_long_t *inbound_edges);
-int igraph_get_shortest_path(const igraph_t *graph,
- igraph_vector_t *vertices,
- igraph_vector_t *edges,
- igraph_integer_t from,
- igraph_integer_t to,
- igraph_neimode_t mode);
+DECLDIR int igraph_shortest_paths(const igraph_t *graph, igraph_matrix_t *res,
+ const igraph_vs_t from, const igraph_vs_t to,
+ igraph_neimode_t mode);
+DECLDIR int igraph_get_shortest_paths(const igraph_t *graph,
+ igraph_vector_ptr_t *vertices,
+ igraph_vector_ptr_t *edges,
+ igraph_integer_t from, const igraph_vs_t to,
+ igraph_neimode_t mode,
+ igraph_vector_long_t *predecessors,
+ igraph_vector_long_t *inbound_edges);
+DECLDIR int igraph_get_shortest_path(const igraph_t *graph,
+ igraph_vector_t *vertices,
+ igraph_vector_t *edges,
+ igraph_integer_t from,
+ igraph_integer_t to,
+ igraph_neimode_t mode);
-int igraph_get_all_shortest_paths(const igraph_t *graph,
- igraph_vector_ptr_t *res,
- igraph_vector_t *nrgeo,
- igraph_integer_t from, const igraph_vs_t to,
- igraph_neimode_t mode);
-int igraph_shortest_paths_dijkstra(const igraph_t *graph,
- igraph_matrix_t *res,
- const igraph_vs_t from,
- const igraph_vs_t to,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
-int igraph_shortest_paths_bellman_ford(const igraph_t *graph,
- igraph_matrix_t *res,
- const igraph_vs_t from,
- const igraph_vs_t to,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
-int igraph_get_shortest_paths_dijkstra(const igraph_t *graph,
- igraph_vector_ptr_t *vertices,
- igraph_vector_ptr_t *edges,
- igraph_integer_t from,
- igraph_vs_t to,
- const igraph_vector_t *weights,
- igraph_neimode_t mode,
- igraph_vector_long_t *predecessors,
- igraph_vector_long_t *inbound_edges);
-int igraph_get_shortest_path_dijkstra(const igraph_t *graph,
- igraph_vector_t *vertices,
- igraph_vector_t *edges,
- igraph_integer_t from,
- igraph_integer_t to,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
-int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph,
- igraph_vector_ptr_t *res,
- igraph_vector_t *nrgeo,
- igraph_integer_t from, igraph_vs_t to,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
-int igraph_shortest_paths_johnson(const igraph_t *graph,
- igraph_matrix_t *res,
- const igraph_vs_t from,
- const igraph_vs_t to,
- const igraph_vector_t *weights);
+DECLDIR int igraph_get_all_shortest_paths(const igraph_t *graph,
+ igraph_vector_ptr_t *res,
+ igraph_vector_t *nrgeo,
+ igraph_integer_t from, const igraph_vs_t to,
+ igraph_neimode_t mode);
+DECLDIR int igraph_shortest_paths_dijkstra(const igraph_t *graph,
+ igraph_matrix_t *res,
+ const igraph_vs_t from,
+ const igraph_vs_t to,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
+DECLDIR int igraph_shortest_paths_bellman_ford(const igraph_t *graph,
+ igraph_matrix_t *res,
+ const igraph_vs_t from,
+ const igraph_vs_t to,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
+DECLDIR int igraph_get_shortest_paths_dijkstra(const igraph_t *graph,
+ igraph_vector_ptr_t *vertices,
+ igraph_vector_ptr_t *edges,
+ igraph_integer_t from,
+ igraph_vs_t to,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode,
+ igraph_vector_long_t *predecessors,
+ igraph_vector_long_t *inbound_edges);
+DECLDIR int igraph_get_shortest_path_dijkstra(const igraph_t *graph,
+ igraph_vector_t *vertices,
+ igraph_vector_t *edges,
+ igraph_integer_t from,
+ igraph_integer_t to,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
+DECLDIR int igraph_get_all_shortest_paths_dijkstra(const igraph_t *graph,
+ igraph_vector_ptr_t *res,
+ igraph_vector_t *nrgeo,
+ igraph_integer_t from, igraph_vs_t to,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
+DECLDIR int igraph_shortest_paths_johnson(const igraph_t *graph,
+ igraph_matrix_t *res,
+ const igraph_vs_t from,
+ const igraph_vs_t to,
+ const igraph_vector_t *weights);
-int igraph_average_path_length(const igraph_t *graph, igraph_real_t *res,
- igraph_bool_t directed, igraph_bool_t unconn);
-int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res,
- igraph_real_t *unconnected, igraph_bool_t directed);
+DECLDIR int igraph_average_path_length(const igraph_t *graph, igraph_real_t *res,
+ igraph_bool_t directed, igraph_bool_t unconn);
+DECLDIR int igraph_path_length_hist(const igraph_t *graph, igraph_vector_t *res,
+ igraph_real_t *unconnected, igraph_bool_t directed);
-int igraph_eccentricity(const igraph_t *graph,
- igraph_vector_t *res,
- igraph_vs_t vids,
- igraph_neimode_t mode);
+DECLDIR int igraph_eccentricity(const igraph_t *graph,
+ igraph_vector_t *res,
+ igraph_vs_t vids,
+ igraph_neimode_t mode);
-int igraph_radius(const igraph_t *graph, igraph_real_t *radius,
- igraph_neimode_t mode);
+DECLDIR int igraph_radius(const igraph_t *graph, igraph_real_t *radius,
+ igraph_neimode_t mode);
-int igraph_get_all_simple_paths(const igraph_t *graph,
- igraph_vector_int_t *res,
- igraph_integer_t from,
- const igraph_vs_t to,
- igraph_neimode_t mode);
+DECLDIR int igraph_get_all_simple_paths(const igraph_t *graph,
+ igraph_vector_int_t *res,
+ igraph_integer_t from,
+ const igraph_vs_t to,
+ igraph_neimode_t mode);
-int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk,
- igraph_integer_t start, igraph_neimode_t mode,
- igraph_integer_t steps,
- igraph_random_walk_stuck_t stuck);
+DECLDIR int igraph_random_walk(const igraph_t *graph, igraph_vector_t *walk,
+ igraph_integer_t start, igraph_neimode_t mode,
+ igraph_integer_t steps,
+ igraph_random_walk_stuck_t stuck);
__END_DECLS
diff --git a/src/include/igraph_progress.h b/src/include/igraph_progress.h
index be1c424..91b7578 100644
--- a/src/include/igraph_progress.h
+++ b/src/include/igraph_progress.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_PROGRESS_H
#define IGRAPH_PROGRESS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
__BEGIN_DECLS
@@ -152,17 +143,16 @@ __BEGIN_DECLS
*/
typedef int igraph_progress_handler_t(const char *message, igraph_real_t percent,
- void *data);
+ void *data);
extern igraph_progress_handler_t igraph_progress_handler_stderr;
-igraph_progress_handler_t *
-igraph_set_progress_handler(igraph_progress_handler_t new_handler);
+DECLDIR igraph_progress_handler_t * igraph_set_progress_handler(igraph_progress_handler_t new_handler);
-int igraph_progress(const char *message, igraph_real_t percent, void *data);
+DECLDIR int igraph_progress(const char *message, igraph_real_t percent, void *data);
-int igraph_progressf(const char *message, igraph_real_t percent, void *data,
- ...);
+DECLDIR int igraph_progressf(const char *message, igraph_real_t percent, void *data,
+ ...);
/**
* \define IGRAPH_PROGRESS
diff --git a/src/include/igraph_psumtree.h b/src/include/igraph_psumtree.h
index 9dd8554..eb54692 100644
--- a/src/include/igraph_psumtree.h
+++ b/src/include/igraph_psumtree.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_PSUMTREE_H
#define IGRAPH_PSUMTREE_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_vector.h"
__BEGIN_DECLS
@@ -43,15 +34,16 @@ typedef struct {
long int size;
long int offset;
} igraph_psumtree_t;
-int igraph_psumtree_init(igraph_psumtree_t *t, long int size);
-void igraph_psumtree_destroy(igraph_psumtree_t *t);
-igraph_real_t igraph_psumtree_get(const igraph_psumtree_t *t, long int idx);
-long int igraph_psumtree_size(const igraph_psumtree_t *t);
-int igraph_psumtree_search(const igraph_psumtree_t *t, long int *idx,
- igraph_real_t elem);
-int igraph_psumtree_update(igraph_psumtree_t *t, long int idx,
- igraph_real_t new_value);
-igraph_real_t igraph_psumtree_sum(const igraph_psumtree_t *t);
+
+DECLDIR int igraph_psumtree_init(igraph_psumtree_t *t, long int size);
+DECLDIR void igraph_psumtree_destroy(igraph_psumtree_t *t);
+DECLDIR igraph_real_t igraph_psumtree_get(const igraph_psumtree_t *t, long int idx);
+DECLDIR long int igraph_psumtree_size(const igraph_psumtree_t *t);
+DECLDIR int igraph_psumtree_search(const igraph_psumtree_t *t, long int *idx,
+ igraph_real_t elem);
+DECLDIR int igraph_psumtree_update(igraph_psumtree_t *t, long int idx,
+ igraph_real_t new_value);
+DECLDIR igraph_real_t igraph_psumtree_sum(const igraph_psumtree_t *t);
__END_DECLS
diff --git a/src/include/igraph_qsort.h b/src/include/igraph_qsort.h
index bb347da..65fe0bf 100644
--- a/src/include/igraph_qsort.h
+++ b/src/include/igraph_qsort.h
@@ -24,22 +24,14 @@
#ifndef IGRAPH_QSORT_H
#define IGRAPH_QSORT_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
-void igraph_qsort(void *base, size_t nel, size_t width,
- int (*compar)(const void *, const void *));
-void igraph_qsort_r(void *base, size_t nel, size_t width, void *thunk,
- int (*compar)(void *, const void *, const void *));
+DECLDIR void igraph_qsort(void *base, size_t nel, size_t width,
+ int (*compar)(const void *, const void *));
+DECLDIR void igraph_qsort_r(void *base, size_t nel, size_t width, void *thunk,
+ int (*compar)(void *, const void *, const void *));
__END_DECLS
diff --git a/src/include/igraph_random.h b/src/include/igraph_random.h
index 37e35d4..327281e 100644
--- a/src/include/igraph_random.h
+++ b/src/include/igraph_random.h
@@ -24,15 +24,7 @@
#ifndef REST_RANDOM_H
#define REST_RANDOM_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -69,32 +61,32 @@ typedef struct igraph_rng_t {
/* --------------------------------- */
-int igraph_rng_init(igraph_rng_t *rng, const igraph_rng_type_t *type);
-void igraph_rng_destroy(igraph_rng_t *rng);
-
-int igraph_rng_seed(igraph_rng_t *rng, unsigned long int seed);
-unsigned long int igraph_rng_max(igraph_rng_t *rng);
-unsigned long int igraph_rng_min(igraph_rng_t *rng);
-const char *igraph_rng_name(igraph_rng_t *rng);
-
-long int igraph_rng_get_integer(igraph_rng_t *rng,
- long int l, long int h);
-igraph_real_t igraph_rng_get_normal(igraph_rng_t *rng,
- igraph_real_t m, igraph_real_t s);
-igraph_real_t igraph_rng_get_unif(igraph_rng_t *rng,
- igraph_real_t l, igraph_real_t h);
-igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng);
-igraph_real_t igraph_rng_get_geom(igraph_rng_t *rng, igraph_real_t p);
-igraph_real_t igraph_rng_get_binom(igraph_rng_t *rng, long int n,
- igraph_real_t p);
-igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate);
-unsigned long int igraph_rng_get_int31(igraph_rng_t *rng);
-igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate);
-igraph_real_t igraph_rng_get_gamma(igraph_rng_t *rng, igraph_real_t shape,
- igraph_real_t scale);
-int igraph_rng_get_dirichlet(igraph_rng_t *rng,
- const igraph_vector_t *alpha,
- igraph_vector_t *result);
+DECLDIR int igraph_rng_init(igraph_rng_t *rng, const igraph_rng_type_t *type);
+DECLDIR void igraph_rng_destroy(igraph_rng_t *rng);
+
+DECLDIR int igraph_rng_seed(igraph_rng_t *rng, unsigned long int seed);
+DECLDIR unsigned long int igraph_rng_max(igraph_rng_t *rng);
+DECLDIR unsigned long int igraph_rng_min(igraph_rng_t *rng);
+DECLDIR const char *igraph_rng_name(igraph_rng_t *rng);
+
+DECLDIR long int igraph_rng_get_integer(igraph_rng_t *rng,
+ long int l, long int h);
+DECLDIR igraph_real_t igraph_rng_get_normal(igraph_rng_t *rng,
+ igraph_real_t m, igraph_real_t s);
+DECLDIR igraph_real_t igraph_rng_get_unif(igraph_rng_t *rng,
+ igraph_real_t l, igraph_real_t h);
+DECLDIR igraph_real_t igraph_rng_get_unif01(igraph_rng_t *rng);
+DECLDIR igraph_real_t igraph_rng_get_geom(igraph_rng_t *rng, igraph_real_t p);
+DECLDIR igraph_real_t igraph_rng_get_binom(igraph_rng_t *rng, long int n,
+ igraph_real_t p);
+DECLDIR igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate);
+DECLDIR unsigned long int igraph_rng_get_int31(igraph_rng_t *rng);
+DECLDIR igraph_real_t igraph_rng_get_exp(igraph_rng_t *rng, igraph_real_t rate);
+DECLDIR igraph_real_t igraph_rng_get_gamma(igraph_rng_t *rng, igraph_real_t shape,
+ igraph_real_t scale);
+DECLDIR int igraph_rng_get_dirichlet(igraph_rng_t *rng,
+ const igraph_vector_t *alpha,
+ igraph_vector_t *result);
/* --------------------------------- */
@@ -102,8 +94,8 @@ extern const igraph_rng_type_t igraph_rngtype_glibc2;
extern const igraph_rng_type_t igraph_rngtype_rand;
extern const igraph_rng_type_t igraph_rngtype_mt19937;
-igraph_rng_t *igraph_rng_default(void);
-void igraph_rng_set_default(igraph_rng_t *rng);
+DECLDIR igraph_rng_t *igraph_rng_default(void);
+DECLDIR void igraph_rng_set_default(igraph_rng_t *rng);
/* --------------------------------- */
@@ -125,7 +117,7 @@ double Rf_dnorm4(double x, double mu, double sigma, int give_log);
}
#define RNG_END() /* do nothing */
-double igraph_dnorm(double x, double mu, double sigma, int give_log);
+DECLDIR double igraph_dnorm(double x, double mu, double sigma, int give_log);
#endif
diff --git a/src/include/igraph_scan.h b/src/include/igraph_scan.h
index 86d920d..c387bb8 100644
--- a/src/include/igraph_scan.h
+++ b/src/include/igraph_scan.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_SCAN_H
#define IGRAPH_SCAN_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_datatype.h"
#include "igraph_arpack.h"
#include "igraph_constants.h"
@@ -41,37 +32,37 @@
__BEGIN_DECLS
-int igraph_local_scan_0(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vector_t *weights, igraph_neimode_t mode);
+DECLDIR int igraph_local_scan_0(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vector_t *weights, igraph_neimode_t mode);
-int igraph_local_scan_0_them(const igraph_t *us, const igraph_t *them,
- igraph_vector_t *res,
- const igraph_vector_t *weigths_them,
- igraph_neimode_t mode);
+DECLDIR int igraph_local_scan_0_them(const igraph_t *us, const igraph_t *them,
+ igraph_vector_t *res,
+ const igraph_vector_t *weigths_them,
+ igraph_neimode_t mode);
-int igraph_local_scan_1_ecount(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
+DECLDIR int igraph_local_scan_1_ecount(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
-int igraph_local_scan_1_ecount_them(const igraph_t *us, const igraph_t *them,
- igraph_vector_t *res,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
+DECLDIR int igraph_local_scan_1_ecount_them(const igraph_t *us, const igraph_t *them,
+ igraph_vector_t *res,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
-int igraph_local_scan_k_ecount(const igraph_t *graph,int k,
- igraph_vector_t *res,
- const igraph_vector_t *weights,
- igraph_neimode_t mode);
+DECLDIR int igraph_local_scan_k_ecount(const igraph_t *graph,int k,
+ igraph_vector_t *res,
+ const igraph_vector_t *weights,
+ igraph_neimode_t mode);
-int igraph_local_scan_k_ecount_them(const igraph_t *us, const igraph_t *them,
- int k, igraph_vector_t *res,
- const igraph_vector_t *weights_them,
- igraph_neimode_t mode);
+DECLDIR int igraph_local_scan_k_ecount_them(const igraph_t *us, const igraph_t *them,
+ int k, igraph_vector_t *res,
+ const igraph_vector_t *weights_them,
+ igraph_neimode_t mode);
-int igraph_local_scan_neighborhood_ecount(const igraph_t *graph,
- igraph_vector_t *res,
- const igraph_vector_t *weights,
- const igraph_vector_ptr_t *neighborhoods);
+DECLDIR int igraph_local_scan_neighborhood_ecount(const igraph_t *graph,
+ igraph_vector_t *res,
+ const igraph_vector_t *weights,
+ const igraph_vector_ptr_t *neighborhoods);
__END_DECLS
diff --git a/src/include/igraph_separators.h b/src/include/igraph_separators.h
index 19ad531..5b98623 100644
--- a/src/include/igraph_separators.h
+++ b/src/include/igraph_separators.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_SEPARATORS_H
#define IGRAPH_SEPARATORS_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -43,19 +34,19 @@
__BEGIN_DECLS
-int igraph_is_separator(const igraph_t *graph,
- const igraph_vs_t candidate,
- igraph_bool_t *res);
+DECLDIR int igraph_is_separator(const igraph_t *graph,
+ const igraph_vs_t candidate,
+ igraph_bool_t *res);
-int igraph_all_minimal_st_separators(const igraph_t *graph,
- igraph_vector_ptr_t *separators);
+DECLDIR int igraph_all_minimal_st_separators(const igraph_t *graph,
+ igraph_vector_ptr_t *separators);
-int igraph_is_minimal_separator(const igraph_t *graph,
- const igraph_vs_t candidate,
- igraph_bool_t *res);
+DECLDIR int igraph_is_minimal_separator(const igraph_t *graph,
+ const igraph_vs_t candidate,
+ igraph_bool_t *res);
-int igraph_minimum_size_separators(const igraph_t *graph,
- igraph_vector_ptr_t *separators);
+DECLDIR int igraph_minimum_size_separators(const igraph_t *graph,
+ igraph_vector_ptr_t *separators);
__END_DECLS
diff --git a/src/include/igraph_spmatrix.h b/src/include/igraph_spmatrix.h
index 54c1c86..42a6ebd 100644
--- a/src/include/igraph_spmatrix.h
+++ b/src/include/igraph_spmatrix.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_SPMATRIX_H
#define IGRAPH_SPMATRIX_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_vector.h"
__BEGIN_DECLS
@@ -67,41 +58,41 @@ typedef struct s_spmatrix {
do { IGRAPH_CHECK(igraph_spmatrix_init(m, nr, nc)); \
IGRAPH_FINALLY(igraph_spmatrix_destroy, m); } while (0)
-int igraph_spmatrix_init(igraph_spmatrix_t *m, long int nrow, long int ncol);
-void igraph_spmatrix_destroy(igraph_spmatrix_t *m);
-int igraph_spmatrix_resize(igraph_spmatrix_t *m, long int nrow, long int ncol);
-igraph_real_t igraph_spmatrix_e(const igraph_spmatrix_t *m, long int row, long int col);
-int igraph_spmatrix_set(igraph_spmatrix_t *m, long int row, long int col,
- igraph_real_t value);
-int igraph_spmatrix_add_e(igraph_spmatrix_t *m, long int row, long int col,
- igraph_real_t value);
-int igraph_spmatrix_add_col_values(igraph_spmatrix_t *m, long int to, long int from);
-long int igraph_spmatrix_count_nonzero(const igraph_spmatrix_t *m);
-long int igraph_spmatrix_size(const igraph_spmatrix_t *m);
-long int igraph_spmatrix_nrow(const igraph_spmatrix_t *m);
-long int igraph_spmatrix_ncol(const igraph_spmatrix_t *m);
-int igraph_spmatrix_copy_to(const igraph_spmatrix_t *m, igraph_real_t *to);
-int igraph_spmatrix_null(igraph_spmatrix_t *m);
-int igraph_spmatrix_add_cols(igraph_spmatrix_t *m, long int n);
-int igraph_spmatrix_add_rows(igraph_spmatrix_t *m, long int n);
-int igraph_spmatrix_clear_col(igraph_spmatrix_t *m, long int col);
-int igraph_spmatrix_clear_row(igraph_spmatrix_t *m, long int row);
-int igraph_spmatrix_copy(igraph_spmatrix_t *to, const igraph_spmatrix_t *from);
-igraph_real_t igraph_spmatrix_max_nonzero(const igraph_spmatrix_t *m,
- igraph_real_t *ridx, igraph_real_t *cidx);
-igraph_real_t igraph_spmatrix_max(const igraph_spmatrix_t *m,
- igraph_real_t *ridx, igraph_real_t *cidx);
-void igraph_spmatrix_scale(igraph_spmatrix_t *m, igraph_real_t by);
-int igraph_spmatrix_colsums(const igraph_spmatrix_t *m, igraph_vector_t *res);
-int igraph_spmatrix_rowsums(const igraph_spmatrix_t *m, igraph_vector_t *res);
-
-int igraph_spmatrix_print(const igraph_spmatrix_t *matrix);
-int igraph_spmatrix_fprint(const igraph_spmatrix_t *matrix, FILE* file);
-
-int igraph_i_spmatrix_get_col_nonzero_indices(const igraph_spmatrix_t *m,
- igraph_vector_t *res, long int col);
-int igraph_i_spmatrix_clear_row_fast(igraph_spmatrix_t *m, long int row);
-int igraph_i_spmatrix_cleanup(igraph_spmatrix_t *m);
+DECLDIR int igraph_spmatrix_init(igraph_spmatrix_t *m, long int nrow, long int ncol);
+DECLDIR void igraph_spmatrix_destroy(igraph_spmatrix_t *m);
+DECLDIR int igraph_spmatrix_resize(igraph_spmatrix_t *m, long int nrow, long int ncol);
+DECLDIR igraph_real_t igraph_spmatrix_e(const igraph_spmatrix_t *m, long int row, long int col);
+DECLDIR int igraph_spmatrix_set(igraph_spmatrix_t *m, long int row, long int col,
+ igraph_real_t value);
+DECLDIR int igraph_spmatrix_add_e(igraph_spmatrix_t *m, long int row, long int col,
+ igraph_real_t value);
+DECLDIR int igraph_spmatrix_add_col_values(igraph_spmatrix_t *m, long int to, long int from);
+DECLDIR long int igraph_spmatrix_count_nonzero(const igraph_spmatrix_t *m);
+DECLDIR long int igraph_spmatrix_size(const igraph_spmatrix_t *m);
+DECLDIR long int igraph_spmatrix_nrow(const igraph_spmatrix_t *m);
+DECLDIR long int igraph_spmatrix_ncol(const igraph_spmatrix_t *m);
+DECLDIR int igraph_spmatrix_copy_to(const igraph_spmatrix_t *m, igraph_real_t *to);
+DECLDIR int igraph_spmatrix_null(igraph_spmatrix_t *m);
+DECLDIR int igraph_spmatrix_add_cols(igraph_spmatrix_t *m, long int n);
+DECLDIR int igraph_spmatrix_add_rows(igraph_spmatrix_t *m, long int n);
+DECLDIR int igraph_spmatrix_clear_col(igraph_spmatrix_t *m, long int col);
+DECLDIR int igraph_spmatrix_clear_row(igraph_spmatrix_t *m, long int row);
+DECLDIR int igraph_spmatrix_copy(igraph_spmatrix_t *to, const igraph_spmatrix_t *from);
+DECLDIR igraph_real_t igraph_spmatrix_max_nonzero(const igraph_spmatrix_t *m,
+ igraph_real_t *ridx, igraph_real_t *cidx);
+DECLDIR igraph_real_t igraph_spmatrix_max(const igraph_spmatrix_t *m,
+ igraph_real_t *ridx, igraph_real_t *cidx);
+DECLDIR void igraph_spmatrix_scale(igraph_spmatrix_t *m, igraph_real_t by);
+DECLDIR int igraph_spmatrix_colsums(const igraph_spmatrix_t *m, igraph_vector_t *res);
+DECLDIR int igraph_spmatrix_rowsums(const igraph_spmatrix_t *m, igraph_vector_t *res);
+
+DECLDIR int igraph_spmatrix_print(const igraph_spmatrix_t *matrix);
+DECLDIR int igraph_spmatrix_fprint(const igraph_spmatrix_t *matrix, FILE* file);
+
+DECLDIR int igraph_i_spmatrix_get_col_nonzero_indices(const igraph_spmatrix_t *m,
+ igraph_vector_t *res, long int col);
+DECLDIR int igraph_i_spmatrix_clear_row_fast(igraph_spmatrix_t *m, long int row);
+DECLDIR int igraph_i_spmatrix_cleanup(igraph_spmatrix_t *m);
typedef struct s_spmatrix_iter {
@@ -112,11 +103,11 @@ typedef struct s_spmatrix_iter {
igraph_real_t value; /* value at the given cell */
} igraph_spmatrix_iter_t;
-int igraph_spmatrix_iter_create(igraph_spmatrix_iter_t *mit, const igraph_spmatrix_t *m);
-int igraph_spmatrix_iter_reset(igraph_spmatrix_iter_t *mit);
-int igraph_spmatrix_iter_next(igraph_spmatrix_iter_t *mit);
-igraph_bool_t igraph_spmatrix_iter_end(igraph_spmatrix_iter_t *mit);
-void igraph_spmatrix_iter_destroy(igraph_spmatrix_iter_t *mit);
+DECLDIR int igraph_spmatrix_iter_create(igraph_spmatrix_iter_t *mit, const igraph_spmatrix_t *m);
+DECLDIR int igraph_spmatrix_iter_reset(igraph_spmatrix_iter_t *mit);
+DECLDIR int igraph_spmatrix_iter_next(igraph_spmatrix_iter_t *mit);
+DECLDIR igraph_bool_t igraph_spmatrix_iter_end(igraph_spmatrix_iter_t *mit);
+DECLDIR void igraph_spmatrix_iter_destroy(igraph_spmatrix_iter_t *mit);
__END_DECLS
diff --git a/src/include/igraph_stack.h b/src/include/igraph_stack.h
index 70867e0..a6d633a 100644
--- a/src/include/igraph_stack.h
+++ b/src/include/igraph_stack.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_STACK_H
#define IGRAPH_STACK_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
__BEGIN_DECLS
diff --git a/src/include/igraph_stack_pmt.h b/src/include/igraph_stack_pmt.h
index 2db6aa0..139be4b 100644
--- a/src/include/igraph_stack_pmt.h
+++ b/src/include/igraph_stack_pmt.h
@@ -34,14 +34,14 @@ typedef struct TYPE(igraph_stack) {
BASE* end;
} TYPE(igraph_stack);
-int FUNCTION(igraph_stack,init)(TYPE(igraph_stack)* s, long int size);
-void FUNCTION(igraph_stack,destroy)(TYPE(igraph_stack)* s);
-int FUNCTION(igraph_stack,reserve)(TYPE(igraph_stack)* s, long int size);
-igraph_bool_t FUNCTION(igraph_stack,empty)(TYPE(igraph_stack)* s);
-long int FUNCTION(igraph_stack,size)(const TYPE(igraph_stack)* s);
-void FUNCTION(igraph_stack,clear)(TYPE(igraph_stack)* s);
-int FUNCTION(igraph_stack,push)(TYPE(igraph_stack)* s, BASE elem);
-BASE FUNCTION(igraph_stack,pop)(TYPE(igraph_stack)* s);
-BASE FUNCTION(igraph_stack,top)(const TYPE(igraph_stack)* s);
-int FUNCTION(igraph_stack,print)(const TYPE(igraph_stack)* s);
-int FUNCTION(igraph_stack,fprint)(const TYPE(igraph_stack)* s, FILE *file);
+DECLDIR int FUNCTION(igraph_stack,init)(TYPE(igraph_stack)* s, long int size);
+DECLDIR void FUNCTION(igraph_stack,destroy)(TYPE(igraph_stack)* s);
+DECLDIR int FUNCTION(igraph_stack,reserve)(TYPE(igraph_stack)* s, long int size);
+DECLDIR igraph_bool_t FUNCTION(igraph_stack,empty)(TYPE(igraph_stack)* s);
+DECLDIR long int FUNCTION(igraph_stack,size)(const TYPE(igraph_stack)* s);
+DECLDIR void FUNCTION(igraph_stack,clear)(TYPE(igraph_stack)* s);
+DECLDIR int FUNCTION(igraph_stack,push)(TYPE(igraph_stack)* s, BASE elem);
+DECLDIR BASE FUNCTION(igraph_stack,pop)(TYPE(igraph_stack)* s);
+DECLDIR BASE FUNCTION(igraph_stack,top)(const TYPE(igraph_stack)* s);
+DECLDIR int FUNCTION(igraph_stack,print)(const TYPE(igraph_stack)* s);
+DECLDIR int FUNCTION(igraph_stack,fprint)(const TYPE(igraph_stack)* s, FILE *file);
diff --git a/src/include/igraph_statusbar.h b/src/include/igraph_statusbar.h
index 1fc845e..bf2f5fd 100644
--- a/src/include/igraph_statusbar.h
+++ b/src/include/igraph_statusbar.h
@@ -24,15 +24,7 @@
#ifndef IGRAPH_STATUSBAR
#define IGRAPH_STATUSBAR
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -74,10 +66,9 @@ typedef int igraph_status_handler_t(const char *message, void *data);
extern igraph_status_handler_t igraph_status_handler_stderr;
-igraph_status_handler_t *
-igraph_set_status_handler(igraph_status_handler_t new_handler);
+DECLDIR igraph_status_handler_t * igraph_set_status_handler(igraph_status_handler_t new_handler);
-int igraph_status(const char *message, void *data);
+DECLDIR int igraph_status(const char *message, void *data);
/**
* \define IGRAPH_STATUS
@@ -104,7 +95,7 @@ int igraph_status(const char *message, void *data);
} \
} while (0)
-int igraph_statusf(const char *message, void *data, ...);
+DECLDIR int igraph_statusf(const char *message, void *data, ...);
/**
* \define IGRAPH_STATUSF
diff --git a/src/include/igraph_structural.h b/src/include/igraph_structural.h
index 67253a7..6af26b3 100644
--- a/src/include/igraph_structural.h
+++ b/src/include/igraph_structural.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_STRUCTURAL_H
#define IGRAPH_STRUCTURAL_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_vector.h"
@@ -49,99 +40,100 @@ __BEGIN_DECLS
/* Basic query functions */
/* -------------------------------------------------- */
-int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igraph_integer_t v2, igraph_bool_t *res);
+DECLDIR int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igraph_integer_t v2, igraph_bool_t *res);
/* -------------------------------------------------- */
/* Structural properties */
/* -------------------------------------------------- */
-int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res,
- const igraph_vector_t *weights);
-int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph,
- igraph_t *mst);
-int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst,
- const igraph_vector_t *weights);
-
-int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid,
- igraph_neimode_t mode);
-int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode);
-int igraph_subgraph(const igraph_t *graph, igraph_t *res,
- const igraph_vs_t vids);
-int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res,
- const igraph_vs_t vids,
- igraph_subgraph_implementation_t impl,
- igraph_vector_t *map,
- igraph_vector_t *invmap);
-int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res,
- const igraph_vs_t vids, igraph_subgraph_implementation_t impl);
-int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res,
- const igraph_es_t eids, igraph_bool_t delete_vertices);
-int igraph_simplify(igraph_t *graph, igraph_bool_t multiple,
- igraph_bool_t loops,
- const igraph_attribute_combination_t *edge_comb);
-int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res,
- igraph_bool_t ignore_loops,
- igraph_reciprocity_t mode);
-
-int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res,
- igraph_vs_t vids, igraph_neimode_t mode,
- igraph_bool_t loops);
-int igraph_density(const igraph_t *graph, igraph_real_t *res,
- igraph_bool_t loops);
-
-int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res,
- igraph_es_t es);
-int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res);
-int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res);
-int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res,
- igraph_es_t es);
-int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es);
-int igraph_girth(const igraph_t *graph, igraph_integer_t *girth,
- igraph_vector_t *circle);
-int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to);
-
-int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree,
- igraph_neimode_t mode, const igraph_vector_t *roots,
- igraph_vector_t *vertex_index);
-
-int igraph_is_mutual(igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es);
-
-int igraph_maximum_cardinality_search(const igraph_t *graph,
- igraph_vector_t *alpha,
- igraph_vector_t *alpham1);
-int igraph_is_chordal(const igraph_t *graph,
- const igraph_vector_t *alpha,
- const igraph_vector_t *alpham1,
- igraph_bool_t *chordal,
- igraph_vector_t *fill_in,
- igraph_t *newgraph);
-int igraph_avg_nearest_neighbor_degree(const igraph_t *graph,
- igraph_vs_t vids,
- igraph_vector_t *knn,
- igraph_vector_t *knnk,
- const igraph_vector_t *weights);
-int igraph_contract_vertices(igraph_t *graph,
- const igraph_vector_t *mapping,
- const igraph_attribute_combination_t
- *vertex_comb);
-
-int igraph_transitive_closure_dag(const igraph_t *graph,
- igraph_t *closure);
-
-int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result,
- const igraph_vector_t *weights, igraph_fas_algorithm_t algo);
-
-int igraph_diversity(igraph_t *graph, const igraph_vector_t *weights,
- igraph_vector_t *res, const igraph_vs_t vs);
+DECLDIR int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res,
+ const igraph_vector_t *weights);
+DECLDIR int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph,
+ igraph_t *mst);
+DECLDIR int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst,
+ const igraph_vector_t *weights);
+
+DECLDIR int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid,
+ igraph_neimode_t mode);
+DECLDIR int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode);
+DECLDIR int igraph_subgraph(const igraph_t *graph, igraph_t *res,
+ const igraph_vs_t vids);
+DECLDIR int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res,
+ const igraph_vs_t vids,
+ igraph_subgraph_implementation_t impl,
+ igraph_vector_t *map,
+ igraph_vector_t *invmap);
+DECLDIR int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res,
+ const igraph_vs_t vids, igraph_subgraph_implementation_t impl);
+DECLDIR int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res,
+ const igraph_es_t eids, igraph_bool_t delete_vertices);
+DECLDIR int igraph_simplify(igraph_t *graph, igraph_bool_t multiple,
+ igraph_bool_t loops,
+ const igraph_attribute_combination_t *edge_comb);
+DECLDIR int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res,
+ igraph_bool_t ignore_loops,
+ igraph_reciprocity_t mode);
+
+DECLDIR int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res,
+ igraph_vs_t vids, igraph_neimode_t mode,
+ igraph_bool_t loops);
+DECLDIR int igraph_density(const igraph_t *graph, igraph_real_t *res,
+ igraph_bool_t loops);
+
+DECLDIR int igraph_has_loop(const igraph_t *graph, igraph_bool_t *res);
+DECLDIR int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res,
+ igraph_es_t es);
+DECLDIR int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res);
+DECLDIR int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res);
+DECLDIR int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res,
+ igraph_es_t es);
+DECLDIR int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es);
+DECLDIR int igraph_girth(const igraph_t *graph, igraph_integer_t *girth,
+ igraph_vector_t *circle);
+DECLDIR int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to);
+
+DECLDIR int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree,
+ igraph_neimode_t mode, const igraph_vector_t *roots,
+ igraph_vector_t *vertex_index);
+
+DECLDIR int igraph_is_mutual(igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es);
+
+DECLDIR int igraph_maximum_cardinality_search(const igraph_t *graph,
+ igraph_vector_t *alpha,
+ igraph_vector_t *alpham1);
+DECLDIR int igraph_is_chordal(const igraph_t *graph,
+ const igraph_vector_t *alpha,
+ const igraph_vector_t *alpham1,
+ igraph_bool_t *chordal,
+ igraph_vector_t *fill_in,
+ igraph_t *newgraph);
+DECLDIR int igraph_avg_nearest_neighbor_degree(const igraph_t *graph,
+ igraph_vs_t vids,
+ igraph_vector_t *knn,
+ igraph_vector_t *knnk,
+ const igraph_vector_t *weights);
+DECLDIR int igraph_contract_vertices(igraph_t *graph,
+ const igraph_vector_t *mapping,
+ const igraph_attribute_combination_t
+ *vertex_comb);
+
+DECLDIR int igraph_transitive_closure_dag(const igraph_t *graph,
+ igraph_t *closure);
+
+DECLDIR int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result,
+ const igraph_vector_t *weights, igraph_fas_algorithm_t algo);
+
+DECLDIR int igraph_diversity(igraph_t *graph, const igraph_vector_t *weights,
+ igraph_vector_t *res, const igraph_vs_t vs);
/* -------------------------------------------------- */
/* Spectral Properties */
/* -------------------------------------------------- */
-int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res,
- igraph_sparsemat_t *sparseres,
- igraph_bool_t normalized,
- const igraph_vector_t *weights);
+DECLDIR int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res,
+ igraph_sparsemat_t *sparseres,
+ igraph_bool_t normalized,
+ const igraph_vector_t *weights);
/* -------------------------------------------------- */
/* Internal functions, may change any time */
diff --git a/src/include/igraph_strvector.h b/src/include/igraph_strvector.h
index b67d3dd..279bc8c 100644
--- a/src/include/igraph_strvector.h
+++ b/src/include/igraph_strvector.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_STRVECTOR_H
#define IGRAPH_STRVECTOR_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_vector.h"
__BEGIN_DECLS
@@ -68,37 +59,37 @@ typedef struct s_igraph_strvector {
do { IGRAPH_CHECK(igraph_strvector_init(v, size)); \
IGRAPH_FINALLY( (igraph_finally_func_t*) igraph_strvector_destroy, v); } while (0)
-int igraph_strvector_init(igraph_strvector_t *sv, long int len);
-void igraph_strvector_destroy(igraph_strvector_t *sv);
-long int igraph_strvector_size(const igraph_strvector_t *sv);
-void igraph_strvector_get(const igraph_strvector_t *sv,
- long int idx, char **value);
-int igraph_strvector_set(igraph_strvector_t *sv, long int idx,
- const char *value);
-int igraph_strvector_set2(igraph_strvector_t *sv, long int idx,
- const char *value, int len);
-void igraph_strvector_clear(igraph_strvector_t *sv);
-void igraph_strvector_remove_section(igraph_strvector_t *v, long int from,
- long int to);
-void igraph_strvector_remove(igraph_strvector_t *v, long int elem);
-void igraph_strvector_move_interval(igraph_strvector_t *v, long int begin,
- long int end, long int to);
-int igraph_strvector_copy(igraph_strvector_t *to,
- const igraph_strvector_t *from);
-int igraph_strvector_append(igraph_strvector_t *to,
- const igraph_strvector_t *from);
-int igraph_strvector_resize(igraph_strvector_t* v, long int newsize);
-int igraph_strvector_add(igraph_strvector_t *v, const char *value);
-void igraph_strvector_permdelete(igraph_strvector_t *v, const igraph_vector_t *index,
- long int nremove);
-void igraph_strvector_remove_negidx(igraph_strvector_t *v, const igraph_vector_t *neg,
- long int nremove);
-int igraph_strvector_print(const igraph_strvector_t *v, FILE *file,
- const char *sep);
+DECLDIR int igraph_strvector_init(igraph_strvector_t *sv, long int len);
+DECLDIR void igraph_strvector_destroy(igraph_strvector_t *sv);
+DECLDIR long int igraph_strvector_size(const igraph_strvector_t *sv);
+DECLDIR void igraph_strvector_get(const igraph_strvector_t *sv,
+ long int idx, char **value);
+DECLDIR int igraph_strvector_set(igraph_strvector_t *sv, long int idx,
+ const char *value);
+DECLDIR int igraph_strvector_set2(igraph_strvector_t *sv, long int idx,
+ const char *value, int len);
+DECLDIR void igraph_strvector_clear(igraph_strvector_t *sv);
+DECLDIR void igraph_strvector_remove_section(igraph_strvector_t *v, long int from,
+ long int to);
+DECLDIR void igraph_strvector_remove(igraph_strvector_t *v, long int elem);
+DECLDIR void igraph_strvector_move_interval(igraph_strvector_t *v, long int begin,
+ long int end, long int to);
+DECLDIR int igraph_strvector_copy(igraph_strvector_t *to,
+ const igraph_strvector_t *from);
+DECLDIR int igraph_strvector_append(igraph_strvector_t *to,
+ const igraph_strvector_t *from);
+DECLDIR int igraph_strvector_resize(igraph_strvector_t* v, long int newsize);
+DECLDIR int igraph_strvector_add(igraph_strvector_t *v, const char *value);
+DECLDIR void igraph_strvector_permdelete(igraph_strvector_t *v, const igraph_vector_t *index,
+ long int nremove);
+DECLDIR void igraph_strvector_remove_negidx(igraph_strvector_t *v, const igraph_vector_t *neg,
+ long int nremove);
+DECLDIR int igraph_strvector_print(const igraph_strvector_t *v, FILE *file,
+ const char *sep);
-int igraph_strvector_index(const igraph_strvector_t *v,
- igraph_strvector_t *newv,
- const igraph_vector_t *idx);
+DECLDIR int igraph_strvector_index(const igraph_strvector_t *v,
+ igraph_strvector_t *newv,
+ const igraph_vector_t *idx);
__END_DECLS
diff --git a/src/include/igraph_threading.h.in b/src/include/igraph_threading.h.in
index 928269c..cb43af5 100644
--- a/src/include/igraph_threading.h.in
+++ b/src/include/igraph_threading.h.in
@@ -24,15 +24,7 @@
#ifndef IGRAPH_THREADING_H
#define IGRAPH_THREADING_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
diff --git a/src/include/igraph_topology.h b/src/include/igraph_topology.h
index c23c965..5cf8f26 100644
--- a/src/include/igraph_topology.h
+++ b/src/include/igraph_topology.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_TOPOLOGY_H
#define IGRAPH_TOPOLOGY_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_datatype.h"
#include "igraph_types.h"
@@ -45,19 +36,19 @@ __BEGIN_DECLS
/* Degree sequences */
/* -------------------------------------------------- */
-int igraph_is_degree_sequence(const igraph_vector_t *out_degrees,
+DECLDIR int igraph_is_degree_sequence(const igraph_vector_t *out_degrees,
const igraph_vector_t *in_degrees, igraph_bool_t *res);
-int igraph_is_graphical_degree_sequence(const igraph_vector_t *out_degrees,
+DECLDIR int igraph_is_graphical_degree_sequence(const igraph_vector_t *out_degrees,
const igraph_vector_t *in_degrees, igraph_bool_t *res);
/* -------------------------------------------------- */
/* Directed acyclic graphs */
/* -------------------------------------------------- */
-int igraph_topological_sorting(const igraph_t *graph, igraph_vector_t *res,
+DECLDIR int igraph_topological_sorting(const igraph_t *graph, igraph_vector_t *res,
igraph_neimode_t mode);
-int igraph_is_dag(const igraph_t *graph, igraph_bool_t *res);
-int igraph_transitive_closure_dag(const igraph_t *graph,
+DECLDIR int igraph_is_dag(const igraph_t *graph, igraph_bool_t *res);
+DECLDIR int igraph_transitive_closure_dag(const igraph_t *graph,
igraph_t *closure);
/* -------------------------------------------------- */
@@ -65,17 +56,17 @@ int igraph_transitive_closure_dag(const igraph_t *graph,
/* -------------------------------------------------- */
/* Common functions */
-int igraph_permute_vertices(const igraph_t *graph, igraph_t *res,
+DECLDIR int igraph_permute_vertices(const igraph_t *graph, igraph_t *res,
const igraph_vector_t *permutation);
/* Generic interface */
-int igraph_isomorphic(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_isomorphic(const igraph_t *graph1, const igraph_t *graph2,
igraph_bool_t *iso);
-int igraph_subisomorphic(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_subisomorphic(const igraph_t *graph1, const igraph_t *graph2,
igraph_bool_t *iso);
/* LAD */
-int igraph_subisomorphic_lad(const igraph_t *pattern, const igraph_t *target,
+DECLDIR int igraph_subisomorphic_lad(const igraph_t *pattern, const igraph_t *target,
igraph_vector_ptr_t *domains,
igraph_bool_t *iso, igraph_vector_t *map,
igraph_vector_ptr_t *maps,
@@ -130,7 +121,7 @@ typedef igraph_bool_t igraph_isocompat_t(const igraph_t *graph1,
const igraph_integer_t g2_num,
void *arg);
-int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
const igraph_vector_int_t *edge_color1,
@@ -141,7 +132,7 @@ int igraph_isomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2,
igraph_isocompat_t *node_compat_fn,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
const igraph_vector_int_t *edge_color1,
@@ -151,7 +142,7 @@ int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph
igraph_isocompat_t *node_compat_fn,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
const igraph_vector_int_t *edge_color1,
@@ -160,7 +151,7 @@ int igraph_count_isomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2
igraph_isocompat_t *node_compat_fn,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_get_isomorphisms_vf2(const igraph_t *graph1,
+DECLDIR int igraph_get_isomorphisms_vf2(const igraph_t *graph1,
const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
@@ -171,7 +162,7 @@ int igraph_get_isomorphisms_vf2(const igraph_t *graph1,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
const igraph_vector_int_t *edge_color1,
@@ -182,7 +173,7 @@ int igraph_subisomorphic_vf2(const igraph_t *graph1, const igraph_t *graph2,
igraph_isocompat_t *node_compat_fn,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_subisomorphic_function_vf2(const igraph_t *graph1,
+DECLDIR int igraph_subisomorphic_function_vf2(const igraph_t *graph1,
const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
@@ -194,7 +185,7 @@ int igraph_subisomorphic_function_vf2(const igraph_t *graph1,
igraph_isocompat_t *node_compat_fn,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
const igraph_vector_int_t *edge_color1,
@@ -203,7 +194,7 @@ int igraph_count_subisomorphisms_vf2(const igraph_t *graph1, const igraph_t *gra
igraph_isocompat_t *node_compat_fn,
igraph_isocompat_t *edge_compat_fn,
void *arg);
-int igraph_get_subisomorphisms_vf2(const igraph_t *graph1,
+DECLDIR int igraph_get_subisomorphisms_vf2(const igraph_t *graph1,
const igraph_t *graph2,
const igraph_vector_int_t *vertex_color1,
const igraph_vector_int_t *vertex_color2,
@@ -226,10 +217,11 @@ int igraph_get_subisomorphisms_vf2(const igraph_t *graph1,
* \member nof_leaf_nodes The number of leaf nodes in the search tree.
* \member nof_bad_nodes Number of bad nodes.
* \member nof_canupdates Number of canrep updates.
+ * \member nof_generators Number of generators of the automorphism group.
* \member max_level Maximum level.
* \member group_size The size of the automorphism group of the graph,
* given as a string. It should be deallocated via
- * <function>free()</function> if not needed any more.
+ * \ref igraph_free() if not needed any more.
*
* See http://www.tcs.hut.fi/Software/bliss/index.html
* for details about the algorithm and these parameters.
@@ -239,6 +231,7 @@ typedef struct igraph_bliss_info_t {
unsigned long nof_leaf_nodes;
unsigned long nof_bad_nodes;
unsigned long nof_canupdates;
+ unsigned long nof_generators;
unsigned long max_level;
char *group_size;
} igraph_bliss_info_t;
@@ -262,24 +255,28 @@ typedef enum { IGRAPH_BLISS_F=0, IGRAPH_BLISS_FL,
IGRAPH_BLISS_FS, IGRAPH_BLISS_FM,
IGRAPH_BLISS_FLM, IGRAPH_BLISS_FSM } igraph_bliss_sh_t;
-int igraph_canonical_permutation(const igraph_t *graph, igraph_vector_t *labeling,
- igraph_bliss_sh_t sh, igraph_bliss_info_t *info);
-int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_canonical_permutation(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_t *labeling,
+ igraph_bliss_sh_t sh, igraph_bliss_info_t *info);
+DECLDIR int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
+ const igraph_vector_int_t *colors1, const igraph_vector_int_t *colors2,
igraph_bool_t *iso, igraph_vector_t *map12,
igraph_vector_t *map21,
- igraph_bliss_sh_t sh1, igraph_bliss_sh_t sh2,
+ igraph_bliss_sh_t sh,
igraph_bliss_info_t *info1, igraph_bliss_info_t *info2);
-int igraph_automorphisms(const igraph_t *graph,
- igraph_bliss_sh_t sh, igraph_bliss_info_t *info);
+DECLDIR int igraph_automorphisms(const igraph_t *graph, const igraph_vector_int_t *colors,
+ igraph_bliss_sh_t sh, igraph_bliss_info_t *info);
+
+DECLDIR int igraph_automorphism_group(const igraph_t *graph, const igraph_vector_int_t *colors, igraph_vector_ptr_t *generators,
+ igraph_bliss_sh_t sh, igraph_bliss_info_t *info);
/* Functions for 3-4 graphs */
-int igraph_isomorphic_34(const igraph_t *graph1, const igraph_t *graph2,
+DECLDIR int igraph_isomorphic_34(const igraph_t *graph1, const igraph_t *graph2,
igraph_bool_t *iso);
-int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass);
-int igraph_isoclass_subgraph(const igraph_t *graph, igraph_vector_t *vids,
+DECLDIR int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass);
+DECLDIR int igraph_isoclass_subgraph(const igraph_t *graph, igraph_vector_t *vids,
igraph_integer_t *isoclass);
-int igraph_isoclass_create(igraph_t *graph, igraph_integer_t size,
+DECLDIR int igraph_isoclass_create(igraph_t *graph, igraph_integer_t size,
igraph_integer_t number, igraph_bool_t directed);
diff --git a/src/include/igraph_transitivity.h b/src/include/igraph_transitivity.h
index b691a1b..12b9628 100644
--- a/src/include/igraph_transitivity.h
+++ b/src/include/igraph_transitivity.h
@@ -24,45 +24,36 @@
#ifndef IGRAPH_TRANSITIVITY_H
#define IGRAPH_TRANSITIVITY_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_datatype.h"
#include "igraph_constants.h"
#include "igraph_iterators.h"
__BEGIN_DECLS
-int igraph_transitivity_undirected(const igraph_t *graph,
+DECLDIR int igraph_transitivity_undirected(const igraph_t *graph,
igraph_real_t *res,
igraph_transitivity_mode_t mode);
-int igraph_transitivity_local_undirected(const igraph_t *graph,
+DECLDIR int igraph_transitivity_local_undirected(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids,
igraph_transitivity_mode_t mode);
-int igraph_transitivity_local_undirected1(const igraph_t *graph,
+DECLDIR int igraph_transitivity_local_undirected1(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids,
igraph_transitivity_mode_t mode);
-int igraph_transitivity_local_undirected2(const igraph_t *graph,
+DECLDIR int igraph_transitivity_local_undirected2(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids,
igraph_transitivity_mode_t mode);
-int igraph_transitivity_local_undirected4(const igraph_t *graph,
+DECLDIR int igraph_transitivity_local_undirected4(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids,
igraph_transitivity_mode_t mode);
-int igraph_transitivity_avglocal_undirected(const igraph_t *graph,
+DECLDIR int igraph_transitivity_avglocal_undirected(const igraph_t *graph,
igraph_real_t *res,
igraph_transitivity_mode_t mode);
-int igraph_transitivity_barrat(const igraph_t *graph,
+DECLDIR int igraph_transitivity_barrat(const igraph_t *graph,
igraph_vector_t *res,
const igraph_vs_t vids,
const igraph_vector_t *weights,
diff --git a/src/include/igraph_types.h b/src/include/igraph_types.h
index 8445f71..6c9e19e 100644
--- a/src/include/igraph_types.h
+++ b/src/include/igraph_types.h
@@ -24,15 +24,7 @@
#ifndef REST_TYPES_H
#define REST_TYPES_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_decls.h"
__BEGIN_DECLS
@@ -54,15 +46,15 @@ typedef int igraph_bool_t;
/* Replacements for printf that print doubles in the same way on all platforms
* (even for NaN and infinities) */
-int igraph_real_printf(igraph_real_t val);
-int igraph_real_fprintf(FILE *file, igraph_real_t val);
-int igraph_real_snprintf(char* str, size_t size, igraph_real_t val);
+DECLDIR int igraph_real_printf(igraph_real_t val);
+DECLDIR int igraph_real_fprintf(FILE *file, igraph_real_t val);
+DECLDIR int igraph_real_snprintf(char* str, size_t size, igraph_real_t val);
/* Replacements for printf that print doubles in the same way on all platforms
* (even for NaN and infinities) with the largest possible precision */
-int igraph_real_printf_precise(igraph_real_t val);
-int igraph_real_fprintf_precise(FILE *file, igraph_real_t val);
-int igraph_real_snprintf_precise(char* str, size_t size, igraph_real_t val);
+DECLDIR int igraph_real_printf_precise(igraph_real_t val);
+DECLDIR int igraph_real_fprintf_precise(FILE *file, igraph_real_t val);
+DECLDIR int igraph_real_snprintf_precise(char* str, size_t size, igraph_real_t val);
/* igraph_i_fdiv is needed here instead of in igraph_math.h because
* some constants use it */
@@ -78,13 +70,13 @@ double igraph_i_fdiv(const double a, const double b);
# define IGRAPH_NEGINFINITY (igraph_i_fdiv(-1.0, 0.0))
#endif
-int igraph_finite(double x);
+DECLDIR int igraph_finite(double x);
#define IGRAPH_FINITE(x) igraph_finite(x)
-int igraph_is_nan(double x);
-int igraph_is_inf(double x);
-int igraph_is_posinf(double x);
-int igraph_is_neginf(double x);
+DECLDIR int igraph_is_nan(double x);
+DECLDIR int igraph_is_inf(double x);
+DECLDIR int igraph_is_posinf(double x);
+DECLDIR int igraph_is_neginf(double x);
#if defined(NAN)
# define IGRAPH_NAN NAN
diff --git a/src/include/igraph_vector.h b/src/include/igraph_vector.h
index c70a3c9..cf86562 100644
--- a/src/include/igraph_vector.h
+++ b/src/include/igraph_vector.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_VECTOR_H
#define IGRAPH_VECTOR_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_types.h"
#include "igraph_complex.h"
@@ -163,14 +154,14 @@ __BEGIN_DECLS
/* Type-specific vector functions */
/* -------------------------------------------------- */
-int igraph_vector_floor(const igraph_vector_t *from, igraph_vector_long_t *to);
-int igraph_vector_round(const igraph_vector_t *from, igraph_vector_long_t *to);
+DECLDIR int igraph_vector_floor(const igraph_vector_t *from, igraph_vector_long_t *to);
+DECLDIR int igraph_vector_round(const igraph_vector_t *from, igraph_vector_long_t *to);
-igraph_bool_t igraph_vector_e_tol(const igraph_vector_t *lhs,
+DECLDIR igraph_bool_t igraph_vector_e_tol(const igraph_vector_t *lhs,
const igraph_vector_t *rhs,
igraph_real_t tol);
-int igraph_vector_zapsmall(igraph_vector_t *v, igraph_real_t tol);
+DECLDIR int igraph_vector_zapsmall(igraph_vector_t *v, igraph_real_t tol);
/* These are for internal use only */
int igraph_vector_order(const igraph_vector_t* v, const igraph_vector_t *v2,
diff --git a/src/include/igraph_vector_pmt.h b/src/include/igraph_vector_pmt.h
index acd0a58..fd5f0eb 100644
--- a/src/include/igraph_vector_pmt.h
+++ b/src/include/igraph_vector_pmt.h
@@ -25,15 +25,15 @@
/* Allocation */
/*--------------------*/
-int FUNCTION(igraph_vector,init)(TYPE(igraph_vector)* v, long int size);
-int FUNCTION(igraph_vector,init_copy)(TYPE(igraph_vector)* v,
+DECLDIR int FUNCTION(igraph_vector,init)(TYPE(igraph_vector)* v, long int size);
+DECLDIR int FUNCTION(igraph_vector,init_copy)(TYPE(igraph_vector)* v,
BASE* data, long int length);
-int FUNCTION(igraph_vector,init_seq)(TYPE(igraph_vector)*v, BASE from, BASE to);
-int FUNCTION(igraph_vector,copy)(TYPE(igraph_vector) *to,
+DECLDIR int FUNCTION(igraph_vector,init_seq)(TYPE(igraph_vector)*v, BASE from, BASE to);
+DECLDIR int FUNCTION(igraph_vector,copy)(TYPE(igraph_vector) *to,
const TYPE(igraph_vector) *from);
-void FUNCTION(igraph_vector,destroy)(TYPE(igraph_vector)* v);
+DECLDIR void FUNCTION(igraph_vector,destroy)(TYPE(igraph_vector)* v);
-long int FUNCTION(igraph_vector,capacity)(const TYPE(igraph_vector)*v);
+DECLDIR long int FUNCTION(igraph_vector,capacity)(const TYPE(igraph_vector)*v);
/*--------------------*/
/* Accessing elements */
@@ -61,23 +61,23 @@ long int FUNCTION(igraph_vector,capacity)(const TYPE(igraph_vector)*v);
#define VECTOR(v) ((v).stor_begin)
#endif
-BASE FUNCTION(igraph_vector,e)(const TYPE(igraph_vector)* v, long int pos);
+DECLDIR BASE FUNCTION(igraph_vector,e)(const TYPE(igraph_vector)* v, long int pos);
BASE* FUNCTION(igraph_vector,e_ptr)(const TYPE(igraph_vector)* v, long int pos);
-void FUNCTION(igraph_vector,set)(TYPE(igraph_vector)* v, long int pos, BASE value);
-BASE FUNCTION(igraph_vector,tail)(const TYPE(igraph_vector) *v);
+DECLDIR void FUNCTION(igraph_vector,set)(TYPE(igraph_vector)* v, long int pos, BASE value);
+DECLDIR BASE FUNCTION(igraph_vector,tail)(const TYPE(igraph_vector) *v);
/*-----------------------*/
/* Initializing elements */
/*-----------------------*/
-void FUNCTION(igraph_vector,null)(TYPE(igraph_vector)* v);
-void FUNCTION(igraph_vector,fill)(TYPE(igraph_vector)* v, BASE e);
+DECLDIR void FUNCTION(igraph_vector,null)(TYPE(igraph_vector)* v);
+DECLDIR void FUNCTION(igraph_vector,fill)(TYPE(igraph_vector)* v, BASE e);
/*-----------------------*/
/* Vector views */
/*-----------------------*/
-const TYPE(igraph_vector) *FUNCTION(igraph_vector,view)(const TYPE(igraph_vector) *v,
+DECLDIR const TYPE(igraph_vector) *FUNCTION(igraph_vector,view)(const TYPE(igraph_vector) *v,
const BASE *data,
long int length);
@@ -85,124 +85,124 @@ const TYPE(igraph_vector) *FUNCTION(igraph_vector,view)(const TYPE(igraph_vector
/* Copying vectors */
/*-----------------------*/
-void FUNCTION(igraph_vector,copy_to)(const TYPE(igraph_vector) *v, BASE* to);
-int FUNCTION(igraph_vector,update)(TYPE(igraph_vector) *to,
+DECLDIR void FUNCTION(igraph_vector,copy_to)(const TYPE(igraph_vector) *v, BASE* to);
+DECLDIR int FUNCTION(igraph_vector,update)(TYPE(igraph_vector) *to,
const TYPE(igraph_vector) *from);
-int FUNCTION(igraph_vector,append)(TYPE(igraph_vector) *to,
+DECLDIR int FUNCTION(igraph_vector,append)(TYPE(igraph_vector) *to,
const TYPE(igraph_vector) *from);
-int FUNCTION(igraph_vector,swap)(TYPE(igraph_vector) *v1, TYPE(igraph_vector) *v2);
+DECLDIR int FUNCTION(igraph_vector,swap)(TYPE(igraph_vector) *v1, TYPE(igraph_vector) *v2);
/*-----------------------*/
/* Exchanging elements */
/*-----------------------*/
-int FUNCTION(igraph_vector,swap_elements)(TYPE(igraph_vector) *v,
+DECLDIR int FUNCTION(igraph_vector,swap_elements)(TYPE(igraph_vector) *v,
long int i, long int j);
-int FUNCTION(igraph_vector,reverse)(TYPE(igraph_vector) *v);
-int FUNCTION(igraph_vector,shuffle)(TYPE(igraph_vector) *v);
+DECLDIR int FUNCTION(igraph_vector,reverse)(TYPE(igraph_vector) *v);
+DECLDIR int FUNCTION(igraph_vector,shuffle)(TYPE(igraph_vector) *v);
/*-----------------------*/
/* Vector operations */
/*-----------------------*/
-void FUNCTION(igraph_vector,add_constant)(TYPE(igraph_vector) *v, BASE plus);
-void FUNCTION(igraph_vector,scale)(TYPE(igraph_vector) *v, BASE by);
-int FUNCTION(igraph_vector,add)(TYPE(igraph_vector) *v1,
+DECLDIR void FUNCTION(igraph_vector,add_constant)(TYPE(igraph_vector) *v, BASE plus);
+DECLDIR void FUNCTION(igraph_vector,scale)(TYPE(igraph_vector) *v, BASE by);
+DECLDIR int FUNCTION(igraph_vector,add)(TYPE(igraph_vector) *v1,
const TYPE(igraph_vector) *v2);
-int FUNCTION(igraph_vector,sub)(TYPE(igraph_vector) *v1,
+DECLDIR int FUNCTION(igraph_vector,sub)(TYPE(igraph_vector) *v1,
const TYPE(igraph_vector) *v2);
-int FUNCTION(igraph_vector,mul)(TYPE(igraph_vector) *v1,
+DECLDIR int FUNCTION(igraph_vector,mul)(TYPE(igraph_vector) *v1,
const TYPE(igraph_vector) *v2);
-int FUNCTION(igraph_vector,div)(TYPE(igraph_vector) *v1,
+DECLDIR int FUNCTION(igraph_vector,div)(TYPE(igraph_vector) *v1,
const TYPE(igraph_vector) *v2);
-int FUNCTION(igraph_vector,cumsum)(TYPE(igraph_vector) *to,
+DECLDIR int FUNCTION(igraph_vector,cumsum)(TYPE(igraph_vector) *to,
const TYPE(igraph_vector) *from);
#ifndef NOABS
-int FUNCTION(igraph_vector,abs)(TYPE(igraph_vector) *v);
+DECLDIR int FUNCTION(igraph_vector,abs)(TYPE(igraph_vector) *v);
#endif
/*------------------------------*/
/* Comparison */
/*------------------------------*/
-igraph_bool_t FUNCTION(igraph_vector,all_e)(const TYPE(igraph_vector) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_e)(const TYPE(igraph_vector) *lhs,
const TYPE(igraph_vector) *rhs);
-igraph_bool_t FUNCTION(igraph_vector,all_l)(const TYPE(igraph_vector) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_l)(const TYPE(igraph_vector) *lhs,
const TYPE(igraph_vector) *rhs);
-igraph_bool_t FUNCTION(igraph_vector,all_g)(const TYPE(igraph_vector) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_g)(const TYPE(igraph_vector) *lhs,
const TYPE(igraph_vector) *rhs);
-igraph_bool_t FUNCTION(igraph_vector,all_le)(const TYPE(igraph_vector) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_le)(const TYPE(igraph_vector) *lhs,
const TYPE(igraph_vector) *rhs);
-igraph_bool_t FUNCTION(igraph_vector,all_ge)(const TYPE(igraph_vector) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,all_ge)(const TYPE(igraph_vector) *lhs,
const TYPE(igraph_vector) *rhs);
/*------------------------------*/
/* Finding minimum and maximum */
/*------------------------------*/
-BASE FUNCTION(igraph_vector,min)(const TYPE(igraph_vector)* v);
-BASE FUNCTION(igraph_vector,max)(const TYPE(igraph_vector)* v);
-long int FUNCTION(igraph_vector,which_min)(const TYPE(igraph_vector)* v);
-long int FUNCTION(igraph_vector,which_max)(const TYPE(igraph_vector)* v);
-int FUNCTION(igraph_vector,minmax)(const TYPE(igraph_vector) *v,
+DECLDIR BASE FUNCTION(igraph_vector,min)(const TYPE(igraph_vector)* v);
+DECLDIR BASE FUNCTION(igraph_vector,max)(const TYPE(igraph_vector)* v);
+DECLDIR long int FUNCTION(igraph_vector,which_min)(const TYPE(igraph_vector)* v);
+DECLDIR long int FUNCTION(igraph_vector,which_max)(const TYPE(igraph_vector)* v);
+DECLDIR int FUNCTION(igraph_vector,minmax)(const TYPE(igraph_vector) *v,
BASE *min, BASE *max);
-int FUNCTION(igraph_vector,which_minmax)(const TYPE(igraph_vector) *v,
+DECLDIR int FUNCTION(igraph_vector,which_minmax)(const TYPE(igraph_vector) *v,
long int *which_min, long int *which_max);
/*-------------------*/
/* Vector properties */
/*-------------------*/
-igraph_bool_t FUNCTION(igraph_vector,empty) (const TYPE(igraph_vector)* v);
-long int FUNCTION(igraph_vector,size) (const TYPE(igraph_vector)* v);
-igraph_bool_t FUNCTION(igraph_vector,isnull)(const TYPE(igraph_vector) *v);
-BASE FUNCTION(igraph_vector,sum)(const TYPE(igraph_vector) *v);
-igraph_real_t FUNCTION(igraph_vector,sumsq)(const TYPE(igraph_vector) *v);
-BASE FUNCTION(igraph_vector,prod)(const TYPE(igraph_vector) *v);
-igraph_bool_t FUNCTION(igraph_vector,isininterval)(const TYPE(igraph_vector) *v,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,empty) (const TYPE(igraph_vector)* v);
+DECLDIR long int FUNCTION(igraph_vector,size) (const TYPE(igraph_vector)* v);
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,isnull)(const TYPE(igraph_vector) *v);
+DECLDIR BASE FUNCTION(igraph_vector,sum)(const TYPE(igraph_vector) *v);
+DECLDIR igraph_real_t FUNCTION(igraph_vector,sumsq)(const TYPE(igraph_vector) *v);
+DECLDIR BASE FUNCTION(igraph_vector,prod)(const TYPE(igraph_vector) *v);
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,isininterval)(const TYPE(igraph_vector) *v,
BASE low, BASE high);
-igraph_bool_t FUNCTION(igraph_vector,any_smaller)(const TYPE(igraph_vector) *v,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,any_smaller)(const TYPE(igraph_vector) *v,
BASE limit);
-igraph_bool_t FUNCTION(igraph_vector,is_equal)(const TYPE(igraph_vector) *lhs,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,is_equal)(const TYPE(igraph_vector) *lhs,
const TYPE(igraph_vector) *rhs);
-BASE FUNCTION(igraph_vector,maxdifference)(const TYPE(igraph_vector) *m1,
+DECLDIR BASE FUNCTION(igraph_vector,maxdifference)(const TYPE(igraph_vector) *m1,
const TYPE(igraph_vector) *m2);
/*------------------------*/
/* Searching for elements */
/*------------------------*/
-igraph_bool_t FUNCTION(igraph_vector,contains)(const TYPE(igraph_vector) *v, BASE e);
-igraph_bool_t FUNCTION(igraph_vector,search)(const TYPE(igraph_vector) *v,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,contains)(const TYPE(igraph_vector) *v, BASE e);
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,search)(const TYPE(igraph_vector) *v,
long int from, BASE what,
long int *pos);
-igraph_bool_t FUNCTION(igraph_vector,binsearch)(const TYPE(igraph_vector) *v,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,binsearch)(const TYPE(igraph_vector) *v,
BASE what, long int *pos);
-igraph_bool_t FUNCTION(igraph_vector,binsearch2)(const TYPE(igraph_vector) *v,
+DECLDIR igraph_bool_t FUNCTION(igraph_vector,binsearch2)(const TYPE(igraph_vector) *v,
BASE what);
/*------------------------*/
/* Resizing operations */
/*------------------------*/
-void FUNCTION(igraph_vector,clear)(TYPE(igraph_vector)* v);
-int FUNCTION(igraph_vector,resize)(TYPE(igraph_vector)* v, long int newsize);
-int FUNCTION(igraph_vector,resize_min)(TYPE(igraph_vector)*v);
-int FUNCTION(igraph_vector,reserve)(TYPE(igraph_vector)* v, long int size);
-int FUNCTION(igraph_vector,push_back)(TYPE(igraph_vector)* v, BASE e);
-BASE FUNCTION(igraph_vector,pop_back)(TYPE(igraph_vector)* v);
-int FUNCTION(igraph_vector,insert)(TYPE(igraph_vector) *v, long int pos, BASE value);
-void FUNCTION(igraph_vector,remove)(TYPE(igraph_vector) *v, long int elem);
-void FUNCTION(igraph_vector,remove_section)(TYPE(igraph_vector) *v,
+DECLDIR void FUNCTION(igraph_vector,clear)(TYPE(igraph_vector)* v);
+DECLDIR int FUNCTION(igraph_vector,resize)(TYPE(igraph_vector)* v, long int newsize);
+DECLDIR int FUNCTION(igraph_vector,resize_min)(TYPE(igraph_vector)*v);
+DECLDIR int FUNCTION(igraph_vector,reserve)(TYPE(igraph_vector)* v, long int size);
+DECLDIR int FUNCTION(igraph_vector,push_back)(TYPE(igraph_vector)* v, BASE e);
+DECLDIR BASE FUNCTION(igraph_vector,pop_back)(TYPE(igraph_vector)* v);
+DECLDIR int FUNCTION(igraph_vector,insert)(TYPE(igraph_vector) *v, long int pos, BASE value);
+DECLDIR void FUNCTION(igraph_vector,remove)(TYPE(igraph_vector) *v, long int elem);
+DECLDIR void FUNCTION(igraph_vector,remove_section)(TYPE(igraph_vector) *v,
long int from, long int to);
/*-----------*/
/* Sorting */
/*-----------*/
-void FUNCTION(igraph_vector,sort)(TYPE(igraph_vector) *v);
-long int FUNCTION(igraph_vector,qsort_ind)(TYPE(igraph_vector) *v,
+DECLDIR void FUNCTION(igraph_vector,sort)(TYPE(igraph_vector) *v);
+DECLDIR long int FUNCTION(igraph_vector,qsort_ind)(TYPE(igraph_vector) *v,
igraph_vector_t *inds, igraph_bool_t descending);
/*-----------*/
@@ -216,17 +216,17 @@ int FUNCTION(igraph_vector,fprint)(const TYPE(igraph_vector) *v, FILE *file);
#ifdef BASE_COMPLEX
-int igraph_vector_complex_real(const igraph_vector_complex_t *v,
+DECLDIR int igraph_vector_complex_real(const igraph_vector_complex_t *v,
igraph_vector_t *real);
-int igraph_vector_complex_imag(const igraph_vector_complex_t *v,
+DECLDIR int igraph_vector_complex_imag(const igraph_vector_complex_t *v,
igraph_vector_t *imag);
-int igraph_vector_complex_realimag(const igraph_vector_complex_t *v,
+DECLDIR int igraph_vector_complex_realimag(const igraph_vector_complex_t *v,
igraph_vector_t *real,
igraph_vector_t *imag);
-int igraph_vector_complex_create(igraph_vector_complex_t *v,
+DECLDIR int igraph_vector_complex_create(igraph_vector_complex_t *v,
const igraph_vector_t *real,
const igraph_vector_t *imag);
-int igraph_vector_complex_create_polar(igraph_vector_complex_t *v,
+DECLDIR int igraph_vector_complex_create_polar(igraph_vector_complex_t *v,
const igraph_vector_t *r,
const igraph_vector_t *theta);
diff --git a/src/include/igraph_vector_ptr.h b/src/include/igraph_vector_ptr.h
index f606be4..5e2ce92 100644
--- a/src/include/igraph_vector_ptr.h
+++ b/src/include/igraph_vector_ptr.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_VECTOR_PTR_H
#define IGRAPH_VECTOR_PTR_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_vector.h"
__BEGIN_DECLS
@@ -59,35 +50,35 @@ typedef struct s_vector_ptr {
do { IGRAPH_CHECK(igraph_vector_ptr_init(v, size)); \
IGRAPH_FINALLY(igraph_vector_ptr_destroy, v); } while (0)
-int igraph_vector_ptr_init (igraph_vector_ptr_t* v, long int size);
-int igraph_vector_ptr_init_copy (igraph_vector_ptr_t* v, void** data, long int length);
-const igraph_vector_ptr_t *igraph_vector_ptr_view (const igraph_vector_ptr_t *v,
+DECLDIR int igraph_vector_ptr_init (igraph_vector_ptr_t* v, long int size);
+DECLDIR int igraph_vector_ptr_init_copy (igraph_vector_ptr_t* v, void** data, long int length);
+DECLDIR const igraph_vector_ptr_t *igraph_vector_ptr_view (const igraph_vector_ptr_t *v,
void *const *data, long int length);
-void igraph_vector_ptr_destroy (igraph_vector_ptr_t* v);
-void igraph_vector_ptr_free_all (igraph_vector_ptr_t* v);
-void igraph_vector_ptr_destroy_all (igraph_vector_ptr_t* v);
-int igraph_vector_ptr_reserve (igraph_vector_ptr_t* v, long int size);
-igraph_bool_t igraph_vector_ptr_empty (const igraph_vector_ptr_t* v);
-long int igraph_vector_ptr_size (const igraph_vector_ptr_t* v);
-void igraph_vector_ptr_clear (igraph_vector_ptr_t* v);
-void igraph_vector_ptr_null (igraph_vector_ptr_t* v);
-int igraph_vector_ptr_push_back (igraph_vector_ptr_t* v, void* e);
-int igraph_vector_ptr_append (igraph_vector_ptr_t *to,
+DECLDIR void igraph_vector_ptr_destroy (igraph_vector_ptr_t* v);
+DECLDIR void igraph_vector_ptr_free_all (igraph_vector_ptr_t* v);
+DECLDIR void igraph_vector_ptr_destroy_all (igraph_vector_ptr_t* v);
+DECLDIR int igraph_vector_ptr_reserve (igraph_vector_ptr_t* v, long int size);
+DECLDIR igraph_bool_t igraph_vector_ptr_empty (const igraph_vector_ptr_t* v);
+DECLDIR long int igraph_vector_ptr_size (const igraph_vector_ptr_t* v);
+DECLDIR void igraph_vector_ptr_clear (igraph_vector_ptr_t* v);
+DECLDIR void igraph_vector_ptr_null (igraph_vector_ptr_t* v);
+DECLDIR int igraph_vector_ptr_push_back (igraph_vector_ptr_t* v, void* e);
+DECLDIR int igraph_vector_ptr_append (igraph_vector_ptr_t *to,
const igraph_vector_ptr_t *from);
-void *igraph_vector_ptr_pop_back (igraph_vector_ptr_t *v);
-int igraph_vector_ptr_insert(igraph_vector_ptr_t *v, long int pos, void* e);
-void* igraph_vector_ptr_e (const igraph_vector_ptr_t* v, long int pos);
-void igraph_vector_ptr_set (igraph_vector_ptr_t* v, long int pos, void* value);
-int igraph_vector_ptr_resize(igraph_vector_ptr_t* v, long int newsize);
-void igraph_vector_ptr_copy_to(const igraph_vector_ptr_t *v, void** to);
-int igraph_vector_ptr_copy(igraph_vector_ptr_t *to, const igraph_vector_ptr_t *from);
-void igraph_vector_ptr_remove(igraph_vector_ptr_t *v, long int pos);
-void igraph_vector_ptr_sort(igraph_vector_ptr_t *v, int(*compar)(const void*, const void*));
-int igraph_vector_ptr_index_int(igraph_vector_ptr_t *v,
+DECLDIR void *igraph_vector_ptr_pop_back (igraph_vector_ptr_t *v);
+DECLDIR int igraph_vector_ptr_insert(igraph_vector_ptr_t *v, long int pos, void* e);
+DECLDIR void* igraph_vector_ptr_e (const igraph_vector_ptr_t* v, long int pos);
+DECLDIR void igraph_vector_ptr_set (igraph_vector_ptr_t* v, long int pos, void* value);
+DECLDIR int igraph_vector_ptr_resize(igraph_vector_ptr_t* v, long int newsize);
+DECLDIR void igraph_vector_ptr_copy_to(const igraph_vector_ptr_t *v, void** to);
+DECLDIR int igraph_vector_ptr_copy(igraph_vector_ptr_t *to, const igraph_vector_ptr_t *from);
+DECLDIR void igraph_vector_ptr_remove(igraph_vector_ptr_t *v, long int pos);
+DECLDIR void igraph_vector_ptr_sort(igraph_vector_ptr_t *v, int(*compar)(const void*, const void*));
+DECLDIR int igraph_vector_ptr_index_int(igraph_vector_ptr_t *v,
const igraph_vector_int_t *idx);
-igraph_finally_func_t* igraph_vector_ptr_get_item_destructor(const igraph_vector_ptr_t *v);
-igraph_finally_func_t* igraph_vector_ptr_set_item_destructor(igraph_vector_ptr_t *v,
+DECLDIR igraph_finally_func_t* igraph_vector_ptr_get_item_destructor(const igraph_vector_ptr_t *v);
+DECLDIR igraph_finally_func_t* igraph_vector_ptr_set_item_destructor(igraph_vector_ptr_t *v,
igraph_finally_func_t *func);
/**
diff --git a/src/include/igraph_version.h.in b/src/include/igraph_version.h.in
index cd6f3b5..966ebe3 100644
--- a/src/include/igraph_version.h.in
+++ b/src/include/igraph_version.h.in
@@ -24,6 +24,10 @@
#ifndef IGRAPH_VERSION_H
#define IGRAPH_VERSION_H
+#include "igraph_decls.h"
+
+__BEGIN_DECLS
+
#define IGRAPH_VERSION "@PACKAGE_VERSION@"
#define IGRAPH_VERSION_MAJOR @PACKAGE_VERSION_MAJOR@
#define IGRAPH_VERSION_MINOR @PACKAGE_VERSION_MINOR@
@@ -35,6 +39,8 @@ int igraph_version(const char **version_string,
int *minor,
int *subminor);
+__END_DECLS
+
#endif
diff --git a/src/include/igraph_visitor.h b/src/include/igraph_visitor.h
index 8abdcf7..f047032 100644
--- a/src/include/igraph_visitor.h
+++ b/src/include/igraph_visitor.h
@@ -24,16 +24,7 @@
#ifndef IGRAPH_VISITOR_H
#define IGRAPH_VISITOR_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
-
+#include "igraph_decls.h"
#include "igraph_constants.h"
#include "igraph_types.h"
#include "igraph_datatype.h"
diff --git a/src/init.c b/src/init.c
new file mode 100644
index 0000000..a6c00a5
--- /dev/null
+++ b/src/init.c
@@ -0,0 +1,740 @@
+#include <R.h>
+#include <Rinternals.h>
+#include <stdlib.h> // for NULL
+#include <R_ext/Rdynload.h>
+
+/*
+ The following symbols/expresssions for .NAME have been omitted
+
+ call
+
+ Most likely possible values need to be added below.
+*/
+
+/* FIXME:
+ Check these declarations against the C/Fortran source code.
+*/
+
+/* .C calls */
+extern void igraphhcass2(void *, void *, void *, void *, void *, void *);
+
+/* .Call calls */
+extern SEXP make_lazy(SEXP, SEXP, SEXP);
+extern SEXP make_lazy_dots(SEXP, SEXP);
+extern SEXP promise_env_(SEXP);
+extern SEXP promise_expr_(SEXP);
+extern SEXP R_igraph_add_edges(SEXP, SEXP);
+extern SEXP R_igraph_add_env(SEXP);
+extern SEXP R_igraph_add_version_to_env(SEXP);
+extern SEXP R_igraph_add_vertices(SEXP, SEXP);
+extern SEXP R_igraph_address(SEXP);
+extern SEXP R_igraph_adhesion(SEXP, SEXP);
+extern SEXP R_igraph_adjacency_spectral_embedding(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_adjacent_triangles(SEXP, SEXP);
+extern SEXP R_igraph_adjacent_vertices(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_adjlist(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_all_minimal_st_separators(SEXP);
+extern SEXP R_igraph_all_st_cuts(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_all_st_mincuts(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_are_connected(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_arpack(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_arpack_unpack_complex(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_articulation_points(SEXP);
+extern SEXP R_igraph_assortativity(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_assortativity_degree(SEXP, SEXP);
+extern SEXP R_igraph_assortativity_nominal(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_asymmetric_preference_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_atlas(SEXP);
+extern SEXP R_igraph_authority_score(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_automorphisms(SEXP, SEXP);
+extern SEXP R_igraph_average_path_length(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_avg_nearest_neighbor_degree(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_barabasi_aging_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_barabasi_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_betweenness(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_betweenness_estimate(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_bfs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_bibcoupling(SEXP, SEXP);
+extern SEXP R_igraph_biconnected_components(SEXP);
+extern SEXP R_igraph_bipartite_game_gnm(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_bipartite_game_gnp(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_bipartite_projection(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_bipartite_projection_size(SEXP, SEXP);
+extern SEXP R_igraph_callaway_traits_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_canonical_permutation(SEXP, SEXP);
+extern SEXP R_igraph_centralization(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_betweenness(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_betweenness_tmax(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_closeness(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_closeness_tmax(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_degree(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_degree_tmax(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_eigenvector_centrality(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_centralization_eigenvector_centrality_tmax(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_cited_type_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_citing_cited_type_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_clique_number(SEXP);
+extern SEXP R_igraph_cliques(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_closeness(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_closeness_estimate(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_clusters(SEXP, SEXP);
+extern SEXP R_igraph_cocitation(SEXP, SEXP);
+extern SEXP R_igraph_cohesion(SEXP, SEXP);
+extern SEXP R_igraph_cohesive_blocks(SEXP);
+extern SEXP R_igraph_community_edge_betweenness(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_community_fastgreedy(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_community_infomap(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_community_label_propagation(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_community_leading_eigenvector(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_community_multilevel(SEXP, SEXP);
+extern SEXP R_igraph_community_optimal_modularity(SEXP, SEXP);
+extern SEXP R_igraph_community_to_membership2(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_compare_communities(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_complementer(SEXP, SEXP);
+extern SEXP R_igraph_compose(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_connect_neighborhood(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_constraint(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_contract_vertices(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_convex_hull(SEXP);
+extern SEXP R_igraph_coreness(SEXP, SEXP);
+extern SEXP R_igraph_correlated_game(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_correlated_pair_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_count_isomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_count_multiple(SEXP, SEXP);
+extern SEXP R_igraph_count_subisomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_create(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_create_bipartite(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_de_bruijn(SEXP, SEXP);
+extern SEXP R_igraph_decompose(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_degree(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_degree_sequence_game(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_delete_edges(SEXP, SEXP);
+extern SEXP R_igraph_delete_vertices(SEXP, SEXP);
+extern SEXP R_igraph_density(SEXP, SEXP);
+extern SEXP R_igraph_dfs(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_diameter(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_difference(SEXP, SEXP);
+extern SEXP R_igraph_dim_select(SEXP);
+extern SEXP R_igraph_disjoint_union(SEXP);
+extern SEXP R_igraph_diversity(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_dominator_tree(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_dot_product_game(SEXP, SEXP);
+extern SEXP R_igraph_dyad_census(SEXP);
+extern SEXP R_igraph_eccentricity(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_ecount(SEXP);
+extern SEXP R_igraph_edge_betweenness(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_edge_betweenness_estimate(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_edge_connectivity(SEXP, SEXP);
+extern SEXP R_igraph_edge_disjoint_paths(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_edges(SEXP, SEXP);
+extern SEXP R_igraph_eigen_adjacency(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_eigenvector_centrality(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_empty(SEXP, SEXP);
+extern SEXP R_igraph_erdos_renyi_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_es_adj(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_es_pairs(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_es_path(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_establishment_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_extended_chordal_ring(SEXP, SEXP);
+extern SEXP R_igraph_famous(SEXP);
+extern SEXP R_igraph_farthest_points(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_finalizer();
+extern SEXP R_igraph_forest_fire_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_full(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_full_bipartite(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_full_citation(SEXP, SEXP);
+extern SEXP R_igraph_get_adjacency(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_adjedgelist(SEXP, SEXP);
+extern SEXP R_igraph_get_adjlist(SEXP, SEXP);
+extern SEXP R_igraph_get_all_shortest_paths(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_all_shortest_paths_dijkstra(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_all_simple_paths(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_all_simple_paths_pp(SEXP);
+extern SEXP R_igraph_get_attr_mode(SEXP, SEXP);
+extern SEXP R_igraph_get_diameter(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_edge(SEXP, SEXP);
+extern SEXP R_igraph_get_edgelist(SEXP, SEXP);
+extern SEXP R_igraph_get_eids(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_graph_id(SEXP);
+extern SEXP R_igraph_get_incidence(SEXP, SEXP);
+extern SEXP R_igraph_get_isomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_shortest_paths(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_get_stochastic(SEXP, SEXP);
+extern SEXP R_igraph_get_stochastic_sparsemat(SEXP, SEXP);
+extern SEXP R_igraph_get_subisomorphisms_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_getsphere(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_girth(SEXP, SEXP);
+extern SEXP R_igraph_graph_adjacency(SEXP, SEXP);
+extern SEXP R_igraph_graph_version(SEXP);
+extern SEXP R_igraph_graphlets(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_graphlets_candidate_basis(SEXP, SEXP);
+extern SEXP R_igraph_graphlets_project(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_grg_game(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_growing_random_game(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_has_multiple(SEXP);
+extern SEXP R_igraph_hrg_consensus(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_hrg_create(SEXP, SEXP);
+extern SEXP R_igraph_hrg_dendrogram(SEXP);
+extern SEXP R_igraph_hrg_fit(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_hrg_game(SEXP);
+extern SEXP R_igraph_hrg_predict(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_hsbm_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_hsbm_list_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_hub_score(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_i_levc_arp(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_identical_graphs(SEXP, SEXP);
+extern SEXP R_igraph_incidence(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_incident(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_incident_edges(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_independence_number(SEXP);
+extern SEXP R_igraph_independent_vertex_sets(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_induced_subgraph(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_intersection(SEXP, SEXP);
+extern SEXP R_igraph_is_bipartite(SEXP);
+extern SEXP R_igraph_is_chordal(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_is_connected(SEXP, SEXP);
+extern SEXP R_igraph_is_dag(SEXP);
+extern SEXP R_igraph_is_degree_sequence(SEXP, SEXP);
+extern SEXP R_igraph_is_directed(SEXP);
+extern SEXP R_igraph_is_graphical_degree_sequence(SEXP, SEXP);
+extern SEXP R_igraph_is_loop(SEXP, SEXP);
+extern SEXP R_igraph_is_matching(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_is_maximal_matching(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_is_minimal_separator(SEXP, SEXP);
+extern SEXP R_igraph_is_multiple(SEXP, SEXP);
+extern SEXP R_igraph_is_mutual(SEXP, SEXP);
+extern SEXP R_igraph_is_separator(SEXP, SEXP);
+extern SEXP R_igraph_is_simple(SEXP);
+extern SEXP R_igraph_isoclass(SEXP);
+extern SEXP R_igraph_isoclass_create(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_isoclass_subgraph(SEXP, SEXP);
+extern SEXP R_igraph_isomorphic(SEXP, SEXP);
+extern SEXP R_igraph_isomorphic_34(SEXP, SEXP);
+extern SEXP R_igraph_isomorphic_bliss(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_isomorphic_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_k_regular_game(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_kautz(SEXP, SEXP);
+extern SEXP R_igraph_laplacian(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_laplacian_spectral_embedding(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_largest_cliques(SEXP);
+extern SEXP R_igraph_largest_independent_vertex_sets(SEXP);
+extern SEXP R_igraph_lastcit_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_lattice(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_bipartite(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_circle(SEXP, SEXP);
+extern SEXP R_igraph_layout_davidson_harel(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_drl(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_drl_3d(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_fruchterman_reingold(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_fruchterman_reingold_3d(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_gem(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_graphopt(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_grid(SEXP, SEXP);
+extern SEXP R_igraph_layout_grid_3d(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_kamada_kawai(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_kamada_kawai_3d(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_lgl(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_mds(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_merge_dla(SEXP, SEXP);
+extern SEXP R_igraph_layout_random(SEXP);
+extern SEXP R_igraph_layout_random_3d(SEXP);
+extern SEXP R_igraph_layout_reingold_tilford(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_sphere(SEXP);
+extern SEXP R_igraph_layout_star(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_layout_sugiyama(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_lcf_vector(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_line_graph(SEXP);
+extern SEXP R_igraph_list_triangles(SEXP);
+extern SEXP R_igraph_local_scan_0(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_local_scan_0_them(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_local_scan_1_ecount(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_local_scan_1_ecount_them(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_local_scan_k_ecount(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_local_scan_k_ecount_them(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_local_scan_neighborhood_ecount(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_make_weak_ref(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_maxflow(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_maximal_cliques(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_maximal_cliques_count(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_maximal_cliques_file(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_maximal_independent_vertex_sets(SEXP);
+extern SEXP R_igraph_maximum_bipartite_matching(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_maximum_cardinality_search(SEXP);
+extern SEXP R_igraph_mincut(SEXP, SEXP);
+extern SEXP R_igraph_mincut_value(SEXP, SEXP);
+extern SEXP R_igraph_minimum_size_separators(SEXP);
+extern SEXP R_igraph_minimum_spanning_tree_prim(SEXP, SEXP);
+extern SEXP R_igraph_minimum_spanning_tree_unweighted(SEXP);
+extern SEXP R_igraph_modularity(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_modularity_matrix(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_motifs_randesu(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_motifs_randesu_estimate(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_motifs_randesu_no(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_mybracket(SEXP, SEXP);
+extern SEXP R_igraph_mybracket2(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_mybracket2_copy(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_mybracket2_names(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_mybracket2_set(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_mybracket3_set(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_neighborhood(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_neighborhood_graphs(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_neighborhood_size(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_neighbors(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_no_clusters(SEXP, SEXP);
+extern SEXP R_igraph_pagerank_old(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_path_length_hist(SEXP, SEXP);
+extern SEXP R_igraph_permute_vertices(SEXP, SEXP);
+extern SEXP R_igraph_personalized_pagerank(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_power_law_fit(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_preference_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_psumtree_draw(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_radius(SEXP, SEXP);
+extern SEXP R_igraph_random_sample(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_random_walk(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_read_graph_dimacs(SEXP, SEXP);
+extern SEXP R_igraph_read_graph_dl(SEXP, SEXP);
+extern SEXP R_igraph_read_graph_edgelist(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_read_graph_gml(SEXP);
+extern SEXP R_igraph_read_graph_graphdb(SEXP, SEXP);
+extern SEXP R_igraph_read_graph_graphml(SEXP, SEXP);
+extern SEXP R_igraph_read_graph_lgl(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_read_graph_ncol(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_read_graph_pajek(SEXP);
+extern SEXP R_igraph_recent_degree_aging_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_reciprocity(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_rewire(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_rewire_edges(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_ring(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_running_mean(SEXP, SEXP);
+extern SEXP R_igraph_sample_dirichlet(SEXP, SEXP);
+extern SEXP R_igraph_sample_sphere_surface(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_sample_sphere_volume(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_sbm_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_scg_adjacency(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_scg_grouping(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_scg_laplacian(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_scg_norm_eps(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_scg_semiprojectors(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_scg_stochastic(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_set_verbose(SEXP);
+extern SEXP R_igraph_shortest_paths(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_similarity_dice(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_similarity_inverse_log_weighted(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_similarity_jaccard(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_simple_interconnected_islands_game(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_simplify(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_sir(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_solve_lsap(SEXP, SEXP);
+extern SEXP R_igraph_spinglass_community(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_spinglass_my_community(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_split_join_distance(SEXP, SEXP);
+extern SEXP R_igraph_st_edge_connectivity(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_st_mincut_value(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_st_vertex_connectivity(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_star(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_static_fitness_game(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_static_power_law_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_strength(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_subcomponent(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_subgraph(SEXP, SEXP);
+extern SEXP R_igraph_subgraph_edges(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_subisomorphic_lad(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_subisomorphic_vf2(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_to_directed(SEXP, SEXP);
+extern SEXP R_igraph_to_undirected(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_topological_sorting(SEXP, SEXP);
+extern SEXP R_igraph_transitivity_avglocal_undirected(SEXP, SEXP);
+extern SEXP R_igraph_transitivity_barrat(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_transitivity_local_undirected(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_transitivity_local_undirected_all(SEXP, SEXP);
+extern SEXP R_igraph_transitivity_undirected(SEXP, SEXP);
+extern SEXP R_igraph_tree(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_triad_census(SEXP);
+extern SEXP R_igraph_unfold_tree(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_union(SEXP, SEXP);
+extern SEXP R_igraph_vcount(SEXP);
+extern SEXP R_igraph_version();
+extern SEXP R_igraph_vertex_connectivity(SEXP, SEXP);
+extern SEXP R_igraph_vertex_disjoint_paths(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_vs_adj(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_vs_nei(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_walktrap_community(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_watts_strogatz_game(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_weak_ref_key(SEXP);
+extern SEXP R_igraph_weak_ref_run_finalizer(SEXP);
+extern SEXP R_igraph_weak_ref_value(SEXP);
+extern SEXP R_igraph_weighted_adjacency(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_dimacs(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_dot(SEXP, SEXP);
+extern SEXP R_igraph_write_graph_edgelist(SEXP, SEXP);
+extern SEXP R_igraph_write_graph_gml(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_graphml(SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_leda(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_lgl(SEXP, SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_ncol(SEXP, SEXP, SEXP, SEXP);
+extern SEXP R_igraph_write_graph_pajek(SEXP, SEXP);
+extern SEXP UUID_gen(SEXP);
+
+static const R_CMethodDef CEntries[] = {
+ {"igraphhcass2", (DL_FUNC) &igraphhcass2, 6},
+ {NULL, NULL, 0}
+};
+
+static const R_CallMethodDef CallEntries[] = {
+ {"make_lazy", (DL_FUNC) &make_lazy, 3},
+ {"make_lazy_dots", (DL_FUNC) &make_lazy_dots, 2},
+ {"promise_env_", (DL_FUNC) &promise_env_, 1},
+ {"promise_expr_", (DL_FUNC) &promise_expr_, 1},
+ {"R_igraph_add_edges", (DL_FUNC) &R_igraph_add_edges, 2},
+ {"R_igraph_add_env", (DL_FUNC) &R_igraph_add_env, 1},
+ {"R_igraph_add_version_to_env", (DL_FUNC) &R_igraph_add_version_to_env, 1},
+ {"R_igraph_add_vertices", (DL_FUNC) &R_igraph_add_vertices, 2},
+ {"R_igraph_address", (DL_FUNC) &R_igraph_address, 1},
+ {"R_igraph_adhesion", (DL_FUNC) &R_igraph_adhesion, 2},
+ {"R_igraph_adjacency_spectral_embedding", (DL_FUNC) &R_igraph_adjacency_spectral_embedding, 7},
+ {"R_igraph_adjacent_triangles", (DL_FUNC) &R_igraph_adjacent_triangles, 2},
+ {"R_igraph_adjacent_vertices", (DL_FUNC) &R_igraph_adjacent_vertices, 3},
+ {"R_igraph_adjlist", (DL_FUNC) &R_igraph_adjlist, 3},
+ {"R_igraph_all_minimal_st_separators", (DL_FUNC) &R_igraph_all_minimal_st_separators, 1},
+ {"R_igraph_all_st_cuts", (DL_FUNC) &R_igraph_all_st_cuts, 3},
+ {"R_igraph_all_st_mincuts", (DL_FUNC) &R_igraph_all_st_mincuts, 4},
+ {"R_igraph_are_connected", (DL_FUNC) &R_igraph_are_connected, 3},
+ {"R_igraph_arpack", (DL_FUNC) &R_igraph_arpack, 5},
+ {"R_igraph_arpack_unpack_complex", (DL_FUNC) &R_igraph_arpack_unpack_complex, 3},
+ {"R_igraph_articulation_points", (DL_FUNC) &R_igraph_articulation_points, 1},
+ {"R_igraph_assortativity", (DL_FUNC) &R_igraph_assortativity, 4},
+ {"R_igraph_assortativity_degree", (DL_FUNC) &R_igraph_assortativity_degree, 2},
+ {"R_igraph_assortativity_nominal", (DL_FUNC) &R_igraph_assortativity_nominal, 3},
+ {"R_igraph_asymmetric_preference_game", (DL_FUNC) &R_igraph_asymmetric_preference_game, 5},
+ {"R_igraph_atlas", (DL_FUNC) &R_igraph_atlas, 1},
+ {"R_igraph_authority_score", (DL_FUNC) &R_igraph_authority_score, 4},
+ {"R_igraph_automorphisms", (DL_FUNC) &R_igraph_automorphisms, 2},
+ {"R_igraph_average_path_length", (DL_FUNC) &R_igraph_average_path_length, 3},
+ {"R_igraph_avg_nearest_neighbor_degree", (DL_FUNC) &R_igraph_avg_nearest_neighbor_degree, 3},
+ {"R_igraph_barabasi_aging_game", (DL_FUNC) &R_igraph_barabasi_aging_game, 12},
+ {"R_igraph_barabasi_game", (DL_FUNC) &R_igraph_barabasi_game, 9},
+ {"R_igraph_betweenness", (DL_FUNC) &R_igraph_betweenness, 5},
+ {"R_igraph_betweenness_estimate", (DL_FUNC) &R_igraph_betweenness_estimate, 6},
+ {"R_igraph_bfs", (DL_FUNC) &R_igraph_bfs, 15},
+ {"R_igraph_bibcoupling", (DL_FUNC) &R_igraph_bibcoupling, 2},
+ {"R_igraph_biconnected_components", (DL_FUNC) &R_igraph_biconnected_components, 1},
+ {"R_igraph_bipartite_game_gnm", (DL_FUNC) &R_igraph_bipartite_game_gnm, 5},
+ {"R_igraph_bipartite_game_gnp", (DL_FUNC) &R_igraph_bipartite_game_gnp, 5},
+ {"R_igraph_bipartite_projection", (DL_FUNC) &R_igraph_bipartite_projection, 4},
+ {"R_igraph_bipartite_projection_size", (DL_FUNC) &R_igraph_bipartite_projection_size, 2},
+ {"R_igraph_callaway_traits_game", (DL_FUNC) &R_igraph_callaway_traits_game, 6},
+ {"R_igraph_canonical_permutation", (DL_FUNC) &R_igraph_canonical_permutation, 2},
+ {"R_igraph_centralization", (DL_FUNC) &R_igraph_centralization, 3},
+ {"R_igraph_centralization_betweenness", (DL_FUNC) &R_igraph_centralization_betweenness, 4},
+ {"R_igraph_centralization_betweenness_tmax", (DL_FUNC) &R_igraph_centralization_betweenness_tmax, 3},
+ {"R_igraph_centralization_closeness", (DL_FUNC) &R_igraph_centralization_closeness, 3},
+ {"R_igraph_centralization_closeness_tmax", (DL_FUNC) &R_igraph_centralization_closeness_tmax, 3},
+ {"R_igraph_centralization_degree", (DL_FUNC) &R_igraph_centralization_degree, 4},
+ {"R_igraph_centralization_degree_tmax", (DL_FUNC) &R_igraph_centralization_degree_tmax, 4},
+ {"R_igraph_centralization_eigenvector_centrality", (DL_FUNC) &R_igraph_centralization_eigenvector_centrality, 5},
+ {"R_igraph_centralization_eigenvector_centrality_tmax", (DL_FUNC) &R_igraph_centralization_eigenvector_centrality_tmax, 4},
+ {"R_igraph_cited_type_game", (DL_FUNC) &R_igraph_cited_type_game, 5},
+ {"R_igraph_citing_cited_type_game", (DL_FUNC) &R_igraph_citing_cited_type_game, 5},
+ {"R_igraph_clique_number", (DL_FUNC) &R_igraph_clique_number, 1},
+ {"R_igraph_cliques", (DL_FUNC) &R_igraph_cliques, 3},
+ {"R_igraph_closeness", (DL_FUNC) &R_igraph_closeness, 5},
+ {"R_igraph_closeness_estimate", (DL_FUNC) &R_igraph_closeness_estimate, 6},
+ {"R_igraph_clusters", (DL_FUNC) &R_igraph_clusters, 2},
+ {"R_igraph_cocitation", (DL_FUNC) &R_igraph_cocitation, 2},
+ {"R_igraph_cohesion", (DL_FUNC) &R_igraph_cohesion, 2},
+ {"R_igraph_cohesive_blocks", (DL_FUNC) &R_igraph_cohesive_blocks, 1},
+ {"R_igraph_community_edge_betweenness", (DL_FUNC) &R_igraph_community_edge_betweenness, 8},
+ {"R_igraph_community_fastgreedy", (DL_FUNC) &R_igraph_community_fastgreedy, 5},
+ {"R_igraph_community_infomap", (DL_FUNC) &R_igraph_community_infomap, 4},
+ {"R_igraph_community_label_propagation", (DL_FUNC) &R_igraph_community_label_propagation, 4},
+ {"R_igraph_community_leading_eigenvector", (DL_FUNC) &R_igraph_community_leading_eigenvector, 9},
+ {"R_igraph_community_multilevel", (DL_FUNC) &R_igraph_community_multilevel, 2},
+ {"R_igraph_community_optimal_modularity", (DL_FUNC) &R_igraph_community_optimal_modularity, 2},
+ {"R_igraph_community_to_membership2", (DL_FUNC) &R_igraph_community_to_membership2, 3},
+ {"R_igraph_compare_communities", (DL_FUNC) &R_igraph_compare_communities, 3},
+ {"R_igraph_complementer", (DL_FUNC) &R_igraph_complementer, 2},
+ {"R_igraph_compose", (DL_FUNC) &R_igraph_compose, 3},
+ {"R_igraph_connect_neighborhood", (DL_FUNC) &R_igraph_connect_neighborhood, 3},
+ {"R_igraph_constraint", (DL_FUNC) &R_igraph_constraint, 3},
+ {"R_igraph_contract_vertices", (DL_FUNC) &R_igraph_contract_vertices, 3},
+ {"R_igraph_convex_hull", (DL_FUNC) &R_igraph_convex_hull, 1},
+ {"R_igraph_coreness", (DL_FUNC) &R_igraph_coreness, 2},
+ {"R_igraph_correlated_game", (DL_FUNC) &R_igraph_correlated_game, 4},
+ {"R_igraph_correlated_pair_game", (DL_FUNC) &R_igraph_correlated_pair_game, 5},
+ {"R_igraph_count_isomorphisms_vf2", (DL_FUNC) &R_igraph_count_isomorphisms_vf2, 6},
+ {"R_igraph_count_multiple", (DL_FUNC) &R_igraph_count_multiple, 2},
+ {"R_igraph_count_subisomorphisms_vf2", (DL_FUNC) &R_igraph_count_subisomorphisms_vf2, 6},
+ {"R_igraph_create", (DL_FUNC) &R_igraph_create, 3},
+ {"R_igraph_create_bipartite", (DL_FUNC) &R_igraph_create_bipartite, 3},
+ {"R_igraph_de_bruijn", (DL_FUNC) &R_igraph_de_bruijn, 2},
+ {"R_igraph_decompose", (DL_FUNC) &R_igraph_decompose, 4},
+ {"R_igraph_degree", (DL_FUNC) &R_igraph_degree, 4},
+ {"R_igraph_degree_sequence_game", (DL_FUNC) &R_igraph_degree_sequence_game, 3},
+ {"R_igraph_delete_edges", (DL_FUNC) &R_igraph_delete_edges, 2},
+ {"R_igraph_delete_vertices", (DL_FUNC) &R_igraph_delete_vertices, 2},
+ {"R_igraph_density", (DL_FUNC) &R_igraph_density, 2},
+ {"R_igraph_dfs", (DL_FUNC) &R_igraph_dfs, 12},
+ {"R_igraph_diameter", (DL_FUNC) &R_igraph_diameter, 4},
+ {"R_igraph_difference", (DL_FUNC) &R_igraph_difference, 2},
+ {"R_igraph_dim_select", (DL_FUNC) &R_igraph_dim_select, 1},
+ {"R_igraph_disjoint_union", (DL_FUNC) &R_igraph_disjoint_union, 1},
+ {"R_igraph_diversity", (DL_FUNC) &R_igraph_diversity, 3},
+ {"R_igraph_dominator_tree", (DL_FUNC) &R_igraph_dominator_tree, 3},
+ {"R_igraph_dot_product_game", (DL_FUNC) &R_igraph_dot_product_game, 2},
+ {"R_igraph_dyad_census", (DL_FUNC) &R_igraph_dyad_census, 1},
+ {"R_igraph_eccentricity", (DL_FUNC) &R_igraph_eccentricity, 3},
+ {"R_igraph_ecount", (DL_FUNC) &R_igraph_ecount, 1},
+ {"R_igraph_edge_betweenness", (DL_FUNC) &R_igraph_edge_betweenness, 3},
+ {"R_igraph_edge_betweenness_estimate", (DL_FUNC) &R_igraph_edge_betweenness_estimate, 4},
+ {"R_igraph_edge_connectivity", (DL_FUNC) &R_igraph_edge_connectivity, 2},
+ {"R_igraph_edge_disjoint_paths", (DL_FUNC) &R_igraph_edge_disjoint_paths, 3},
+ {"R_igraph_edges", (DL_FUNC) &R_igraph_edges, 2},
+ {"R_igraph_eigen_adjacency", (DL_FUNC) &R_igraph_eigen_adjacency, 4},
+ {"R_igraph_eigenvector_centrality", (DL_FUNC) &R_igraph_eigenvector_centrality, 5},
+ {"R_igraph_empty", (DL_FUNC) &R_igraph_empty, 2},
+ {"R_igraph_erdos_renyi_game", (DL_FUNC) &R_igraph_erdos_renyi_game, 5},
+ {"R_igraph_es_adj", (DL_FUNC) &R_igraph_es_adj, 4},
+ {"R_igraph_es_pairs", (DL_FUNC) &R_igraph_es_pairs, 3},
+ {"R_igraph_es_path", (DL_FUNC) &R_igraph_es_path, 3},
+ {"R_igraph_establishment_game", (DL_FUNC) &R_igraph_establishment_game, 6},
+ {"R_igraph_extended_chordal_ring", (DL_FUNC) &R_igraph_extended_chordal_ring, 2},
+ {"R_igraph_famous", (DL_FUNC) &R_igraph_famous, 1},
+ {"R_igraph_farthest_points", (DL_FUNC) &R_igraph_farthest_points, 4},
+ {"R_igraph_finalizer", (DL_FUNC) &R_igraph_finalizer, 0},
+ {"R_igraph_forest_fire_game", (DL_FUNC) &R_igraph_forest_fire_game, 5},
+ {"R_igraph_full", (DL_FUNC) &R_igraph_full, 3},
+ {"R_igraph_full_bipartite", (DL_FUNC) &R_igraph_full_bipartite, 4},
+ {"R_igraph_full_citation", (DL_FUNC) &R_igraph_full_citation, 2},
+ {"R_igraph_get_adjacency", (DL_FUNC) &R_igraph_get_adjacency, 3},
+ {"R_igraph_get_adjedgelist", (DL_FUNC) &R_igraph_get_adjedgelist, 2},
+ {"R_igraph_get_adjlist", (DL_FUNC) &R_igraph_get_adjlist, 2},
+ {"R_igraph_get_all_shortest_paths", (DL_FUNC) &R_igraph_get_all_shortest_paths, 4},
+ {"R_igraph_get_all_shortest_paths_dijkstra", (DL_FUNC) &R_igraph_get_all_shortest_paths_dijkstra, 5},
+ {"R_igraph_get_all_simple_paths", (DL_FUNC) &R_igraph_get_all_simple_paths, 4},
+ {"R_igraph_get_all_simple_paths_pp", (DL_FUNC) &R_igraph_get_all_simple_paths_pp, 1},
+ {"R_igraph_get_attr_mode", (DL_FUNC) &R_igraph_get_attr_mode, 2},
+ {"R_igraph_get_diameter", (DL_FUNC) &R_igraph_get_diameter, 4},
+ {"R_igraph_get_edge", (DL_FUNC) &R_igraph_get_edge, 2},
+ {"R_igraph_get_edgelist", (DL_FUNC) &R_igraph_get_edgelist, 2},
+ {"R_igraph_get_eids", (DL_FUNC) &R_igraph_get_eids, 5},
+ {"R_igraph_get_graph_id", (DL_FUNC) &R_igraph_get_graph_id, 1},
+ {"R_igraph_get_incidence", (DL_FUNC) &R_igraph_get_incidence, 2},
+ {"R_igraph_get_isomorphisms_vf2", (DL_FUNC) &R_igraph_get_isomorphisms_vf2, 6},
+ {"R_igraph_get_shortest_paths", (DL_FUNC) &R_igraph_get_shortest_paths, 9},
+ {"R_igraph_get_stochastic", (DL_FUNC) &R_igraph_get_stochastic, 2},
+ {"R_igraph_get_stochastic_sparsemat", (DL_FUNC) &R_igraph_get_stochastic_sparsemat, 2},
+ {"R_igraph_get_subisomorphisms_vf2", (DL_FUNC) &R_igraph_get_subisomorphisms_vf2, 6},
+ {"R_igraph_getsphere", (DL_FUNC) &R_igraph_getsphere, 8},
+ {"R_igraph_girth", (DL_FUNC) &R_igraph_girth, 2},
+ {"R_igraph_graph_adjacency", (DL_FUNC) &R_igraph_graph_adjacency, 2},
+ {"R_igraph_graph_version", (DL_FUNC) &R_igraph_graph_version, 1},
+ {"R_igraph_graphlets", (DL_FUNC) &R_igraph_graphlets, 3},
+ {"R_igraph_graphlets_candidate_basis", (DL_FUNC) &R_igraph_graphlets_candidate_basis, 2},
+ {"R_igraph_graphlets_project", (DL_FUNC) &R_igraph_graphlets_project, 5},
+ {"R_igraph_grg_game", (DL_FUNC) &R_igraph_grg_game, 4},
+ {"R_igraph_growing_random_game", (DL_FUNC) &R_igraph_growing_random_game, 4},
+ {"R_igraph_has_multiple", (DL_FUNC) &R_igraph_has_multiple, 1},
+ {"R_igraph_hrg_consensus", (DL_FUNC) &R_igraph_hrg_consensus, 4},
+ {"R_igraph_hrg_create", (DL_FUNC) &R_igraph_hrg_create, 2},
+ {"R_igraph_hrg_dendrogram", (DL_FUNC) &R_igraph_hrg_dendrogram, 1},
+ {"R_igraph_hrg_fit", (DL_FUNC) &R_igraph_hrg_fit, 4},
+ {"R_igraph_hrg_game", (DL_FUNC) &R_igraph_hrg_game, 1},
+ {"R_igraph_hrg_predict", (DL_FUNC) &R_igraph_hrg_predict, 5},
+ {"R_igraph_hsbm_game", (DL_FUNC) &R_igraph_hsbm_game, 5},
+ {"R_igraph_hsbm_list_game", (DL_FUNC) &R_igraph_hsbm_list_game, 5},
+ {"R_igraph_hub_score", (DL_FUNC) &R_igraph_hub_score, 4},
+ {"R_igraph_i_levc_arp", (DL_FUNC) &R_igraph_i_levc_arp, 3},
+ {"R_igraph_identical_graphs", (DL_FUNC) &R_igraph_identical_graphs, 2},
+ {"R_igraph_incidence", (DL_FUNC) &R_igraph_incidence, 4},
+ {"R_igraph_incident", (DL_FUNC) &R_igraph_incident, 3},
+ {"R_igraph_incident_edges", (DL_FUNC) &R_igraph_incident_edges, 3},
+ {"R_igraph_independence_number", (DL_FUNC) &R_igraph_independence_number, 1},
+ {"R_igraph_independent_vertex_sets", (DL_FUNC) &R_igraph_independent_vertex_sets, 3},
+ {"R_igraph_induced_subgraph", (DL_FUNC) &R_igraph_induced_subgraph, 3},
+ {"R_igraph_intersection", (DL_FUNC) &R_igraph_intersection, 2},
+ {"R_igraph_is_bipartite", (DL_FUNC) &R_igraph_is_bipartite, 1},
+ {"R_igraph_is_chordal", (DL_FUNC) &R_igraph_is_chordal, 5},
+ {"R_igraph_is_connected", (DL_FUNC) &R_igraph_is_connected, 2},
+ {"R_igraph_is_dag", (DL_FUNC) &R_igraph_is_dag, 1},
+ {"R_igraph_is_degree_sequence", (DL_FUNC) &R_igraph_is_degree_sequence, 2},
+ {"R_igraph_is_directed", (DL_FUNC) &R_igraph_is_directed, 1},
+ {"R_igraph_is_graphical_degree_sequence", (DL_FUNC) &R_igraph_is_graphical_degree_sequence, 2},
+ {"R_igraph_is_loop", (DL_FUNC) &R_igraph_is_loop, 2},
+ {"R_igraph_is_matching", (DL_FUNC) &R_igraph_is_matching, 3},
+ {"R_igraph_is_maximal_matching", (DL_FUNC) &R_igraph_is_maximal_matching, 3},
+ {"R_igraph_is_minimal_separator", (DL_FUNC) &R_igraph_is_minimal_separator, 2},
+ {"R_igraph_is_multiple", (DL_FUNC) &R_igraph_is_multiple, 2},
+ {"R_igraph_is_mutual", (DL_FUNC) &R_igraph_is_mutual, 2},
+ {"R_igraph_is_separator", (DL_FUNC) &R_igraph_is_separator, 2},
+ {"R_igraph_is_simple", (DL_FUNC) &R_igraph_is_simple, 1},
+ {"R_igraph_isoclass", (DL_FUNC) &R_igraph_isoclass, 1},
+ {"R_igraph_isoclass_create", (DL_FUNC) &R_igraph_isoclass_create, 3},
+ {"R_igraph_isoclass_subgraph", (DL_FUNC) &R_igraph_isoclass_subgraph, 2},
+ {"R_igraph_isomorphic", (DL_FUNC) &R_igraph_isomorphic, 2},
+ {"R_igraph_isomorphic_34", (DL_FUNC) &R_igraph_isomorphic_34, 2},
+ {"R_igraph_isomorphic_bliss", (DL_FUNC) &R_igraph_isomorphic_bliss, 3},
+ {"R_igraph_isomorphic_vf2", (DL_FUNC) &R_igraph_isomorphic_vf2, 6},
+ {"R_igraph_k_regular_game", (DL_FUNC) &R_igraph_k_regular_game, 4},
+ {"R_igraph_kautz", (DL_FUNC) &R_igraph_kautz, 2},
+ {"R_igraph_laplacian", (DL_FUNC) &R_igraph_laplacian, 4},
+ {"R_igraph_laplacian_spectral_embedding", (DL_FUNC) &R_igraph_laplacian_spectral_embedding, 8},
+ {"R_igraph_largest_cliques", (DL_FUNC) &R_igraph_largest_cliques, 1},
+ {"R_igraph_largest_independent_vertex_sets", (DL_FUNC) &R_igraph_largest_independent_vertex_sets, 1},
+ {"R_igraph_lastcit_game", (DL_FUNC) &R_igraph_lastcit_game, 5},
+ {"R_igraph_lattice", (DL_FUNC) &R_igraph_lattice, 5},
+ {"R_igraph_layout_bipartite", (DL_FUNC) &R_igraph_layout_bipartite, 5},
+ {"R_igraph_layout_circle", (DL_FUNC) &R_igraph_layout_circle, 2},
+ {"R_igraph_layout_davidson_harel", (DL_FUNC) &R_igraph_layout_davidson_harel, 11},
+ {"R_igraph_layout_drl", (DL_FUNC) &R_igraph_layout_drl, 6},
+ {"R_igraph_layout_drl_3d", (DL_FUNC) &R_igraph_layout_drl_3d, 6},
+ {"R_igraph_layout_fruchterman_reingold", (DL_FUNC) &R_igraph_layout_fruchterman_reingold, 10},
+ {"R_igraph_layout_fruchterman_reingold_3d", (DL_FUNC) &R_igraph_layout_fruchterman_reingold_3d, 11},
+ {"R_igraph_layout_gem", (DL_FUNC) &R_igraph_layout_gem, 7},
+ {"R_igraph_layout_graphopt", (DL_FUNC) &R_igraph_layout_graphopt, 8},
+ {"R_igraph_layout_grid", (DL_FUNC) &R_igraph_layout_grid, 2},
+ {"R_igraph_layout_grid_3d", (DL_FUNC) &R_igraph_layout_grid_3d, 3},
+ {"R_igraph_layout_kamada_kawai", (DL_FUNC) &R_igraph_layout_kamada_kawai, 10},
+ {"R_igraph_layout_kamada_kawai_3d", (DL_FUNC) &R_igraph_layout_kamada_kawai_3d, 12},
+ {"R_igraph_layout_lgl", (DL_FUNC) &R_igraph_layout_lgl, 8},
+ {"R_igraph_layout_mds", (DL_FUNC) &R_igraph_layout_mds, 3},
+ {"R_igraph_layout_merge_dla", (DL_FUNC) &R_igraph_layout_merge_dla, 2},
+ {"R_igraph_layout_random", (DL_FUNC) &R_igraph_layout_random, 1},
+ {"R_igraph_layout_random_3d", (DL_FUNC) &R_igraph_layout_random_3d, 1},
+ {"R_igraph_layout_reingold_tilford", (DL_FUNC) &R_igraph_layout_reingold_tilford, 5},
+ {"R_igraph_layout_sphere", (DL_FUNC) &R_igraph_layout_sphere, 1},
+ {"R_igraph_layout_star", (DL_FUNC) &R_igraph_layout_star, 3},
+ {"R_igraph_layout_sugiyama", (DL_FUNC) &R_igraph_layout_sugiyama, 6},
+ {"R_igraph_lcf_vector", (DL_FUNC) &R_igraph_lcf_vector, 3},
+ {"R_igraph_line_graph", (DL_FUNC) &R_igraph_line_graph, 1},
+ {"R_igraph_list_triangles", (DL_FUNC) &R_igraph_list_triangles, 1},
+ {"R_igraph_local_scan_0", (DL_FUNC) &R_igraph_local_scan_0, 3},
+ {"R_igraph_local_scan_0_them", (DL_FUNC) &R_igraph_local_scan_0_them, 4},
+ {"R_igraph_local_scan_1_ecount", (DL_FUNC) &R_igraph_local_scan_1_ecount, 3},
+ {"R_igraph_local_scan_1_ecount_them", (DL_FUNC) &R_igraph_local_scan_1_ecount_them, 4},
+ {"R_igraph_local_scan_k_ecount", (DL_FUNC) &R_igraph_local_scan_k_ecount, 4},
+ {"R_igraph_local_scan_k_ecount_them", (DL_FUNC) &R_igraph_local_scan_k_ecount_them, 5},
+ {"R_igraph_local_scan_neighborhood_ecount", (DL_FUNC) &R_igraph_local_scan_neighborhood_ecount, 3},
+ {"R_igraph_make_weak_ref", (DL_FUNC) &R_igraph_make_weak_ref, 3},
+ {"R_igraph_maxflow", (DL_FUNC) &R_igraph_maxflow, 4},
+ {"R_igraph_maximal_cliques", (DL_FUNC) &R_igraph_maximal_cliques, 4},
+ {"R_igraph_maximal_cliques_count", (DL_FUNC) &R_igraph_maximal_cliques_count, 4},
+ {"R_igraph_maximal_cliques_file", (DL_FUNC) &R_igraph_maximal_cliques_file, 5},
+ {"R_igraph_maximal_independent_vertex_sets", (DL_FUNC) &R_igraph_maximal_independent_vertex_sets, 1},
+ {"R_igraph_maximum_bipartite_matching", (DL_FUNC) &R_igraph_maximum_bipartite_matching, 4},
+ {"R_igraph_maximum_cardinality_search", (DL_FUNC) &R_igraph_maximum_cardinality_search, 1},
+ {"R_igraph_mincut", (DL_FUNC) &R_igraph_mincut, 2},
+ {"R_igraph_mincut_value", (DL_FUNC) &R_igraph_mincut_value, 2},
+ {"R_igraph_minimum_size_separators", (DL_FUNC) &R_igraph_minimum_size_separators, 1},
+ {"R_igraph_minimum_spanning_tree_prim", (DL_FUNC) &R_igraph_minimum_spanning_tree_prim, 2},
+ {"R_igraph_minimum_spanning_tree_unweighted", (DL_FUNC) &R_igraph_minimum_spanning_tree_unweighted, 1},
+ {"R_igraph_modularity", (DL_FUNC) &R_igraph_modularity, 3},
+ {"R_igraph_modularity_matrix", (DL_FUNC) &R_igraph_modularity_matrix, 3},
+ {"R_igraph_motifs_randesu", (DL_FUNC) &R_igraph_motifs_randesu, 3},
+ {"R_igraph_motifs_randesu_estimate", (DL_FUNC) &R_igraph_motifs_randesu_estimate, 5},
+ {"R_igraph_motifs_randesu_no", (DL_FUNC) &R_igraph_motifs_randesu_no, 3},
+ {"R_igraph_mybracket", (DL_FUNC) &R_igraph_mybracket, 2},
+ {"R_igraph_mybracket2", (DL_FUNC) &R_igraph_mybracket2, 3},
+ {"R_igraph_mybracket2_copy", (DL_FUNC) &R_igraph_mybracket2_copy, 3},
+ {"R_igraph_mybracket2_names", (DL_FUNC) &R_igraph_mybracket2_names, 3},
+ {"R_igraph_mybracket2_set", (DL_FUNC) &R_igraph_mybracket2_set, 4},
+ {"R_igraph_mybracket3_set", (DL_FUNC) &R_igraph_mybracket3_set, 5},
+ {"R_igraph_neighborhood", (DL_FUNC) &R_igraph_neighborhood, 5},
+ {"R_igraph_neighborhood_graphs", (DL_FUNC) &R_igraph_neighborhood_graphs, 5},
+ {"R_igraph_neighborhood_size", (DL_FUNC) &R_igraph_neighborhood_size, 5},
+ {"R_igraph_neighbors", (DL_FUNC) &R_igraph_neighbors, 3},
+ {"R_igraph_no_clusters", (DL_FUNC) &R_igraph_no_clusters, 2},
+ {"R_igraph_pagerank_old", (DL_FUNC) &R_igraph_pagerank_old, 7},
+ {"R_igraph_path_length_hist", (DL_FUNC) &R_igraph_path_length_hist, 2},
+ {"R_igraph_permute_vertices", (DL_FUNC) &R_igraph_permute_vertices, 2},
+ {"R_igraph_personalized_pagerank", (DL_FUNC) &R_igraph_personalized_pagerank, 8},
+ {"R_igraph_power_law_fit", (DL_FUNC) &R_igraph_power_law_fit, 3},
+ {"R_igraph_preference_game", (DL_FUNC) &R_igraph_preference_game, 7},
+ {"R_igraph_psumtree_draw", (DL_FUNC) &R_igraph_psumtree_draw, 3},
+ {"R_igraph_radius", (DL_FUNC) &R_igraph_radius, 2},
+ {"R_igraph_random_sample", (DL_FUNC) &R_igraph_random_sample, 3},
+ {"R_igraph_random_walk", (DL_FUNC) &R_igraph_random_walk, 5},
+ {"R_igraph_read_graph_dimacs", (DL_FUNC) &R_igraph_read_graph_dimacs, 2},
+ {"R_igraph_read_graph_dl", (DL_FUNC) &R_igraph_read_graph_dl, 2},
+ {"R_igraph_read_graph_edgelist", (DL_FUNC) &R_igraph_read_graph_edgelist, 3},
+ {"R_igraph_read_graph_gml", (DL_FUNC) &R_igraph_read_graph_gml, 1},
+ {"R_igraph_read_graph_graphdb", (DL_FUNC) &R_igraph_read_graph_graphdb, 2},
+ {"R_igraph_read_graph_graphml", (DL_FUNC) &R_igraph_read_graph_graphml, 2},
+ {"R_igraph_read_graph_lgl", (DL_FUNC) &R_igraph_read_graph_lgl, 4},
+ {"R_igraph_read_graph_ncol", (DL_FUNC) &R_igraph_read_graph_ncol, 5},
+ {"R_igraph_read_graph_pajek", (DL_FUNC) &R_igraph_read_graph_pajek, 1},
+ {"R_igraph_recent_degree_aging_game", (DL_FUNC) &R_igraph_recent_degree_aging_game, 10},
+ {"R_igraph_reciprocity", (DL_FUNC) &R_igraph_reciprocity, 3},
+ {"R_igraph_rewire", (DL_FUNC) &R_igraph_rewire, 3},
+ {"R_igraph_rewire_edges", (DL_FUNC) &R_igraph_rewire_edges, 4},
+ {"R_igraph_ring", (DL_FUNC) &R_igraph_ring, 4},
+ {"R_igraph_running_mean", (DL_FUNC) &R_igraph_running_mean, 2},
+ {"R_igraph_sample_dirichlet", (DL_FUNC) &R_igraph_sample_dirichlet, 2},
+ {"R_igraph_sample_sphere_surface", (DL_FUNC) &R_igraph_sample_sphere_surface, 4},
+ {"R_igraph_sample_sphere_volume", (DL_FUNC) &R_igraph_sample_sphere_volume, 4},
+ {"R_igraph_sbm_game", (DL_FUNC) &R_igraph_sbm_game, 5},
+ {"R_igraph_scg_adjacency", (DL_FUNC) &R_igraph_scg_adjacency, 14},
+ {"R_igraph_scg_grouping", (DL_FUNC) &R_igraph_scg_grouping, 7},
+ {"R_igraph_scg_laplacian", (DL_FUNC) &R_igraph_scg_laplacian, 16},
+ {"R_igraph_scg_norm_eps", (DL_FUNC) &R_igraph_scg_norm_eps, 5},
+ {"R_igraph_scg_semiprojectors", (DL_FUNC) &R_igraph_scg_semiprojectors, 5},
+ {"R_igraph_scg_stochastic", (DL_FUNC) &R_igraph_scg_stochastic, 17},
+ {"R_igraph_set_verbose", (DL_FUNC) &R_igraph_set_verbose, 1},
+ {"R_igraph_shortest_paths", (DL_FUNC) &R_igraph_shortest_paths, 6},
+ {"R_igraph_similarity_dice", (DL_FUNC) &R_igraph_similarity_dice, 4},
+ {"R_igraph_similarity_inverse_log_weighted", (DL_FUNC) &R_igraph_similarity_inverse_log_weighted, 3},
+ {"R_igraph_similarity_jaccard", (DL_FUNC) &R_igraph_similarity_jaccard, 4},
+ {"R_igraph_simple_interconnected_islands_game", (DL_FUNC) &R_igraph_simple_interconnected_islands_game, 4},
+ {"R_igraph_simplify", (DL_FUNC) &R_igraph_simplify, 4},
+ {"R_igraph_sir", (DL_FUNC) &R_igraph_sir, 4},
+ {"R_igraph_solve_lsap", (DL_FUNC) &R_igraph_solve_lsap, 2},
+ {"R_igraph_spinglass_community", (DL_FUNC) &R_igraph_spinglass_community, 11},
+ {"R_igraph_spinglass_my_community", (DL_FUNC) &R_igraph_spinglass_my_community, 6},
+ {"R_igraph_split_join_distance", (DL_FUNC) &R_igraph_split_join_distance, 2},
+ {"R_igraph_st_edge_connectivity", (DL_FUNC) &R_igraph_st_edge_connectivity, 3},
+ {"R_igraph_st_mincut_value", (DL_FUNC) &R_igraph_st_mincut_value, 4},
+ {"R_igraph_st_vertex_connectivity", (DL_FUNC) &R_igraph_st_vertex_connectivity, 3},
+ {"R_igraph_star", (DL_FUNC) &R_igraph_star, 3},
+ {"R_igraph_static_fitness_game", (DL_FUNC) &R_igraph_static_fitness_game, 5},
+ {"R_igraph_static_power_law_game", (DL_FUNC) &R_igraph_static_power_law_game, 7},
+ {"R_igraph_strength", (DL_FUNC) &R_igraph_strength, 5},
+ {"R_igraph_subcomponent", (DL_FUNC) &R_igraph_subcomponent, 3},
+ {"R_igraph_subgraph", (DL_FUNC) &R_igraph_subgraph, 2},
+ {"R_igraph_subgraph_edges", (DL_FUNC) &R_igraph_subgraph_edges, 3},
+ {"R_igraph_subisomorphic_lad", (DL_FUNC) &R_igraph_subisomorphic_lad, 7},
+ {"R_igraph_subisomorphic_vf2", (DL_FUNC) &R_igraph_subisomorphic_vf2, 6},
+ {"R_igraph_to_directed", (DL_FUNC) &R_igraph_to_directed, 2},
+ {"R_igraph_to_undirected", (DL_FUNC) &R_igraph_to_undirected, 3},
+ {"R_igraph_topological_sorting", (DL_FUNC) &R_igraph_topological_sorting, 2},
+ {"R_igraph_transitivity_avglocal_undirected", (DL_FUNC) &R_igraph_transitivity_avglocal_undirected, 2},
+ {"R_igraph_transitivity_barrat", (DL_FUNC) &R_igraph_transitivity_barrat, 4},
+ {"R_igraph_transitivity_local_undirected", (DL_FUNC) &R_igraph_transitivity_local_undirected, 3},
+ {"R_igraph_transitivity_local_undirected_all", (DL_FUNC) &R_igraph_transitivity_local_undirected_all, 2},
+ {"R_igraph_transitivity_undirected", (DL_FUNC) &R_igraph_transitivity_undirected, 2},
+ {"R_igraph_tree", (DL_FUNC) &R_igraph_tree, 3},
+ {"R_igraph_triad_census", (DL_FUNC) &R_igraph_triad_census, 1},
+ {"R_igraph_unfold_tree", (DL_FUNC) &R_igraph_unfold_tree, 3},
+ {"R_igraph_union", (DL_FUNC) &R_igraph_union, 2},
+ {"R_igraph_vcount", (DL_FUNC) &R_igraph_vcount, 1},
+ {"R_igraph_version", (DL_FUNC) &R_igraph_version, 0},
+ {"R_igraph_vertex_connectivity", (DL_FUNC) &R_igraph_vertex_connectivity, 2},
+ {"R_igraph_vertex_disjoint_paths", (DL_FUNC) &R_igraph_vertex_disjoint_paths, 3},
+ {"R_igraph_vs_adj", (DL_FUNC) &R_igraph_vs_adj, 4},
+ {"R_igraph_vs_nei", (DL_FUNC) &R_igraph_vs_nei, 4},
+ {"R_igraph_walktrap_community", (DL_FUNC) &R_igraph_walktrap_community, 6},
+ {"R_igraph_watts_strogatz_game", (DL_FUNC) &R_igraph_watts_strogatz_game, 6},
+ {"R_igraph_weak_ref_key", (DL_FUNC) &R_igraph_weak_ref_key, 1},
+ {"R_igraph_weak_ref_run_finalizer", (DL_FUNC) &R_igraph_weak_ref_run_finalizer, 1},
+ {"R_igraph_weak_ref_value", (DL_FUNC) &R_igraph_weak_ref_value, 1},
+ {"R_igraph_weighted_adjacency", (DL_FUNC) &R_igraph_weighted_adjacency, 4},
+ {"R_igraph_write_graph_dimacs", (DL_FUNC) &R_igraph_write_graph_dimacs, 5},
+ {"R_igraph_write_graph_dot", (DL_FUNC) &R_igraph_write_graph_dot, 2},
+ {"R_igraph_write_graph_edgelist", (DL_FUNC) &R_igraph_write_graph_edgelist, 2},
+ {"R_igraph_write_graph_gml", (DL_FUNC) &R_igraph_write_graph_gml, 4},
+ {"R_igraph_write_graph_graphml", (DL_FUNC) &R_igraph_write_graph_graphml, 3},
+ {"R_igraph_write_graph_leda", (DL_FUNC) &R_igraph_write_graph_leda, 4},
+ {"R_igraph_write_graph_lgl", (DL_FUNC) &R_igraph_write_graph_lgl, 5},
+ {"R_igraph_write_graph_ncol", (DL_FUNC) &R_igraph_write_graph_ncol, 4},
+ {"R_igraph_write_graph_pajek", (DL_FUNC) &R_igraph_write_graph_pajek, 2},
+ {"UUID_gen", (DL_FUNC) &UUID_gen, 1},
+ {NULL, NULL, 0}
+};
diff --git a/src/lad.c b/src/lad.c
index 0e8aba7..ea5491a 100644
--- a/src/lad.c
+++ b/src/lad.c
@@ -1507,15 +1507,24 @@ int igraph_subisomorphic_lad(const igraph_t *pattern, const igraph_t *target,
IGRAPH_EINVAL);
}
+ if (igraph_is_directed(pattern) != igraph_is_directed(target)) {
+ IGRAPH_ERROR("Cannot search for a directed pattern in an undirected target "
+ "or vice versa", IGRAPH_EINVAL);
+ }
if (time_limit<=0) { time_limit = INT_MAX; }
- IGRAPH_CHECK(igraph_i_lad_createGraph(pattern, &Gp));
- IGRAPH_CHECK(igraph_i_lad_createGraph(target, &Gt));
-
- if (iso) { *iso = 0; }
+ if (iso) { *iso = (igraph_vcount(pattern) == 0); }
if (map) { igraph_vector_clear(map); }
if (maps) { igraph_vector_ptr_clear(maps); }
+ if (igraph_vcount(pattern) == 0) {
+ /* Special case for empty graphs */
+ return IGRAPH_SUCCESS;
+ }
+
+ IGRAPH_CHECK(igraph_i_lad_createGraph(pattern, &Gp));
+ IGRAPH_CHECK(igraph_i_lad_createGraph(target, &Gt));
+
if (Gp.nbVertices > Gt.nbVertices) { goto exit3; }
IGRAPH_CHECK(igraph_i_lad_initDomains(initialDomains, domains, &D, &Gp,
diff --git a/src/layout.c b/src/layout.c
index 48dbf1e..e09d668 100644
--- a/src/layout.c
+++ b/src/layout.c
@@ -2044,6 +2044,12 @@ int igraph_i_layout_mds_single(const igraph_t* graph, igraph_matrix_t *res,
* Since \ref igraph_layout_merge_dla works for 2D layouts only,
* you cannot run the MDS layout on disconnected graphs for
* more than two dimensions.
+ *
+ * </para><para>
+ * Warning: if the graph is symmetric to the exchange of two vertices
+ * (as is the case with leaves of a tree connecting to the same parent),
+ * classical multidimensional scaling may assign the same coordinates to
+ * these vertices.
*
* \param graph A graph object.
* \param res Pointer to an initialized matrix object. This will
diff --git a/src/layout_dh.c b/src/layout_dh.c
index 96c418e..63962b4 100644
--- a/src/layout_dh.c
+++ b/src/layout_dh.c
@@ -25,6 +25,9 @@
#include "igraph_layout.h"
#include "igraph_interface.h"
#include "igraph_random.h"
+#include "igraph_math.h"
+
+#include <math.h>
igraph_bool_t igraph_i_segments_intersect(float p0_x, float p0_y,
float p1_x, float p1_y,
@@ -349,10 +352,11 @@ int igraph_layout_davidson_harel(const igraph_t *graph, igraph_matrix_t *res,
float u_y=MATRIX(*res, u, 1);
igraph_integer_t w;
for (w = 0; w < no_nodes; w++) {
+ float w_x, w_y, d_ev;
if (w == v || w == u) { continue; }
- float w_x=MATRIX(*res, w, 0);
- float w_y=MATRIX(*res, w, 1);
- float d_ev = igraph_i_point_segment_dist2(w_x, w_y, old_x,
+ w_x=MATRIX(*res, w, 0);
+ w_y=MATRIX(*res, w, 1);
+ d_ev = igraph_i_point_segment_dist2(w_x, w_y, old_x,
old_y, u_x, u_y);
diff_energy -= w_node_edge_dist / d_ev;
d_ev = igraph_i_point_segment_dist2(w_x, w_y, new_x, new_y,
diff --git a/src/layout_fr.c b/src/layout_fr.c
index f6a17f7..31d3a0c 100644
--- a/src/layout_fr.c
+++ b/src/layout_fr.c
@@ -132,7 +132,8 @@ int igraph_layout_i_fr(const igraph_t *graph,
igraph_integer_t u=IGRAPH_TO(graph, e);
igraph_real_t dx=MATRIX(*res, v, 0) - MATRIX(*res, u, 0);
igraph_real_t dy=MATRIX(*res, v, 1) - MATRIX(*res, u, 1);
- igraph_real_t dlen=sqrt(dx * dx + dy * dy);
+ igraph_real_t w=weight ? VECTOR(*weight)[e] : 1.0;
+ igraph_real_t dlen=sqrt(dx * dx + dy * dy) * w;
VECTOR(dispx)[v] -= (dx * dlen);
VECTOR(dispy)[v] -= (dy * dlen);
VECTOR(dispx)[u] += (dx * dlen);
@@ -256,7 +257,8 @@ int igraph_layout_i_grid_fr(const igraph_t *graph,
igraph_integer_t u=IGRAPH_TO(graph, e);
igraph_real_t dx=MATRIX(*res, v, 0) - MATRIX(*res, u, 0);
igraph_real_t dy=MATRIX(*res, v, 1) - MATRIX(*res, u, 1);
- igraph_real_t dlen=sqrt(dx * dx + dy * dy);
+ igraph_real_t w=weight ? VECTOR(*weight)[e] : 1.0;
+ igraph_real_t dlen=sqrt(dx * dx + dy * dy) * w;
VECTOR(dispx)[v] -= (dx * dlen);
VECTOR(dispy)[v] -= (dy * dlen);
VECTOR(dispx)[u] += (dx * dlen);
@@ -619,7 +621,8 @@ int igraph_layout_fruchterman_reingold_3d(const igraph_t *graph,
igraph_real_t dx=MATRIX(*res, v, 0) - MATRIX(*res, u, 0);
igraph_real_t dy=MATRIX(*res, v, 1) - MATRIX(*res, u, 1);
igraph_real_t dz=MATRIX(*res, v, 2) - MATRIX(*res, u, 2);
- igraph_real_t dlen=sqrt(dx * dx + dy * dy + dz * dz);
+ igraph_real_t w=weight ? VECTOR(*weight)[e] : 1.0;
+ igraph_real_t dlen=sqrt(dx * dx + dy * dy + dz * dz) * w;
VECTOR(dispx)[v] -= (dx * dlen);
VECTOR(dispy)[v] -= (dy * dlen);
VECTOR(dispz)[v] -= (dz * dlen);
diff --git a/src/layout_gem.c b/src/layout_gem.c
index aab6442..fda34b1 100644
--- a/src/layout_gem.c
+++ b/src/layout_gem.c
@@ -25,8 +25,7 @@
#include "igraph_layout.h"
#include "igraph_interface.h"
#include "igraph_random.h"
-
-#include <math.h>
+#include "igraph_math.h"
/**
* \ingroup layout
diff --git a/src/layout_kk.c b/src/layout_kk.c
index 59ba9ee..37a3cde 100644
--- a/src/layout_kk.c
+++ b/src/layout_kk.c
@@ -176,7 +176,7 @@ int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
L = L0 / max_dij;
for (i=0; i<no_nodes; i++) {
- for (j=0; j<no_nodes; j++) {
+ for (j=0; j<no_nodes; j++) {
igraph_real_t tmp=MATRIX(dij, i, j) * MATRIX(dij, i, j);
if (i==j) { continue; }
MATRIX(kij, i, j) = kkconst / tmp;
@@ -190,10 +190,11 @@ int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
for (m=0; m<no_nodes; m++) {
igraph_real_t myD1=0.0, myD2=0.0;
for (i=0; i<no_nodes; i++) {
+ igraph_real_t dx, dy, mi_dist;
if (i==m) { continue; }
- igraph_real_t dx=MATRIX(*res, m, 0) - MATRIX(*res, i, 0);
- igraph_real_t dy=MATRIX(*res, m, 1) - MATRIX(*res, i, 1);
- igraph_real_t mi_dist=sqrt(dx * dx + dy * dy);
+ dx=MATRIX(*res, m, 0) - MATRIX(*res, i, 0);
+ dy=MATRIX(*res, m, 1) - MATRIX(*res, i, 1);
+ mi_dist=sqrt(dx * dx + dy * dy);
myD1 += MATRIX(kij, m, i) * (dx - MATRIX(lij, m, i) * dx / mi_dist);
myD2 += MATRIX(kij, m, i) * (dy - MATRIX(lij, m, i) * dy / mi_dist);
}
@@ -202,11 +203,12 @@ int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
}
for (j=0; j<maxiter; j++) {
-
- igraph_real_t myD1=0.0, myD2=0.0, A=0.0, B=0.0, C=0.0;
+ igraph_real_t myD1, myD2, A, B, C;
igraph_real_t max_delta, delta_x, delta_y;
igraph_real_t old_x, old_y, new_x, new_y;
-
+
+ myD1=0.0, myD2=0.0, A=0.0, B=0.0, C=0.0;
+
/* Select maximal delta */
m=0; max_delta=-1;
for (i=0; i<no_nodes; i++) {
@@ -222,11 +224,12 @@ int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
/* Calculate D1 and D2, A, B, C */
for (i=0; i<no_nodes; i++) {
+ igraph_real_t dx, dy, dist, den;
if (i==m) { continue; }
- igraph_real_t dx=old_x - MATRIX(*res, i, 0);
- igraph_real_t dy=old_y - MATRIX(*res, i, 1);
- igraph_real_t dist=sqrt(dx * dx + dy * dy);
- igraph_real_t den=dist * (dx * dx + dy * dy);
+ dx=old_x - MATRIX(*res, i, 0);
+ dy=old_y - MATRIX(*res, i, 1);
+ dist=sqrt(dx * dx + dy * dy);
+ den=dist * (dx * dx + dy * dy);
A += MATRIX(kij, m, i) * (1 - MATRIX(lij, m, i) * dy * dy / den);
B += MATRIX(kij, m, i) * MATRIX(lij, m, i) * dx * dy / den;
C += MATRIX(kij, m, i) * (1 - MATRIX(lij, m, i) * dx * dx / den);
@@ -250,13 +253,14 @@ int igraph_layout_kamada_kawai(const igraph_t *graph, igraph_matrix_t *res,
/* Update delta, only with/for the affected node */
VECTOR(D1)[m] = VECTOR(D2)[m] = 0.0;
for (i=0; i<no_nodes; i++) {
+ igraph_real_t old_dx, old_dy, old_mi, new_dx, new_dy, new_mi_dist, old_mi_dist;
if (i==m) { continue; }
- igraph_real_t old_dx=old_x - MATRIX(*res, i, 0);
- igraph_real_t old_dy=old_y - MATRIX(*res, i, 1);
- igraph_real_t old_mi_dist=sqrt(old_dx * old_dx + old_dy * old_dy);
- igraph_real_t new_dx=new_x - MATRIX(*res, i, 0);
- igraph_real_t new_dy=new_y - MATRIX(*res, i, 1);
- igraph_real_t new_mi_dist=sqrt(new_dx * new_dx + new_dy * new_dy);
+ old_dx=old_x - MATRIX(*res, i, 0);
+ old_dy=old_y - MATRIX(*res, i, 1);
+ old_mi_dist=sqrt(old_dx * old_dx + old_dy * old_dy);
+ new_dx=new_x - MATRIX(*res, i, 0);
+ new_dy=new_y - MATRIX(*res, i, 1);
+ new_mi_dist=sqrt(new_dx * new_dx + new_dy * new_dy);
VECTOR(D1)[i] -= MATRIX(kij, m, i) *
(-old_dx + MATRIX(lij, m, i) * old_dx / old_mi_dist);
@@ -462,13 +466,14 @@ int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res,
IGRAPH_VECTOR_INIT_FINALLY(&D2, no_nodes);
IGRAPH_VECTOR_INIT_FINALLY(&D3, no_nodes);
for (m=0; m<no_nodes; m++) {
+ igraph_real_t dx, dy, dz, mi_dist;
igraph_real_t myD1=0.0, myD2=0.0, myD3=0.0;
for (i=0; i<no_nodes; i++) {
if (i==m) { continue; }
- igraph_real_t dx=MATRIX(*res, m, 0) - MATRIX(*res, i, 0);
- igraph_real_t dy=MATRIX(*res, m, 1) - MATRIX(*res, i, 1);
- igraph_real_t dz=MATRIX(*res, m, 2) - MATRIX(*res, i, 2);
- igraph_real_t mi_dist=sqrt(dx * dx + dy * dy + dz * dz);
+ dx=MATRIX(*res, m, 0) - MATRIX(*res, i, 0);
+ dy=MATRIX(*res, m, 1) - MATRIX(*res, i, 1);
+ dz=MATRIX(*res, m, 2) - MATRIX(*res, i, 2);
+ mi_dist=sqrt(dx * dx + dy * dy + dz * dz);
myD1 += MATRIX(kij, m, i) * (dx - MATRIX(lij, m, i) * dx / mi_dist);
myD2 += MATRIX(kij, m, i) * (dy - MATRIX(lij, m, i) * dy / mi_dist);
myD3 += MATRIX(kij, m, i) * (dz - MATRIX(lij, m, i) * dz / mi_dist);
@@ -503,14 +508,15 @@ int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res,
/* Calculate D1, D2 and D3, and other coefficients */
for (i=0; i<no_nodes; i++) {
+ igraph_real_t dx, dy, dz, dist, den, k_mi, l_mi;
if (i==m) { continue; }
- igraph_real_t dx=old_x - MATRIX(*res, i, 0);
- igraph_real_t dy=old_y - MATRIX(*res, i, 1);
- igraph_real_t dz=old_z - MATRIX(*res, i, 2);
- igraph_real_t dist=sqrt(dx * dx + dy * dy + dz *dz);
- igraph_real_t den=dist * (dx * dx + dy * dy + dz * dz);
- igraph_real_t k_mi=MATRIX(kij, m, i);
- igraph_real_t l_mi=MATRIX(lij, m, i);
+ dx=old_x - MATRIX(*res, i, 0);
+ dy=old_y - MATRIX(*res, i, 1);
+ dz=old_z - MATRIX(*res, i, 2);
+ dist=sqrt(dx * dx + dy * dy + dz *dz);
+ den=dist * (dx * dx + dy * dy + dz * dz);
+ k_mi=MATRIX(kij, m, i);
+ l_mi=MATRIX(lij, m, i);
Axx += k_mi * (1 - l_mi * (dy*dy + dz*dz) / den);
Ayy += k_mi * (1 - l_mi * (dx*dx + dz*dz) / den);
Azz += k_mi * (1 - l_mi * (dx*dx + dy*dy) / den);
@@ -545,16 +551,17 @@ int igraph_layout_kamada_kawai_3d(const igraph_t *graph, igraph_matrix_t *res,
/* Update delta, only with/for the affected node */
VECTOR(D1)[m] = VECTOR(D2)[m] = VECTOR(D3)[m] = 0.0;
for (i=0; i<no_nodes; i++) {
+ igraph_real_t old_dx, old_dy, old_dz, old_mi_dist, new_dx, new_dy, new_dz, new_mi_dist;
if (i==m) { continue; }
- igraph_real_t old_dx=old_x - MATRIX(*res, i, 0);
- igraph_real_t old_dy=old_y - MATRIX(*res, i, 1);
- igraph_real_t old_dz=old_z - MATRIX(*res, i, 2);
- igraph_real_t old_mi_dist=sqrt(old_dx * old_dx + old_dy * old_dy +
+ old_dx=old_x - MATRIX(*res, i, 0);
+ old_dy=old_y - MATRIX(*res, i, 1);
+ old_dz=old_z - MATRIX(*res, i, 2);
+ old_mi_dist=sqrt(old_dx * old_dx + old_dy * old_dy +
old_dz * old_dz);
- igraph_real_t new_dx=new_x - MATRIX(*res, i, 0);
- igraph_real_t new_dy=new_y - MATRIX(*res, i, 1);
- igraph_real_t new_dz=new_z - MATRIX(*res, i, 2);
- igraph_real_t new_mi_dist=sqrt(new_dx * new_dx + new_dy * new_dy +
+ new_dx=new_x - MATRIX(*res, i, 0);
+ new_dy=new_y - MATRIX(*res, i, 1);
+ new_dz=new_z - MATRIX(*res, i, 2);
+ new_mi_dist=sqrt(new_dx * new_dx + new_dy * new_dy +
new_dz * new_dz);
VECTOR(D1)[i] -= MATRIX(kij, m, i) *
diff --git a/src/lazyeval.c b/src/lazyeval.c
index f5961c1..aa4dd1a 100644
--- a/src/lazyeval.c
+++ b/src/lazyeval.c
@@ -79,7 +79,6 @@ SEXP make_lazy_dots(SEXP env, SEXP follow_symbols_) {
return lazy_dots;
}
-#define USE_RINTERNALS
#include <R.h>
#include <Rdefines.h>
@@ -134,7 +133,6 @@ SEXP eval_call_(SEXP fun, SEXP dots, SEXP env) {
}
*/
-#define USE_RINTERNALS
#include <R.h>
#include <Rdefines.h>
diff --git a/src/matching.c b/src/matching.c
index ace6aa2..ae7f570 100644
--- a/src/matching.c
+++ b/src/matching.c
@@ -532,8 +532,11 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
igraph_vector_t vec1, vec2; /* general temporary vectors */
igraph_vector_t labels; /* will store the labels */
igraph_dqueue_long_t q; /* a FIFO for BST */
- igraph_bool_t smaller_set; /* denotes which part of the bipartite graph is smaller */
+ igraph_bool_t smaller_set_type; /* denotes which part of the bipartite graph is smaller */
+ igraph_vector_t smaller_set; /* stores the vertex IDs of the smaller set */
+ igraph_vector_t larger_set; /* stores the vertex IDs of the larger set */
long int smaller_set_size; /* size of the smaller set */
+ long int larger_set_size; /* size of the larger set */
igraph_real_t dual; /* solution of the dual problem */
igraph_adjlist_t tight_phantom_edges; /* adjacency list to manage tight phantom edges */
igraph_integer_t alternating_path_endpoint;
@@ -570,15 +573,28 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
IGRAPH_FINALLY(igraph_adjlist_destroy, &tight_phantom_edges);
IGRAPH_CHECK(igraph_inclist_init(graph, &inclist, IGRAPH_ALL));
IGRAPH_FINALLY(igraph_inclist_destroy, &inclist);
+ IGRAPH_VECTOR_INIT_FINALLY(&smaller_set, 0);
+ IGRAPH_VECTOR_INIT_FINALLY(&larger_set, 0);
/* (2) Find which set is the smaller one */
j = 0;
for (i = 0; i < no_of_nodes; i++) {
- if (VECTOR(*types)[i] == 0)
+ if (VECTOR(*types)[i] == 0) {
j++;
+ }
+ }
+ smaller_set_type = (j > no_of_nodes / 2);
+ smaller_set_size = smaller_set_type ? (no_of_nodes - j) : j;
+ larger_set_size = no_of_nodes - smaller_set_size;
+ IGRAPH_CHECK(igraph_vector_reserve(&smaller_set, smaller_set_size));
+ IGRAPH_CHECK(igraph_vector_reserve(&larger_set, larger_set_size));
+ for (i = 0; i < no_of_nodes; i++) {
+ if (VECTOR(*types)[i] == smaller_set_type) {
+ IGRAPH_CHECK(igraph_vector_push_back(&smaller_set, i));
+ } else {
+ IGRAPH_CHECK(igraph_vector_push_back(&larger_set, i));
+ }
}
- smaller_set = (j > no_of_nodes / 2);
- smaller_set_size = smaller_set ? (no_of_nodes - j) : j;
/* (3) Calculate the initial labeling and the set of tight edges. Use the
* smaller set only. Here we can assume that there are no phantom edges
@@ -587,7 +603,7 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
for (i = 0; i < no_of_nodes; i++) {
igraph_real_t max_weight = 0;
- if (VECTOR(*types)[i] != smaller_set) {
+ if (VECTOR(*types)[i] != smaller_set_type) {
VECTOR(labels)[i] = 0;
continue;
}
@@ -637,8 +653,9 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
igraph_vector_clear(&vec1);
igraph_vector_clear(&vec2);
igraph_vector_fill(&parent, -1);
- for (i = 0; i < no_of_nodes; i++) {
- if (UNMATCHED(i) && VECTOR(*types)[i] == smaller_set) {
+ for (j = 0; j < smaller_set_size; j++) {
+ i = VECTOR(smaller_set)[j];
+ if (UNMATCHED(i)) {
IGRAPH_CHECK(igraph_dqueue_long_push(&q, i));
VECTOR(parent)[i] = i;
IGRAPH_CHECK(igraph_vector_push_back(&vec1, i));
@@ -759,7 +776,7 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
VECTOR(match)[u] = v;
v = (igraph_integer_t) VECTOR(parent)[u];
- u = (igraph_integer_t) VECTOR(parent)[v];
+ u = (igraph_integer_t) VECTOR(parent)[v];
}
msize++;
@@ -794,9 +811,8 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
min_slack = IGRAPH_INFINITY;
min_slack_u = min_slack_v = 0;
n = igraph_vector_size(&vec1);
- for (i = 0; i < no_of_nodes; i++) {
- if (VECTOR(*types)[i] == smaller_set)
- continue;
+ for (j = 0; j < larger_set_size; j++) {
+ i = VECTOR(larger_set)[j];
if (VECTOR(labels)[i] < min_slack) {
min_slack = VECTOR(labels)[i];
min_slack_v = (igraph_integer_t) i;
@@ -894,22 +910,18 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
* isolated nodes in the input graph.
*
* TODO: this is O(n^2) here. Can we do it faster? */
- for (u = 0; u < no_of_nodes; u++) {
- if (VECTOR(*types)[u] != smaller_set)
- continue;
-
- for (v = 0; v < no_of_nodes; v++) {
- if (VECTOR(*types)[v] == smaller_set)
- continue;
-
+ for (i = 0; i < smaller_set_size; i++) {
+ u = VECTOR(smaller_set)[i];
+ for (j = 0; j < larger_set_size; j++) {
+ v = VECTOR(larger_set)[j];
if (VECTOR(labels)[(long int)u] + VECTOR(labels)[(long int)v] <= eps) {
/* Tight phantom edge found. Note that we don't have to check whether
* u and v are connected; if they were, then the slack of this edge
* would be negative. */
neis2 = igraph_adjlist_get(&tight_phantom_edges, u);
- if (!igraph_vector_int_binsearch(neis2, v, &i)) {
+ if (!igraph_vector_int_binsearch(neis2, v, &k)) {
debug("New tight phantom edge: %ld -- %ld\n", (long)u, (long)v);
- IGRAPH_CHECK(igraph_vector_int_insert(neis2, i, v));
+ IGRAPH_CHECK(igraph_vector_int_insert(neis2, k, v));
}
}
}
@@ -924,15 +936,13 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
}
/* Cleanup: remove phantom edges from the matching */
- for (i = 0; i < no_of_nodes; i++) {
- if (VECTOR(*types)[i] != smaller_set)
- continue;
-
- if (VECTOR(match)[i] != -1) {
- j = VECTOR(match)[i];
- neis2 = igraph_adjlist_get(&tight_phantom_edges, i);
- if (igraph_vector_int_binsearch(neis2, j, 0)) {
- VECTOR(match)[i] = VECTOR(match)[j] = -1;
+ for (i = 0; i < smaller_set_size; i++) {
+ u = VECTOR(smaller_set)[i];
+ v = VECTOR(match)[u];
+ if (v != -1) {
+ neis2 = igraph_adjlist_get(&tight_phantom_edges, u);
+ if (igraph_vector_int_binsearch(neis2, v, 0)) {
+ VECTOR(match)[u] = VECTOR(match)[v] = -1;
msize--;
}
}
@@ -958,6 +968,8 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
/* Release everything */
#undef IS_TIGHT
+ igraph_vector_destroy(&larger_set);
+ igraph_vector_destroy(&smaller_set);
igraph_inclist_destroy(&inclist);
igraph_adjlist_destroy(&tight_phantom_edges);
igraph_vector_destroy(&parent);
@@ -967,7 +979,7 @@ int igraph_i_maximum_bipartite_matching_weighted(const igraph_t* graph,
igraph_vector_destroy(&vec2);
igraph_vector_destroy(&slack);
igraph_vector_long_destroy(&match);
- IGRAPH_FINALLY_CLEAN(9);
+ IGRAPH_FINALLY_CLEAN(11);
return IGRAPH_SUCCESS;
}
diff --git a/src/memory.c b/src/memory.c
index bb0424f..3e90644 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -67,9 +67,33 @@
* \return Error code, currently always zero, meaning success.
*
* Time complexity: platform dependent, ideally it should be O(1).
+ *
+ * \sa \ref igraph_malloc()
*/
int igraph_free(void *p) {
igraph_Free(p);
return 0;
}
+
+
+/**
+ * \function igraph_malloc
+ * Allocate memory that can be safely deallocated by igraph functions
+ *
+ * Some igraph functions, such as \ref igraph_vector_ptr_free_all() and
+ * \ref igraph_vector_ptr_destroy_all() can free memory that may have been
+ * allocated by the user. \c igraph_malloc() works exactly like \c malloc()
+ * from the C standard library, but it is guaranteed that it can be safely
+ * paired with the \c free() function used by igraph internally (which is
+ * also user-accessible through \ref igraph_free()).
+ *
+ * \param n Number of bytes to be allocated.
+ * \return Pointer to the piece of allocated memory.
+ *
+ * \sa \ref igraph_free()
+ */
+
+void *igraph_malloc(size_t n) {
+ return malloc(n);
+}
diff --git a/src/microscopic_update.c b/src/microscopic_update.c
index b589ecb..d0a22b1 100644
--- a/src/microscopic_update.c
+++ b/src/microscopic_update.c
@@ -171,7 +171,9 @@ int igraph_ecumulative_proportionate_values(const igraph_t *graph,
igraph_eit_destroy(&A);
igraph_es_destroy(&es);
- IGRAPH_FINALLY_CLEAN(2);
+
+ /* Pop V, A and es from the finally stack -- that's three items */
+ IGRAPH_FINALLY_CLEAN(3);
return IGRAPH_SUCCESS;
}
diff --git a/src/motifs.c b/src/motifs.c
index 57c665e..4fcba9d 100644
--- a/src/motifs.c
+++ b/src/motifs.c
@@ -836,7 +836,8 @@ int igraph_motifs_randesu_no(const igraph_t *graph, igraph_integer_t *no,
* \param asym Pointer to an integer, the number of asymmetric dyads
* is stored here.
* \param null Pointer to an integer, the number of null dyads is
- * stored here.
+ * stored here. In case of an integer overflow (i.e. too many
+ * null dyads), -1 will be returned.
* \return Error code.
*
* \sa \ref igraph_reciprocity(), \ref igraph_triad_census().
@@ -896,8 +897,8 @@ int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut,
*null = (vc/2) * (vc-1);
}
if (*null < vc) {
- IGRAPH_WARNING("Integer overflow, returning zero");
- *null = IGRAPH_NAN;
+ IGRAPH_WARNING("Integer overflow, returning -1");
+ *null = -1;
} else {
*null = *null-(*mut)-(*asym);
}
@@ -910,8 +911,8 @@ int igraph_dyad_census(const igraph_t *graph, igraph_integer_t *mut,
* TODO
*/
-int igraph_triad_census_24(const igraph_t *graph, igraph_integer_t *res2,
- igraph_integer_t *res4) {
+int igraph_triad_census_24(const igraph_t *graph, igraph_real_t *res2,
+ igraph_real_t *res4) {
long int vc=igraph_vcount(graph);
igraph_vector_long_t seen;
@@ -1042,9 +1043,10 @@ int igraph_triad_census_24(const igraph_t *graph, igraph_integer_t *res2,
int igraph_triad_census(const igraph_t *graph, igraph_vector_t *res) {
igraph_vector_t cut_prob;
- igraph_integer_t m2, m4;
+ igraph_real_t m2, m4;
igraph_vector_t tmp;
igraph_integer_t vc=igraph_vcount(graph);
+ igraph_real_t total;
if (!igraph_is_directed(graph)) {
IGRAPH_WARNING("Triad census called on an undirected graph");
@@ -1053,31 +1055,47 @@ int igraph_triad_census(const igraph_t *graph, igraph_vector_t *res) {
IGRAPH_VECTOR_INIT_FINALLY(&tmp, 0);
IGRAPH_VECTOR_INIT_FINALLY(&cut_prob, 3); /* all zeros */
IGRAPH_CHECK(igraph_vector_resize(res, 16));
+ igraph_vector_null(res);
IGRAPH_CHECK(igraph_motifs_randesu(graph, &tmp, 3, &cut_prob));
-
IGRAPH_CHECK(igraph_triad_census_24(graph, &m2, &m4));
- VECTOR(tmp)[0]=0;
- VECTOR(tmp)[1]=m2;
- VECTOR(tmp)[3]=m4;
- VECTOR(tmp)[0]=vc*(vc-1)*(vc-2)/6 - igraph_vector_sum(&tmp);
+
+ total = ((igraph_real_t)vc) * (vc-1);
+ total *= (vc-2);
+ total /= 6;
/* Reorder */
- VECTOR(*res)[0] = VECTOR(tmp)[0];
- VECTOR(*res)[1] = VECTOR(tmp)[1];
- VECTOR(*res)[2] = VECTOR(tmp)[3];
- VECTOR(*res)[3] = VECTOR(tmp)[6];
- VECTOR(*res)[4] = VECTOR(tmp)[2];
- VECTOR(*res)[5] = VECTOR(tmp)[4];
- VECTOR(*res)[6] = VECTOR(tmp)[5];
- VECTOR(*res)[7] = VECTOR(tmp)[9];
- VECTOR(*res)[8] = VECTOR(tmp)[7];
- VECTOR(*res)[9] = VECTOR(tmp)[11];
- VECTOR(*res)[10] = VECTOR(tmp)[10];
- VECTOR(*res)[11] = VECTOR(tmp)[8];
- VECTOR(*res)[12] = VECTOR(tmp)[13];
- VECTOR(*res)[13] = VECTOR(tmp)[12];
- VECTOR(*res)[14] = VECTOR(tmp)[14];
- VECTOR(*res)[15] = VECTOR(tmp)[15];
+ if (igraph_is_directed(graph)) {
+ VECTOR(tmp)[0] = 0;
+ VECTOR(tmp)[1] = m2;
+ VECTOR(tmp)[3] = m4;
+ VECTOR(tmp)[0] = total - igraph_vector_sum(&tmp);
+
+ VECTOR(*res)[0] = VECTOR(tmp)[0];
+ VECTOR(*res)[1] = VECTOR(tmp)[1];
+ VECTOR(*res)[2] = VECTOR(tmp)[3];
+ VECTOR(*res)[3] = VECTOR(tmp)[6];
+ VECTOR(*res)[4] = VECTOR(tmp)[2];
+ VECTOR(*res)[5] = VECTOR(tmp)[4];
+ VECTOR(*res)[6] = VECTOR(tmp)[5];
+ VECTOR(*res)[7] = VECTOR(tmp)[9];
+ VECTOR(*res)[8] = VECTOR(tmp)[7];
+ VECTOR(*res)[9] = VECTOR(tmp)[11];
+ VECTOR(*res)[10] = VECTOR(tmp)[10];
+ VECTOR(*res)[11] = VECTOR(tmp)[8];
+ VECTOR(*res)[12] = VECTOR(tmp)[13];
+ VECTOR(*res)[13] = VECTOR(tmp)[12];
+ VECTOR(*res)[14] = VECTOR(tmp)[14];
+ VECTOR(*res)[15] = VECTOR(tmp)[15];
+ } else {
+ VECTOR(tmp)[0] = 0;
+ VECTOR(tmp)[1] = m2;
+ VECTOR(tmp)[0] = total - igraph_vector_sum(&tmp);
+
+ VECTOR(*res)[0] = VECTOR(tmp)[0];
+ VECTOR(*res)[2] = VECTOR(tmp)[1];
+ VECTOR(*res)[10] = VECTOR(tmp)[2];
+ VECTOR(*res)[15] = VECTOR(tmp)[3];
+ }
igraph_vector_destroy(&cut_prob);
igraph_vector_destroy(&tmp);
diff --git a/src/paths.c b/src/paths.c
index 049163a..c02fa3e 100644
--- a/src/paths.c
+++ b/src/paths.c
@@ -109,14 +109,15 @@ int igraph_get_all_simple_paths(const igraph_t *graph,
igraph_vector_t *neis=igraph_lazy_adjlist_get(&adjlist, act);
int n=igraph_vector_size(neis);
int *ptr=igraph_vector_int_e_ptr(&nptr, act);
+ igraph_bool_t any;
+ int nei;
if (iteration == 0) {
IGRAPH_ALLOW_INTERRUPTION();
}
/* Search for a neighbor that was not yet visited */
- igraph_bool_t any=0;
- int nei;
+ any = 0;
while (!any && (*ptr) <n) {
nei = (int) VECTOR(*neis)[(*ptr)];
any = !VECTOR(added)[nei];
diff --git a/src/pottsmodel_2.cpp b/src/pottsmodel_2.cpp
index 6ac94bf..44f83bc 100644
--- a/src/pottsmodel_2.cpp
+++ b/src/pottsmodel_2.cpp
@@ -2096,7 +2096,7 @@ long PottsModelN::WriteClusters(igraph_real_t *modularity,
}
assign_initial_conf(false);
- delete cluster_assign;
+ delete[] cluster_assign;
if (temperature) { *temperature=t; }
diff --git a/src/prpack.cpp b/src/prpack.cpp
index 9a9f863..009347e 100644
--- a/src/prpack.cpp
+++ b/src/prpack.cpp
@@ -67,6 +67,11 @@ int igraph_personalized_pagerank_prpack(const igraph_t *graph, igraph_vector_t *
prpack_solver solver(&prpack_graph, false);
res = solver.solve(damping, 1e-10, u, v, "");
+ // Delete the personalization vector
+ if (v) {
+ delete[] v;
+ }
+
// Check whether the solver converged
// TODO: this is commented out because some of the solvers do not implement it yet
/*
diff --git a/src/prpack/prpack_csc.h b/src/prpack/prpack_csc.h
index 7826fa3..977481e 100644
--- a/src/prpack/prpack_csc.h
+++ b/src/prpack/prpack_csc.h
@@ -1,7 +1,12 @@
#ifndef PRPACK_CSC
#define PRPACK_CSC
-#include <stdint.h>
+#if !defined(_MSC_VER) && !defined (__MINGW32__) && !defined (__MINGW64__)
+# include <stdint.h>
+#else
+# include <stdio.h>
+typedef __int64 int64_t;
+#endif
namespace prpack {
diff --git a/src/prpack/prpack_igraph_graph.cpp b/src/prpack/prpack_igraph_graph.cpp
index 76f9bf4..6c0400e 100644
--- a/src/prpack/prpack_igraph_graph.cpp
+++ b/src/prpack/prpack_igraph_graph.cpp
@@ -8,11 +8,11 @@ using namespace std;
#ifdef PRPACK_IGRAPH_SUPPORT
prpack_igraph_graph::prpack_igraph_graph(const igraph_t* g, const igraph_vector_t* weights,
- igraph_bool_t directed) {
+ igraph_bool_t directed) {
const igraph_bool_t treat_as_directed = igraph_is_directed(g) && directed;
igraph_es_t es;
igraph_eit_t eit;
- igraph_vector_t neis;
+ igraph_vector_t neis;
long int i, j, eid, sum, temp, num_ignored_es;
int *p_head, *p_head_copy;
double* p_weight;
@@ -21,7 +21,7 @@ prpack_igraph_graph::prpack_igraph_graph(const igraph_t* g, const igraph_vector_
// an edge in both directions.
num_vs = igraph_vcount(g);
num_es = igraph_ecount(g);
- num_self_es = 0;
+ num_self_es = 0;
if (!treat_as_directed) {
num_es *= 2;
}
@@ -39,15 +39,15 @@ prpack_igraph_graph::prpack_igraph_graph(const igraph_t* g, const igraph_vector_
// Count the number of ignored edges (those with negative or zero weight)
num_ignored_es = 0;
- if (treat_as_directed) {
- // Select all the edges and iterate over them by the source vertices
- es = igraph_ess_all(IGRAPH_EDGEORDER_TO);
+ if (treat_as_directed) {
+ // Select all the edges and iterate over them by the source vertices
+ es = igraph_ess_all(IGRAPH_EDGEORDER_TO);
- // Add the edges
- igraph_eit_create(g, es, &eit);
- while (!IGRAPH_EIT_END(eit)) {
- eid = IGRAPH_EIT_GET(eit);
- IGRAPH_EIT_NEXT(eit);
+ // Add the edges
+ igraph_eit_create(g, es, &eit);
+ while (!IGRAPH_EIT_END(eit)) {
+ eid = IGRAPH_EIT_GET(eit);
+ IGRAPH_EIT_NEXT(eit);
// Handle the weight
if (weights != 0) {
@@ -58,30 +58,30 @@ prpack_igraph_graph::prpack_igraph_graph(const igraph_t* g, const igraph_vector_
continue;
}
- *p_weight = VECTOR(*weights)[eid];
- ++p_weight;
+ *p_weight = VECTOR(*weights)[eid];
+ ++p_weight;
}
- *p_head = IGRAPH_FROM(g, eid);
- ++p_head;
- ++tails[IGRAPH_TO(g, eid)];
+ *p_head = IGRAPH_FROM(g, eid);
+ ++p_head;
+ ++tails[IGRAPH_TO(g, eid)];
- if (IGRAPH_FROM(g, eid) == IGRAPH_TO(g, eid)) {
- ++num_self_es;
- }
- }
- igraph_eit_destroy(&eit);
- } else {
- // Select all the edges and iterate over them by the target vertices
- igraph_vector_init(&neis, 0);
+ if (IGRAPH_FROM(g, eid) == IGRAPH_TO(g, eid)) {
+ ++num_self_es;
+ }
+ }
+ igraph_eit_destroy(&eit);
+ } else {
+ // Select all the edges and iterate over them by the target vertices
+ igraph_vector_init(&neis, 0);
- for (i = 0; i < num_vs; i++) {
- igraph_incident(g, &neis, i, IGRAPH_ALL);
- temp = igraph_vector_size(&neis);
+ for (i = 0; i < num_vs; i++) {
+ igraph_incident(g, &neis, i, IGRAPH_ALL);
+ temp = igraph_vector_size(&neis);
- // TODO: should loop edges be added in both directions?
+ // TODO: should loop edges be added in both directions?
p_head_copy = p_head;
- for (j = 0; j < temp; j++) {
+ for (j = 0; j < temp; j++) {
if (weights != 0) {
if (VECTOR(*weights)[(long int)VECTOR(neis)[j]] <= 0) {
// Ignore
@@ -89,21 +89,21 @@ prpack_igraph_graph::prpack_igraph_graph(const igraph_t* g, const igraph_vector_
continue;
}
- *p_weight = VECTOR(*weights)[(long int)VECTOR(neis)[j]];
- ++p_weight;
+ *p_weight = VECTOR(*weights)[(long int)VECTOR(neis)[j]];
+ ++p_weight;
}
- *p_head = IGRAPH_OTHER(g, VECTOR(neis)[j], i);
- if (i == *p_head) {
- num_self_es++;
- }
- ++p_head;
- }
+ *p_head = IGRAPH_OTHER(g, VECTOR(neis)[j], i);
+ if (i == *p_head) {
+ num_self_es++;
+ }
+ ++p_head;
+ }
tails[i] = p_head - p_head_copy;
- }
+ }
- igraph_vector_destroy(&neis);
- }
+ igraph_vector_destroy(&neis);
+ }
// Decrease num_es by the number of ignored edges
num_es -= num_ignored_es;
@@ -118,26 +118,26 @@ prpack_igraph_graph::prpack_igraph_graph(const igraph_t* g, const igraph_vector_
// Normalize the weights
normalize_weights();
- // Debug
+ // Debug
/*
- printf("Heads:");
- for (i = 0; i < num_es; ++i) {
- printf(" %d", heads[i]);
- }
- printf("\n");
- printf("Tails:");
- for (i = 0; i < num_vs; ++i) {
- printf(" %d", tails[i]);
- }
- printf("\n");
- if (vals) {
- printf("Vals:");
- for (i = 0; i < num_es; ++i) {
- printf(" %.4f", vals[i]);
- }
- printf("\n");
- }
- printf("===========================\n");
+ printf("Heads:");
+ for (i = 0; i < num_es; ++i) {
+ printf(" %d", heads[i]);
+ }
+ printf("\n");
+ printf("Tails:");
+ for (i = 0; i < num_vs; ++i) {
+ printf(" %d", tails[i]);
+ }
+ printf("\n");
+ if (vals) {
+ printf("Vals:");
+ for (i = 0; i < num_es; ++i) {
+ printf(" %.4f", vals[i]);
+ }
+ printf("\n");
+ }
+ printf("===========================\n");
*/
}
diff --git a/src/prpack/prpack_solver.cpp b/src/prpack/prpack_solver.cpp
index d67e132..de82769 100644
--- a/src/prpack/prpack_solver.cpp
+++ b/src/prpack/prpack_solver.cpp
@@ -4,7 +4,6 @@
#include <cstdlib>
#include <cstring>
#include <algorithm>
-#include <stdint.h>
using namespace prpack;
using namespace std;
diff --git a/src/rinterface.c b/src/rinterface.c
index c741854..222976b 100644
--- a/src/rinterface.c
+++ b/src/rinterface.c
@@ -26,12 +26,13 @@
#include "config.h"
-#define USE_RINTERNALS
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
#include "rinterface.h"
+#include "init.c" /* registration table */
+
#include <stdio.h>
int igraph_free(void *p);
@@ -1726,7 +1727,7 @@ int R_igraph_attribute_combine_vertices(const igraph_t *graph,
SEXP res;
int keepno=0;
int *TODO;
- void **funcs;
+ igraph_function_pointer_t *funcs;
/* Create the TODO list first */
PROTECT(names=GET_NAMES(val));
@@ -1736,7 +1737,7 @@ int R_igraph_attribute_combine_vertices(const igraph_t *graph,
IGRAPH_ENOMEM);
}
IGRAPH_FINALLY(igraph_free, TODO);
- funcs=igraph_Calloc(valno, void*);
+ funcs=igraph_Calloc(valno, igraph_function_pointer_t);
if (!funcs) {
IGRAPH_ERROR("Cannot combine edge attributes",
IGRAPH_ENOMEM);
@@ -1745,7 +1746,7 @@ int R_igraph_attribute_combine_vertices(const igraph_t *graph,
for (i=0; i<valno; i++) {
const char *name=CHAR(STRING_ELT(names, i));
igraph_attribute_combination_type_t todo;
- void *voidfunc;
+ igraph_function_pointer_t voidfunc;
igraph_attribute_combination_query(comb, name, &todo, &voidfunc);
TODO[i]=todo;
funcs[i]=voidfunc;
@@ -1891,7 +1892,7 @@ int R_igraph_attribute_combine_edges(const igraph_t *graph,
SEXP res;
int keepno=0;
int *TODO;
- void **funcs;
+ igraph_function_pointer_t *funcs;
/* Create the TODO list first */
PROTECT(names=GET_NAMES(eal));
@@ -1901,7 +1902,7 @@ int R_igraph_attribute_combine_edges(const igraph_t *graph,
IGRAPH_ENOMEM);
}
IGRAPH_FINALLY(igraph_free, TODO);
- funcs=igraph_Calloc(ealno, void*);
+ funcs=igraph_Calloc(ealno, igraph_function_pointer_t);
if (!funcs) {
IGRAPH_ERROR("Cannot combine edge attributes",
IGRAPH_ENOMEM);
@@ -1910,7 +1911,7 @@ int R_igraph_attribute_combine_edges(const igraph_t *graph,
for (i=0; i<ealno; i++) {
const char *name=CHAR(STRING_ELT(names, i));
igraph_attribute_combination_type_t todo;
- void *voidfunc;
+ igraph_function_pointer_t voidfunc;
igraph_attribute_combination_query(comb, name, &todo, &voidfunc);
TODO[i]=todo;
funcs[i]=voidfunc;
@@ -2124,12 +2125,15 @@ int R_igraph_status_handler(const char *message, void *data) {
return 0;
}
-SEXP R_init_igraph() {
+void R_init_igraph(DllInfo *dll) {
+ R_registerRoutines(dll, CEntries, CallEntries, NULL, NULL);
+ R_useDynamicSymbols(dll, FALSE);
+ R_forceSymbols(dll, TRUE);
+
igraph_set_error_handler(R_igraph_myhandler);
igraph_set_warning_handler(R_igraph_warning_handler);
igraph_set_interruption_handler(R_igraph_interrupt_handler);
igraph_i_set_attribute_table(&R_igraph_attribute_table);
- return R_NilValue;
}
SEXP R_igraph_set_verbose(SEXP verbose) {
@@ -3911,7 +3915,7 @@ SEXP R_igraph_barabasi_game(SEXP pn, SEXP ppower, SEXP pm, SEXP poutseq,
igraph_t g;
igraph_integer_t n=(igraph_integer_t) REAL(pn)[0];
igraph_real_t power=REAL(ppower)[0];
- igraph_integer_t m=(igraph_integer_t) REAL(pm)[0];
+ igraph_integer_t m=isNull(pm) ? 0 : (igraph_integer_t) REAL(pm)[0];
igraph_vector_t outseq, *myoutseq=0;
igraph_bool_t outpref=LOGICAL(poutpref)[0];
igraph_real_t A=REAL(pA)[0];
@@ -3930,7 +3934,7 @@ SEXP R_igraph_barabasi_game(SEXP pn, SEXP ppower, SEXP pm, SEXP poutseq,
ppstart=&start;
}
- igraph_barabasi_game(&g, n, power, m, &outseq, outpref,
+ igraph_barabasi_game(&g, n, power, m, myoutseq, outpref,
A, directed, algo, ppstart);
PROTECT(result=R_igraph_to_SEXP(&g));
igraph_destroy(&g);
@@ -4088,7 +4092,6 @@ SEXP R_igraph_layout_kamada_kawai(SEXP graph, SEXP coords, SEXP maxiter,
/* Declarations */
igraph_t c_graph;
igraph_matrix_t c_coords;
- igraph_bool_t c_use_seed;
igraph_integer_t c_maxiter;
igraph_real_t c_epsilon;
igraph_real_t c_kkconst;
@@ -4146,7 +4149,6 @@ SEXP R_igraph_layout_kamada_kawai_3d(SEXP graph, SEXP coords, SEXP maxiter,
/* Declarations */
igraph_t c_graph;
igraph_matrix_t c_coords;
- igraph_bool_t c_use_seed;
igraph_integer_t c_maxiter;
igraph_real_t c_epsilon;
igraph_real_t c_kkconst;
@@ -6832,7 +6834,6 @@ SEXP R_igraph_maximal_cliques(SEXP graph, SEXP psubset,
SEXP R_igraph_maximal_cliques_file(SEXP graph, SEXP psubset, SEXP file,
SEXP pminsize, SEXP pmaxsize) {
igraph_t g;
- long int i;
igraph_integer_t minsize=(igraph_integer_t) REAL(pminsize)[0];
igraph_integer_t maxsize=(igraph_integer_t) REAL(pmaxsize)[0];
igraph_vector_int_t subset;
@@ -7993,9 +7994,13 @@ SEXP R_igraph_cohesive_blocks(SEXP graph) {
return result;
}
+typedef struct {
+ igraph_arpack_function_t *fun;
+} R_igraph_i_function_container_t;
+
SEXP R_igraph_i_levc_arp(SEXP extP, SEXP extE, SEXP pv) {
- igraph_arpack_function_t *fun=
- (igraph_arpack_function_t *) R_ExternalPtrAddr(extP);
+ R_igraph_i_function_container_t *cont = R_ExternalPtrAddr(extP);
+ igraph_arpack_function_t *fun= cont->fun;
void *extra=R_ExternalPtrAddr(extE);
SEXP res;
@@ -8026,6 +8031,7 @@ int R_igraph_i_levc_callback(const igraph_vector_t *membership,
SEXP res;
int result;
R_igraph_i_levc_data_t *data=extra;
+ R_igraph_i_function_container_t cont = { arpack_multiplier };
PROTECT(s_memb=R_igraph_vector_to_SEXP(membership));
PROTECT(s_comm=NEW_NUMERIC(1)); REAL(s_comm)[0]=comm;
@@ -8033,8 +8039,7 @@ int R_igraph_i_levc_callback(const igraph_vector_t *membership,
PROTECT(s_evector=R_igraph_vector_to_SEXP(eigenvector));
PROTECT(R_multip_call =
lang3(install("igraph.i.levc.arp"),
- R_MakeExternalPtr((void*) arpack_multiplier, R_NilValue,
- R_NilValue),
+ R_MakeExternalPtr((void*) &cont, R_NilValue, R_NilValue),
R_MakeExternalPtr(arpack_extra, R_NilValue, R_NilValue)));
PROTECT(s_multip = eval(R_multip_call, data->rho2));
@@ -9321,62 +9326,6 @@ SEXP R_igraph_simple_interconnected_islands_game(SEXP islands_n, SEXP islands_si
return result;
}
-SEXP R_igraph_subclique_next(SEXP pgraph, SEXP pweights, SEXP pids,
- SEXP pcliques) {
- igraph_t graph;
- igraph_vector_t weights;
- igraph_vector_int_t ids;
- igraph_vector_ptr_t cliques;
- int nc=GET_LENGTH(pcliques);
- igraph_vector_ptr_t result, resultids, resultweights;
- igraph_vector_t clique_thr, next_thr;
- SEXP Rresult, Rnames;
-
- R_SEXP_to_igraph(pgraph, &graph);
- R_SEXP_to_vector(pweights, &weights);
- R_SEXP_to_vector_int(pids, &ids);
- R_igraph_SEXP_to_vectorlist(pcliques, &cliques);
-
- igraph_vector_ptr_init(&result, nc);
- IGRAPH_FINALLY(igraph_vector_ptr_destroy, &result);
- igraph_vector_ptr_init(&resultweights, nc);
- IGRAPH_FINALLY(igraph_vector_ptr_destroy, &resultweights);
- igraph_vector_ptr_init(&resultids, nc);
- IGRAPH_FINALLY(igraph_vector_ptr_destroy, &resultids);
- igraph_vector_init(&clique_thr, nc);
- IGRAPH_FINALLY(igraph_vector_destroy, &clique_thr);
- igraph_vector_init(&next_thr, nc);
- IGRAPH_FINALLY(igraph_vector_destroy, &next_thr);
-
- igraph_subclique_next(&graph, &weights, &ids, &cliques,
- &result, &resultweights, &resultids,
- &clique_thr, &next_thr);
-
- PROTECT(Rresult=NEW_LIST(5));
- SET_VECTOR_ELT(Rresult, 0, R_igraph_graphlist_to_SEXP(&result));
- R_igraph_graphlist_destroy(&result);
- SET_VECTOR_ELT(Rresult, 1, R_igraph_vectorlist_int_to_SEXP(&resultids));
- R_igraph_vectorlist_int_destroy2(&resultids);
- SET_VECTOR_ELT(Rresult, 2, R_igraph_vectorlist_to_SEXP(&resultweights));
- R_igraph_vectorlist2_destroy(&resultweights);
- SET_VECTOR_ELT(Rresult, 3, R_igraph_vector_to_SEXP(&clique_thr));
- igraph_vector_destroy(&clique_thr);
- SET_VECTOR_ELT(Rresult, 4, R_igraph_vector_to_SEXP(&next_thr));
- igraph_vector_destroy(&next_thr);
-
- PROTECT(Rnames=NEW_CHARACTER(5));
- SET_STRING_ELT(Rnames, 0, mkChar("graphs"));
- SET_STRING_ELT(Rnames, 1, mkChar("ids"));
- SET_STRING_ELT(Rnames, 2, mkChar("weights"));
- SET_STRING_ELT(Rnames, 3, mkChar("thr"));
- SET_STRING_ELT(Rnames, 4, mkChar("next_thr"));
- SET_NAMES(Rresult, Rnames);
-
- IGRAPH_FINALLY_CLEAN(5);
- UNPROTECT(2);
- return Rresult;
-}
-
SEXP R_igraph_version() {
const char *version;
SEXP result;
@@ -14706,6 +14655,7 @@ SEXP R_igraph_isomorphic_34(SEXP graph1, SEXP graph2) {
SEXP R_igraph_canonical_permutation(SEXP graph, SEXP sh) {
/* Declarations */
igraph_t c_graph;
+
igraph_vector_t c_labeling;
igraph_bliss_sh_t c_sh;
igraph_bliss_info_t c_info;
@@ -14721,7 +14671,7 @@ SEXP R_igraph_canonical_permutation(SEXP graph, SEXP sh) {
IGRAPH_FINALLY(igraph_vector_destroy, &c_labeling);
c_sh=REAL(sh)[0];
/* Call igraph */
- igraph_canonical_permutation(&c_graph, &c_labeling, c_sh, &c_info);
+ igraph_canonical_permutation(&c_graph, 0, &c_labeling, c_sh, &c_info);
/* Convert output */
PROTECT(result=NEW_LIST(2));
@@ -14773,15 +14723,16 @@ SEXP R_igraph_permute_vertices(SEXP graph, SEXP permutation) {
/*-------------------------------------------/
/ igraph_isomorphic_bliss /
/-------------------------------------------*/
-SEXP R_igraph_isomorphic_bliss(SEXP graph1, SEXP graph2, SEXP sh1, SEXP sh2) {
+SEXP R_igraph_isomorphic_bliss(SEXP graph1, SEXP graph2, SEXP sh) {
/* Declarations */
igraph_t c_graph1;
igraph_t c_graph2;
+
+
igraph_bool_t c_iso;
igraph_vector_t c_map12;
igraph_vector_t c_map21;
- igraph_bliss_sh_t c_sh1;
- igraph_bliss_sh_t c_sh2;
+ igraph_bliss_sh_t c_sh;
igraph_bliss_info_t c_info1;
igraph_bliss_info_t c_info2;
SEXP iso;
@@ -14804,10 +14755,9 @@ SEXP R_igraph_isomorphic_bliss(SEXP graph1, SEXP graph2, SEXP sh1, SEXP sh2) {
}
IGRAPH_FINALLY(igraph_vector_destroy, &c_map21);
map21=NEW_NUMERIC(0); /* hack to have a non-NULL value */
- c_sh1=REAL(sh1)[0];
- c_sh2=REAL(sh2)[0];
+ c_sh=REAL(sh)[0];
/* Call igraph */
- igraph_isomorphic_bliss(&c_graph1, &c_graph2, &c_iso, (isNull(map12) ? 0 : &c_map12), (isNull(map21) ? 0 : &c_map21), c_sh1, c_sh2, &c_info1, &c_info2);
+ igraph_isomorphic_bliss(&c_graph1, &c_graph2, 0, 0, &c_iso, (isNull(map12) ? 0 : &c_map12), (isNull(map21) ? 0 : &c_map21), c_sh, &c_info1, &c_info2);
/* Convert output */
PROTECT(result=NEW_LIST(5));
@@ -14847,6 +14797,7 @@ SEXP R_igraph_isomorphic_bliss(SEXP graph1, SEXP graph2, SEXP sh1, SEXP sh2) {
SEXP R_igraph_automorphisms(SEXP graph, SEXP sh) {
/* Declarations */
igraph_t c_graph;
+
igraph_bliss_sh_t c_sh;
igraph_bliss_info_t c_info;
SEXP info;
@@ -14856,7 +14807,7 @@ SEXP R_igraph_automorphisms(SEXP graph, SEXP sh) {
R_SEXP_to_igraph(graph, &c_graph);
c_sh=REAL(sh)[0];
/* Call igraph */
- igraph_automorphisms(&c_graph, c_sh, &c_info);
+ igraph_automorphisms(&c_graph, 0, c_sh, &c_info);
/* Convert output */
PROTECT(info=R_igraph_bliss_info_to_SEXP(&c_info));
diff --git a/src/rinterface_extra.c b/src/rinterface_extra.c
index 3d74a2b..15d3dd7 100644
--- a/src/rinterface_extra.c
+++ b/src/rinterface_extra.c
@@ -23,7 +23,6 @@
#include "igraph.h"
-#define USE_RINTERNALS
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
diff --git a/src/sbm.c b/src/sbm.c
index 385f2ef..36f67cc 100644
--- a/src/sbm.c
+++ b/src/sbm.c
@@ -119,14 +119,14 @@ int igraph_sbm_game(igraph_t *graph, igraph_integer_t n,
RNG_BEGIN();
for (from = 0; from < no_blocks; from++) {
- int fromsize = VECTOR(*block_sizes)[from];
+ double fromsize = VECTOR(*block_sizes)[from];
int start = directed ? 0 : from;
int i, tooff=0;
for (i=0; i<start; i++) {
tooff += VECTOR(*block_sizes)[i];
}
for (to = start; to < no_blocks; to++) {
- int tosize = VECTOR(*block_sizes)[to];
+ double tosize = VECTOR(*block_sizes)[to];
igraph_real_t prob=MATRIX(*pref_matrix, from, to);
double maxedges, last=RNG_GEOM(prob);
if (directed && loops) {
@@ -181,7 +181,7 @@ int igraph_sbm_game(igraph_t *graph, igraph_integer_t n,
last += 1;
}
} else if (!directed && !loops && from!=to) {
- maxedges = fromsize * tosize;
+ maxedges = fromsize * tosize;
while (last < maxedges) {
int vto=floor(last/fromsize);
int vfrom=last - (igraph_real_t)vto * fromsize;
diff --git a/src/scan.c b/src/scan.c
index dddda20..44af739 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -212,9 +212,11 @@ int igraph_i_local_scan_1_directed_all(const igraph_t *graph,
for (i=0; i<edgeslen1; i++) {
int e2=VECTOR(*edges1)[i];
int nei=IGRAPH_OTHER(graph, e2, node);
+ igraph_vector_int_t *edges2;
+ int j, edgeslen2;
if (VECTOR(neis)[nei] != node+1) { continue; }
- igraph_vector_int_t *edges2=igraph_inclist_get(&incs, nei);
- int j, edgeslen2=igraph_vector_int_size(edges2);
+ edges2=igraph_inclist_get(&incs, nei);
+ edgeslen2=igraph_vector_int_size(edges2);
for (j=0; j<edgeslen2; j++) {
int e2=VECTOR(*edges2)[j];
int nei2=IGRAPH_OTHER(graph, e2, nei);
diff --git a/src/second.f b/src/second.f
index 8018b55..37023c3 100644
--- a/src/second.f
+++ b/src/second.f
@@ -24,7 +24,7 @@
* ..
* .. Executable Statements ..
*
-
+ TARRAY( 1 ) = 0.0
T1 = ETIME( TARRAY )
T = TARRAY( 1 )
diff --git a/src/separators.c b/src/separators.c
index a7f76d6..e7482c0 100644
--- a/src/separators.c
+++ b/src/separators.c
@@ -47,7 +47,7 @@ int igraph_i_is_separator(const igraph_t *graph,
long int start=0;
if (IGRAPH_VIT_SIZE(*vit) >= no_of_nodes-1) {
- /* Just need to check that we really have n-1 vertices in it */
+ /* Just need to check that we really have at least n-1 vertices in it */
igraph_vector_bool_t hit;
long int nohit=0;
IGRAPH_CHECK(igraph_vector_bool_init(&hit, no_of_nodes));
@@ -63,8 +63,8 @@ int igraph_i_is_separator(const igraph_t *graph,
}
igraph_vector_bool_destroy(&hit);
IGRAPH_FINALLY_CLEAN(1);
- if (nohit == no_of_nodes-1) {
- *res = 1;
+ if (nohit >= no_of_nodes-1) {
+ *res = 0;
return 0;
}
}
diff --git a/src/simpleraytracer/RIgraphRay.cpp b/src/simpleraytracer/RIgraphRay.cpp
index cf5799c..5364f1a 100644
--- a/src/simpleraytracer/RIgraphRay.cpp
+++ b/src/simpleraytracer/RIgraphRay.cpp
@@ -29,7 +29,6 @@
#include "config.h"
-#define USE_RINTERNALS
#include <R.h>
#include <Rinternals.h>
#include <Rdefines.h>
diff --git a/src/sparsemat.c b/src/sparsemat.c
index c040900..974da22 100644
--- a/src/sparsemat.c
+++ b/src/sparsemat.c
@@ -2253,16 +2253,20 @@ int igraph_i_sparsemat_rowmins_triplet(const igraph_sparsemat_t *A,
int igraph_i_sparsemat_rowmins_cc(igraph_sparsemat_t *A,
igraph_vector_t *res) {
- int ne=A->cs->p[A->cs->n];
- double *px=A->cs->x;
- int *pi=A->cs->i;
+ int ne;
+ double *px;
+ int *pi;
double inf=IGRAPH_INFINITY;
IGRAPH_CHECK(igraph_sparsemat_dupl(A));
+ ne = A->cs->p[A->cs->n];
+ px = A->cs->x;
+ pi = A->cs->i;
+
IGRAPH_CHECK(igraph_vector_resize(res, A->cs->m));
igraph_vector_fill(res, inf);
-
+
for (; pi < A->cs->i+ne; pi++, px++) {
if (*px < VECTOR(*res)[ *pi ]) { VECTOR(*res)[ *pi ] = *px; }
}
@@ -2299,13 +2303,16 @@ int igraph_i_sparsemat_rowmaxs_triplet(const igraph_sparsemat_t *A,
int igraph_i_sparsemat_rowmaxs_cc(igraph_sparsemat_t *A,
igraph_vector_t *res) {
- int ne=A->cs->p[A->cs->n];
- double *px=A->cs->x;
- int *pi=A->cs->i;
+ int ne;
+ double *px;
+ int *pi;
double inf=IGRAPH_NEGINFINITY;
IGRAPH_CHECK(igraph_sparsemat_dupl(A));
+ ne = A->cs->p[A->cs->n];
+ px = A->cs->x;
+ pi = A->cs->i;
IGRAPH_CHECK(igraph_vector_resize(res, A->cs->m));
igraph_vector_fill(res, inf);
@@ -2345,15 +2352,20 @@ int igraph_i_sparsemat_colmins_triplet(const igraph_sparsemat_t *A,
int igraph_i_sparsemat_colmins_cc(igraph_sparsemat_t *A,
igraph_vector_t *res) {
- int n=A->cs->n;
- double *px=A->cs->x;
- int *pp=A->cs->p;
- int *pi=A->cs->i;
+ int n;
+ double *px;
+ int *pp;
+ int *pi;
double *pr;
double inf=IGRAPH_INFINITY;
IGRAPH_CHECK(igraph_sparsemat_dupl(A));
+ n = A->cs->n;
+ px = A->cs->x;
+ pp = A->cs->p;
+ pi = A->cs->i;
+
IGRAPH_CHECK(igraph_vector_resize(res, n));
igraph_vector_fill(res, inf);
pr=VECTOR(*res);
@@ -2394,15 +2406,20 @@ int igraph_i_sparsemat_colmaxs_triplet(const igraph_sparsemat_t *A,
int igraph_i_sparsemat_colmaxs_cc(igraph_sparsemat_t *A,
igraph_vector_t *res) {
- int n=A->cs->n;
- double *px=A->cs->x;
- int *pp=A->cs->p;
- int *pi=A->cs->i;
+ int n;
+ double *px;
+ int *pp;
+ int *pi;
double *pr;
double inf=IGRAPH_NEGINFINITY;
IGRAPH_CHECK(igraph_sparsemat_dupl(A));
+ n = A->cs->n;
+ px = A->cs->x;
+ pp = A->cs->p;
+ pi = A->cs->i;
+
IGRAPH_CHECK(igraph_vector_resize(res, n));
igraph_vector_fill(res, inf);
pr=VECTOR(*res);
@@ -2451,15 +2468,20 @@ int igraph_i_sparsemat_which_min_rows_triplet(igraph_sparsemat_t *A,
int igraph_i_sparsemat_which_min_rows_cc(igraph_sparsemat_t *A,
igraph_vector_t *res,
igraph_vector_int_t *pos) {
- int n=A->cs->n;
- double *px = A->cs->x;
- int *pp=A->cs->p;
- int *pi = A->cs->i;
+ int n;
+ double *px;
+ int *pp;
+ int *pi;
double inf = IGRAPH_INFINITY;
int j;
IGRAPH_CHECK(igraph_sparsemat_dupl(A));
+ n = A->cs->n;
+ px = A->cs->x;
+ pp = A->cs->p;
+ pi = A->cs->i;
+
IGRAPH_CHECK(igraph_vector_resize(res, A->cs->m));
IGRAPH_CHECK(igraph_vector_int_resize(pos, A->cs->m));
igraph_vector_fill(res, inf);
@@ -2515,14 +2537,17 @@ int igraph_i_sparsemat_which_min_cols_triplet(igraph_sparsemat_t *A,
int igraph_i_sparsemat_which_min_cols_cc(igraph_sparsemat_t *A,
igraph_vector_t *res,
igraph_vector_int_t *pos) {
- int n=A->cs->n, j, p;
- double *px=A->cs->x;
+ int n, j, p;
+ double *px;
double *pr;
int *ppos;
double inf=IGRAPH_INFINITY;
IGRAPH_CHECK(igraph_sparsemat_dupl(A));
+ n = A->cs->n;
+ px = A->cs->x;
+
IGRAPH_CHECK(igraph_vector_resize(res, n));
igraph_vector_fill(res, inf);
pr=VECTOR(*res);
diff --git a/src/structural_properties.c b/src/structural_properties.c
index 2bac756..c599c5f 100644
--- a/src/structural_properties.c
+++ b/src/structural_properties.c
@@ -43,6 +43,7 @@
#include "igraph_topology.h"
#include "igraph_qsort.h"
#include "config.h"
+#include "structural_properties_internal.h"
#include <assert.h>
#include <string.h>
@@ -197,19 +198,18 @@ int igraph_diameter(const igraph_t *graph, igraph_integer_t *pres,
/**
* \ingroup structural
* \function igraph_average_path_length
- * \brief Calculates the average geodesic length in a graph.
+ * \brief Calculates the average shortest path length between all vertex pairs.
*
* \param graph The graph object.
* \param res Pointer to a real number, this will contain the result.
* \param directed Boolean, whether to consider directed
* paths. Ignored for undirected graphs.
* \param unconn What to do if the graph is not connected. If
- * \c TRUE the average of the geodesics
- * within the components
- * will be returned, otherwise the number of vertices is
- * used for the length of non-existing geodesics. (The rationale
- * behind this is that this is always longer than the longest
- * possible geodesic in a graph.)
+ * \c TRUE, only those vertex pairs will be included in the calculation
+ * between which there is a path. If \c FALSE, the number of vertices is
+ * used as the distance between vertices unreachable from each other.
+ * The rationale behind this is that this is always longer than the longest
+ * possible geodesic in a graph.
* \return Error code:
* \c IGRAPH_ENOMEM, not enough memory for
* data structures
@@ -1499,69 +1499,40 @@ int igraph_pagerank_old(const igraph_t *graph, igraph_vector_t *res,
return 0;
}
-/**
- * \ingroup structural
- * \function igraph_rewire
- * \brief Randomly rewires a graph while preserving the degree distribution.
- *
- * </para><para>
- * This function generates a new graph based on the original one by randomly
- * rewiring edges while preserving the original graph's degree distribution.
- * Please note that the rewiring is done "in place", so no new graph will
- * be allocated. If you would like to keep the original graph intact, use
- * \ref igraph_copy() beforehand.
- *
- * \param graph The graph object to be rewired.
- * \param n Number of rewiring trials to perform.
- * \param mode The rewiring algorithm to be used. It can be one of the following:
- * \clist
- * \cli IGRAPH_REWIRING_SIMPLE
- * Simple rewiring algorithm which chooses two arbitrary edges
- * in each step (namely (a,b) and (c,d)) and substitutes them
- * with (a,d) and (c,b) if they don't exist. The method will
- * neither destroy nor create self-loops.
- * \cli IGRAPH_REWIRING_SIMPLE_LOOPS
- * Same as \c IGRAPH_REWIRING_SIMPLE but allows the creation or
- * destruction of self-loops.
- * \endclist
- *
- * \return Error code:
- * \clist
- * \cli IGRAPH_EINVMODE
- * Invalid rewiring mode.
- * \cli IGRAPH_EINVAL
- * Graph unsuitable for rewiring (e.g. it has
- * less than 4 nodes in case of \c IGRAPH_REWIRING_SIMPLE)
- * \cli IGRAPH_ENOMEM
- * Not enough memory for temporary data.
- * \endclist
- *
- * Time complexity: TODO.
- *
- * \example examples/simple/igraph_rewire.c
- */
-
-int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode) {
+// Not declared static so that the testsuite can use it, but not part of the public API.
+int igraph_rewire_core(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode, igraph_bool_t use_adjlist) {
long int no_of_nodes=igraph_vcount(graph);
long int no_of_edges=igraph_ecount(graph);
char message[256];
igraph_integer_t a, b, c, d, dummy, num_swaps, num_successful_swaps;
- igraph_vector_t eids, edgevec;
+ igraph_vector_t eids, edgevec, alledges;
igraph_bool_t directed, loops, ok;
igraph_es_t es;
+ igraph_adjlist_t al;
- if ((mode == IGRAPH_REWIRING_SIMPLE || mode == IGRAPH_REWIRING_SIMPLE_LOOPS) &&
- no_of_nodes<4)
+ if (no_of_nodes<4)
IGRAPH_ERROR("graph unsuitable for rewiring", IGRAPH_EINVAL);
directed = igraph_is_directed(graph);
- loops = (mode == IGRAPH_REWIRING_SIMPLE_LOOPS);
+ loops = (mode & IGRAPH_REWIRING_SIMPLE_LOOPS);
RNG_BEGIN();
- IGRAPH_VECTOR_INIT_FINALLY(&edgevec, 4);
IGRAPH_VECTOR_INIT_FINALLY(&eids, 2);
- es = igraph_ess_vector(&eids);
+
+ if(use_adjlist) {
+ /* As well as the sorted adjacency list, we maintain an unordered
+ * list of edges for picking a random edge in constant time.
+ */
+ IGRAPH_CHECK(igraph_adjlist_init(graph, &al, IGRAPH_OUT));
+ IGRAPH_FINALLY(igraph_adjlist_destroy, &al);
+ IGRAPH_VECTOR_INIT_FINALLY(&alledges, no_of_edges * 2);
+ igraph_get_edgelist(graph, &alledges, /*bycol=*/ 0);
+ }
+ else {
+ IGRAPH_VECTOR_INIT_FINALLY(&edgevec, 4);
+ es = igraph_ess_vector(&eids);
+ }
/* We don't want the algorithm to get stuck in an infinite loop when
* it can't choose two edges satisfying the conditions. Instead of
@@ -1593,16 +1564,30 @@ int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode) {
} while (VECTOR(eids)[0] == VECTOR(eids)[1]);
/* Get the endpoints */
- IGRAPH_CHECK(igraph_edge(graph, (igraph_integer_t) VECTOR(eids)[0],
- &a, &b));
- IGRAPH_CHECK(igraph_edge(graph, (igraph_integer_t) VECTOR(eids)[1],
- &c, &d));
+ if(use_adjlist) {
+ a = VECTOR(alledges)[((igraph_integer_t)VECTOR(eids)[0]) * 2];
+ b = VECTOR(alledges)[(((igraph_integer_t)VECTOR(eids)[0]) * 2) + 1];
+ c = VECTOR(alledges)[((igraph_integer_t)VECTOR(eids)[1]) * 2];
+ d = VECTOR(alledges)[(((igraph_integer_t)VECTOR(eids)[1]) * 2) + 1];
+ }
+ else {
+ IGRAPH_CHECK(igraph_edge(graph, (igraph_integer_t) VECTOR(eids)[0],
+ &a, &b));
+ IGRAPH_CHECK(igraph_edge(graph, (igraph_integer_t) VECTOR(eids)[1],
+ &c, &d));
+ }
/* For an undirected graph, we have two "variants" of each edge, i.e.
* a -- b and b -- a. Since some rewirings can be performed only when we
* "swap" the endpoints, we do it now with probability 0.5 */
if (!directed && RNG_UNIF01() < 0.5) {
dummy = c; c = d; d = dummy;
+ if(use_adjlist) {
+ /* Flip the edge in the unordered edge-list, so the update later on
+ * hits the correct end. */
+ VECTOR(alledges)[((igraph_integer_t)VECTOR(eids)[1]) * 2] = c;
+ VECTOR(alledges)[(((igraph_integer_t)VECTOR(eids)[1]) * 2) + 1] = d;
+ }
}
/* If we do not touch loops, check whether a == b or c == d and disallow
@@ -1628,24 +1613,46 @@ int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode) {
/* All good so far. Now check for the existence of a --> d and c --> b to
* disallow the creation of multiple edges */
if (ok) {
- IGRAPH_CHECK(igraph_are_connected(graph, a, d, &ok));
- ok = !ok;
+ if(use_adjlist) {
+ if(igraph_adjlist_has_edge(&al, a, d, directed))
+ ok = 0;
+ }
+ else {
+ IGRAPH_CHECK(igraph_are_connected(graph, a, d, &ok));
+ ok = !ok;
+ }
}
if (ok) {
- IGRAPH_CHECK(igraph_are_connected(graph, c, b, &ok));
- ok = !ok;
+ if(use_adjlist) {
+ if(igraph_adjlist_has_edge(&al, c, b, directed))
+ ok = 0;
+ }
+ else {
+ IGRAPH_CHECK(igraph_are_connected(graph, c, b, &ok));
+ ok = !ok;
+ }
}
/* If we are still okay, we can perform the rewiring */
if (ok) {
/* printf("Deleting: %ld -> %ld, %ld -> %ld\n",
(long)a, (long)b, (long)c, (long)d); */
- IGRAPH_CHECK(igraph_delete_edges(graph, es));
- VECTOR(edgevec)[0]=a; VECTOR(edgevec)[1]=d;
- VECTOR(edgevec)[2]=c; VECTOR(edgevec)[3]=b;
- /* printf("Adding: %ld -> %ld, %ld -> %ld\n",
+ if(use_adjlist) {
+ // Replace entry in sorted adjlist:
+ IGRAPH_CHECK(igraph_adjlist_replace_edge(&al, a, b, d, directed));
+ IGRAPH_CHECK(igraph_adjlist_replace_edge(&al, c, d, b, directed));
+ // Also replace in unsorted edgelist:
+ VECTOR(alledges)[(((igraph_integer_t)VECTOR(eids)[0]) * 2) + 1] = d;
+ VECTOR(alledges)[(((igraph_integer_t)VECTOR(eids)[1]) * 2) + 1] = b;
+ }
+ else {
+ IGRAPH_CHECK(igraph_delete_edges(graph, es));
+ VECTOR(edgevec)[0]=a; VECTOR(edgevec)[1]=d;
+ VECTOR(edgevec)[2]=c; VECTOR(edgevec)[3]=b;
+ /* printf("Adding: %ld -> %ld, %ld -> %ld\n",
(long)a, (long)d, (long)c, (long)b); */
- igraph_add_edges(graph, &edgevec, 0);
+ igraph_add_edges(graph, &edgevec, 0);
+ }
num_successful_swaps++;
}
break;
@@ -1655,28 +1662,81 @@ int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode) {
}
num_swaps++;
}
+
+ if(use_adjlist) {
+ /* Replace graph edges with the adjlist current state */
+ IGRAPH_CHECK(igraph_delete_edges(graph, igraph_ess_all(IGRAPH_EDGEORDER_ID)));
+ IGRAPH_CHECK(igraph_add_edges(graph, &alledges, 0));
+ }
IGRAPH_PROGRESS("Random rewiring: ", 100.0, 0);
+ if(use_adjlist) {
+ igraph_vector_destroy(&alledges);
+ igraph_adjlist_destroy(&al);
+ }
+ else {
+ igraph_vector_destroy(&edgevec);
+ }
+
igraph_vector_destroy(&eids);
- igraph_vector_destroy(&edgevec);
- IGRAPH_FINALLY_CLEAN(2);
+ IGRAPH_FINALLY_CLEAN(use_adjlist ? 3 : 2);
RNG_END();
return 0;
}
-int igraph_i_subgraph_copy_and_delete(const igraph_t *graph, igraph_t *res,
- const igraph_vs_t vids,
- igraph_vector_t *map,
- igraph_vector_t *invmap);
+/**
+ * \ingroup structural
+ * \function igraph_rewire
+ * \brief Randomly rewires a graph while preserving the degree distribution.
+ *
+ * </para><para>
+ * This function generates a new graph based on the original one by randomly
+ * rewiring edges while preserving the original graph's degree distribution.
+ * Please note that the rewiring is done "in place", so no new graph will
+ * be allocated. If you would like to keep the original graph intact, use
+ * \ref igraph_copy() beforehand.
+ *
+ * \param graph The graph object to be rewired.
+ * \param n Number of rewiring trials to perform.
+ * \param mode The rewiring algorithm to be used. It can be one of the following flags:
+ * \clist
+ * \cli IGRAPH_REWIRING_SIMPLE
+ * Simple rewiring algorithm which chooses two arbitrary edges
+ * in each step (namely (a,b) and (c,d)) and substitutes them
+ * with (a,d) and (c,b) if they don't exist. The method will
+ * neither destroy nor create self-loops.
+ * \cli IGRAPH_REWIRING_SIMPLE_LOOPS
+ * Same as \c IGRAPH_REWIRING_SIMPLE but allows the creation or
+ * destruction of self-loops.
+ * \endclist
+ *
+ * \return Error code:
+ * \clist
+ * \cli IGRAPH_EINVMODE
+ * Invalid rewiring mode.
+ * \cli IGRAPH_EINVAL
+ * Graph unsuitable for rewiring (e.g. it has
+ * less than 4 nodes in case of \c IGRAPH_REWIRING_SIMPLE)
+ * \cli IGRAPH_ENOMEM
+ * Not enough memory for temporary data.
+ * \endclist
+ *
+ * Time complexity: TODO.
+ *
+ * \example examples/simple/igraph_rewire.c
+ */
-int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
- igraph_t *res,
- const igraph_vs_t vids,
- igraph_vector_t *map,
- igraph_vector_t *invmap);
+#define REWIRE_ADJLIST_THRESHOLD 10
+
+int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode) {
+
+ igraph_bool_t use_adjlist = n >= REWIRE_ADJLIST_THRESHOLD;
+ return igraph_rewire_core(graph, n, mode, use_adjlist);
+
+}
/**
* Subgraph creation, old version: it copies the graph and then deletes
@@ -1744,8 +1804,9 @@ int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
igraph_bool_t directed = igraph_is_directed(graph);
long int no_of_nodes = igraph_vcount(graph);
long int no_of_new_nodes = 0;
- char* seen_edges = 0;
long int i, j, n;
+ long int to;
+ igraph_integer_t eid;
igraph_vector_t vids_old2new, vids_new2old;
igraph_vector_t eids_new2old;
igraph_vector_t nei_edges;
@@ -1758,7 +1819,7 @@ int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
* opposite order */
IGRAPH_VECTOR_INIT_FINALLY(&eids_new2old, 0);
if (invmap) {
- my_vids_new2old=invmap;
+ my_vids_new2old = invmap;
igraph_vector_clear(my_vids_new2old);
} else {
IGRAPH_VECTOR_INIT_FINALLY(&vids_new2old, 0);
@@ -1766,7 +1827,7 @@ int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
IGRAPH_VECTOR_INIT_FINALLY(&new_edges, 0);
IGRAPH_VECTOR_INIT_FINALLY(&nei_edges, 0);
if (map) {
- my_vids_old2new=map;
+ my_vids_old2new = map;
IGRAPH_CHECK(igraph_vector_resize(map, no_of_nodes));
igraph_vector_null(map);
} else {
@@ -1793,65 +1854,42 @@ int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
for (i = 0; i < n; i++) {
long int vid = (long int) VECTOR(nei_edges)[i];
if (VECTOR(*my_vids_old2new)[vid] == 0) {
- VECTOR(*my_vids_old2new)[vid] = ++no_of_new_nodes;
+ IGRAPH_CHECK(igraph_vector_push_back(my_vids_new2old, vid));
+ no_of_new_nodes++;
+ VECTOR(*my_vids_old2new)[vid] = no_of_new_nodes;
}
}
- /* Allocate some memory for the seen_edges array that avoids processing edges
- * twice for undirected graphs */
- if (!directed) {
- seen_edges = igraph_Calloc(igraph_ecount(graph), char);
- if (seen_edges == 0)
- IGRAPH_ERROR("cannot calculate subgraph", IGRAPH_ENOMEM);
- IGRAPH_FINALLY(igraph_free, seen_edges);
- }
+ /* Create the new edge list */
+ for (i = 0; i < no_of_new_nodes; i++) {
+ long int old_vid = (long int) VECTOR(*my_vids_new2old)[i];
+ long int new_vid = i;
- /* Calculate the mapping from the new node IDs to the new ones
- * and also create the new edge list */
- IGRAPH_CHECK(igraph_vector_resize(my_vids_new2old, no_of_new_nodes));
- for (i = 0; i < no_of_nodes; i++) {
- long int new_vid = (long int) VECTOR(*my_vids_old2new)[i] - 1;
- if (new_vid < 0)
- continue;
-
- VECTOR(*my_vids_new2old)[new_vid] = i;
-
- IGRAPH_CHECK(igraph_incident(graph, &nei_edges, (igraph_integer_t) i,
- IGRAPH_OUT));
+ IGRAPH_CHECK(igraph_incident(graph, &nei_edges, old_vid, IGRAPH_OUT));
n = igraph_vector_size(&nei_edges);
if (directed) {
for (j = 0; j < n; j++) {
- igraph_integer_t eid = (igraph_integer_t) VECTOR(nei_edges)[j];
- long int from, to;
-
- from = (long int) VECTOR(*my_vids_old2new)[
- (long int)IGRAPH_FROM(graph, eid) ];
- if (!from) continue;
- to = (long int) VECTOR(*my_vids_old2new)[
- (long int)IGRAPH_TO(graph, eid)];
+ eid = (igraph_integer_t) VECTOR(nei_edges)[j];
+
+ to = (long int) VECTOR(*my_vids_old2new)[ (long int)IGRAPH_TO(graph, eid) ];
if (!to) continue;
- IGRAPH_CHECK(igraph_vector_push_back(&new_edges, from-1));
+ IGRAPH_CHECK(igraph_vector_push_back(&new_edges, new_vid));
IGRAPH_CHECK(igraph_vector_push_back(&new_edges, to-1));
IGRAPH_CHECK(igraph_vector_push_back(&eids_new2old, eid));
}
} else {
for (j = 0; j < n; j++) {
- igraph_integer_t eid = (igraph_integer_t) VECTOR(nei_edges)[j];
- long int from, to;
-
- from = (long int) VECTOR(*my_vids_old2new)[
- (long int)IGRAPH_FROM(graph, eid)];
- if (!from) continue;
- to = (long int) VECTOR(*my_vids_old2new)[
- (long int)IGRAPH_TO(graph, eid)];
- if (!to) continue;
- if (seen_edges[(long int)eid])
+ eid = (igraph_integer_t) VECTOR(nei_edges)[j];
+
+ if (IGRAPH_FROM(graph, eid) != old_vid) /* avoid processing edges twice */
continue;
- seen_edges[(long int)eid] = 1;
- IGRAPH_CHECK(igraph_vector_push_back(&new_edges, from-1));
+ to = (long int) VECTOR(*my_vids_old2new)[ (long int)IGRAPH_TO(graph, eid) ];
+ if (!to) continue;
+
+ IGRAPH_CHECK(igraph_vector_push_back(&new_edges, new_vid));
IGRAPH_CHECK(igraph_vector_push_back(&new_edges, to-1));
IGRAPH_CHECK(igraph_vector_push_back(&eids_new2old, eid));
}
@@ -1859,10 +1897,6 @@ int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
}
/* Get rid of some vectors that are not needed anymore */
- if (!directed) {
- igraph_free(seen_edges);
- IGRAPH_FINALLY_CLEAN(1);
- }
if (!map) {
igraph_vector_destroy(&vids_old2new);
IGRAPH_FINALLY_CLEAN(1);
@@ -1996,6 +2030,26 @@ int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res,
/* invmap= */ 0);
}
+igraph_subgraph_implementation_t igraph_i_induced_subgraph_suggest_implementation(
+ const igraph_t *graph, const igraph_vs_t vids) {
+ double ratio;
+ igraph_integer_t num_vs;
+
+ if (igraph_vs_is_all(&vids)) {
+ ratio = 1.0;
+ } else {
+ IGRAPH_CHECK(igraph_vs_size(graph, &vids, &num_vs));
+ ratio = (igraph_real_t) num_vs / igraph_vcount(graph);
+ }
+
+ /* TODO: needs benchmarking; threshold was chosen totally arbitrarily */
+ if (ratio > 0.5) {
+ return IGRAPH_SUBGRAPH_COPY_AND_DELETE;
+ } else {
+ return IGRAPH_SUBGRAPH_CREATE_FROM_SCRATCH;
+ }
+}
+
int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res,
const igraph_vs_t vids,
igraph_subgraph_implementation_t impl,
@@ -2003,20 +2057,7 @@ int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res,
igraph_vector_t *invmap) {
if (impl == IGRAPH_SUBGRAPH_AUTO) {
- double ratio;
-
- if (igraph_vs_is_all(&vids))
- ratio = 1.0;
- else {
- igraph_integer_t num_vs;
- IGRAPH_CHECK(igraph_vs_size(graph, &vids, &num_vs));
- ratio = (igraph_real_t) num_vs / igraph_vcount(graph);
- }
-
- if (ratio > 0.5)
- impl = IGRAPH_SUBGRAPH_COPY_AND_DELETE;
- else
- impl = IGRAPH_SUBGRAPH_CREATE_FROM_SCRATCH;
+ impl = igraph_i_induced_subgraph_suggest_implementation(graph, vids);
}
switch (impl) {
@@ -3433,6 +3474,37 @@ int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res) {
}
/**
+ * \function igraph_has_loop
+ * \brief Returns whether the graph has at least one loop edge.
+ *
+ * </para><para>
+ * A loop edge is an edge from a vertex to itself.
+ * \param graph The input graph.
+ * \param res Pointer to an initialized boolean vector for storing the result.
+ *
+ * \sa \ref igraph_simplify() to get rid of loop edges.
+ *
+ * Time complexity: O(e), the number of edges to check.
+ *
+ * \example examples/simple/igraph_has_loop.c
+ */
+
+int igraph_has_loop(const igraph_t *graph, igraph_bool_t *res) {
+ long int i, m = igraph_ecount(graph);
+
+ *res = 0;
+
+ for (i = 0; i < m; i++) {
+ if (IGRAPH_FROM(graph, i) == IGRAPH_TO(graph, i)) {
+ *res = 1;
+ break;
+ }
+ }
+
+ return 0;
+}
+
+/**
* \function igraph_is_loop
* \brief Find the loop edges in a graph.
*
@@ -4553,6 +4625,7 @@ int igraph_get_shortest_paths_dijkstra(const igraph_t *graph,
if (vertices || edges) {
for (IGRAPH_VIT_RESET(vit), i=0; !IGRAPH_VIT_END(vit); IGRAPH_VIT_NEXT(vit), i++) {
long int node=IGRAPH_VIT_GET(vit);
+ long int size, act, edge;
igraph_vector_t *vvec=0, *evec=0;
if (vertices) {
vvec=VECTOR(*vertices)[i];
@@ -4565,30 +4638,27 @@ int igraph_get_shortest_paths_dijkstra(const igraph_t *graph,
IGRAPH_ALLOW_INTERRUPTION();
- if (parents[node]>0) {
- long int size=0;
- long int act=node;
- long int edge;
- while (parents[act]) {
- size++;
- edge=parents[act]-1;
- act=IGRAPH_OTHER(graph, edge, act);
- }
- if (vvec) {
- IGRAPH_CHECK(igraph_vector_resize(vvec, size+1));
- VECTOR(*vvec)[size]=node;
- }
- if (evec) {
- IGRAPH_CHECK(igraph_vector_resize(evec, size));
- }
- act=node;
- while (parents[act]) {
- edge=parents[act]-1;
- act=IGRAPH_OTHER(graph, edge, act);
- size--;
- if (vvec) { VECTOR(*vvec)[size]=act; }
- if (evec) { VECTOR(*evec)[size]=edge; }
- }
+ size=0;
+ act=node;
+ while (parents[act]) {
+ size++;
+ edge=parents[act]-1;
+ act=IGRAPH_OTHER(graph, edge, act);
+ }
+ if (vvec) {
+ IGRAPH_CHECK(igraph_vector_resize(vvec, size+1));
+ VECTOR(*vvec)[size]=node;
+ }
+ if (evec) {
+ IGRAPH_CHECK(igraph_vector_resize(evec, size));
+ }
+ act=node;
+ while (parents[act]) {
+ edge=parents[act]-1;
+ act=IGRAPH_OTHER(graph, edge, act);
+ size--;
+ if (vvec) { VECTOR(*vvec)[size]=act; }
+ if (evec) { VECTOR(*evec)[size]=edge; }
}
}
}
@@ -6019,14 +6089,27 @@ int igraph_diameter_dijkstra(const igraph_t *graph,
igraph_bool_t directed,
igraph_bool_t unconn) {
+ /* Implementation details. This is the basic Dijkstra algorithm,
+ with a binary heap. The heap is indexed, i.e. it stores not only
+ the distances, but also which vertex they belong to.
+
+ From now on we use a 2-way heap, so the distances can be queried
+ directly from the heap.
+
+ Dirty tricks:
+ - the opposite of the distance is stored in the heap, as it is a
+ maximum heap and we need a minimum heap.
+ - we don't use IGRAPH_INFINITY during the computation, as IGRAPH_FINITE()
+ might involve a function call and we want to spare that. -1 will denote
+ infinity instead.
+ */
+
long int no_of_nodes=igraph_vcount(graph);
long int no_of_edges=igraph_ecount(graph);
- igraph_vector_t dist;
- igraph_indheap_t Q;
+ igraph_2wheap_t Q;
igraph_inclist_t inclist;
- igraph_vector_long_t already_added;
- long int source;
+ long int source, j;
igraph_neimode_t dirmode = directed ? IGRAPH_OUT : IGRAPH_ALL;
long int from=-1, to=-1;
@@ -6036,7 +6119,9 @@ int igraph_diameter_dijkstra(const igraph_t *graph,
if (!weights) {
igraph_integer_t diameter;
IGRAPH_CHECK(igraph_diameter(graph, &diameter, pfrom, pto, path, directed, unconn));
- *pres = diameter;
+ if (pres) {
+ *pres = diameter;
+ }
return IGRAPH_SUCCESS;
}
@@ -6048,11 +6133,8 @@ int igraph_diameter_dijkstra(const igraph_t *graph,
IGRAPH_ERROR("Weight vector must be non-negative", IGRAPH_EINVAL);
}
- IGRAPH_CHECK(igraph_vector_long_init(&already_added, no_of_nodes));
- IGRAPH_FINALLY(igraph_vector_long_destroy, &already_added);
- IGRAPH_VECTOR_INIT_FINALLY(&dist, no_of_nodes);
- IGRAPH_CHECK(igraph_indheap_init(&Q, no_of_nodes));
- IGRAPH_FINALLY(igraph_indheap_destroy, &Q);
+ IGRAPH_CHECK(igraph_2wheap_init(&Q, no_of_nodes));
+ IGRAPH_FINALLY(igraph_2wheap_destroy, &Q);
IGRAPH_CHECK(igraph_inclist_init(graph, &inclist, dirmode));
IGRAPH_FINALLY(igraph_inclist_destroy, &inclist);
@@ -6061,44 +6143,43 @@ int igraph_diameter_dijkstra(const igraph_t *graph,
IGRAPH_PROGRESS("Weighted diameter: ", source*100.0/no_of_nodes, NULL);
IGRAPH_ALLOW_INTERRUPTION();
- igraph_indheap_push_with_index(&Q, source, -0);
- VECTOR(already_added)[source] = source+1;
- VECTOR(dist)[source] = 1.0;
+ igraph_2wheap_clear(&Q);
+ igraph_2wheap_push_with_index(&Q, source, -1.0);
+
nodes_reached = 0.0;
- while (!igraph_indheap_empty(&Q)) {
- long int minnei=igraph_indheap_max_index(&Q);
- igraph_real_t mindist=-igraph_indheap_delete_max(&Q);
+ while (!igraph_2wheap_empty(&Q)) {
+ long int minnei=igraph_2wheap_max_index(&Q);
+ igraph_real_t mindist=-igraph_2wheap_deactivate_max(&Q);
igraph_vector_int_t *neis;
- long int nlen, j;
+ long int nlen;
if (mindist > res) {
res=mindist; from=source; to=minnei;
}
nodes_reached++;
+ /* Now check all neighbors of 'minnei' for a shorter path */
neis=igraph_inclist_get(&inclist, minnei);
nlen=igraph_vector_int_size(neis);
for (j=0; j<nlen; j++) {
long int edge=(long int) VECTOR(*neis)[j];
long int tto=IGRAPH_OTHER(graph, edge, minnei);
- igraph_real_t altdist=mindist + VECTOR(*weights)[edge];
- igraph_real_t curdist= (VECTOR(already_added)[tto]==source+1) ?
- VECTOR(dist)[tto] : 0;
+ igraph_real_t altdist = mindist + VECTOR(*weights)[edge];
+ igraph_bool_t active = igraph_2wheap_has_active(&Q, tto);
+ igraph_bool_t has = igraph_2wheap_has_elem(&Q, tto);
+ igraph_real_t curdist = active ? -igraph_2wheap_get(&Q, tto) : 0.0;
- if (curdist==0) {
- /* First non-finite distance */
- VECTOR(already_added)[tto] = source+1;
- VECTOR(dist)[tto] = altdist+1.0;
- IGRAPH_CHECK(igraph_indheap_push_with_index(&Q, tto, -altdist));
- } else if (altdist < curdist-1) {
+ if (!has) {
+ /* First finite distance */
+ IGRAPH_CHECK(igraph_2wheap_push_with_index(&Q, tto, -altdist));
+ } else if (altdist < curdist) {
/* A shorter path */
- VECTOR(dist)[tto] = altdist+1.0;
- IGRAPH_CHECK(igraph_indheap_modify(&Q, tto, -altdist));
+ IGRAPH_CHECK(igraph_2wheap_modify(&Q, tto, -altdist));
}
}
- } /* !igraph_indheap_empty(&Q) */
+ } /* !igraph_2wheap_empty(&Q) */
/* not connected, return infinity */
if (nodes_reached != no_of_nodes && !unconn) {
@@ -6108,12 +6189,13 @@ int igraph_diameter_dijkstra(const igraph_t *graph,
}
} /* source < no_of_nodes */
-
+
+ /* Compensate for the +1 that we have added to distances */
+ res -= 1;
+
igraph_inclist_destroy(&inclist);
- igraph_indheap_destroy(&Q);
- igraph_vector_destroy(&dist);
- igraph_vector_long_destroy(&already_added);
- IGRAPH_FINALLY_CLEAN(4);
+ igraph_2wheap_destroy(&Q);
+ IGRAPH_FINALLY_CLEAN(2);
IGRAPH_PROGRESS("Weighted diameter: ", 100.0, NULL);
@@ -6752,8 +6834,12 @@ int igraph_i_is_graphical_degree_sequence_directed(
/* Is the degree larger than the number of vertices with nonzero in-degree?
* (Make sure that u is excluded from the vertices with nonzero in-degree).
*/
- if (degree > nonzero_indegree_count - (VECTOR(work_in)[u] > 0 ? 1 : 0))
+ if (degree > nonzero_indegree_count - (VECTOR(work_in)[u] > 0 ? 1 : 0)) {
+ /* Put u back into the queue to detect the failure even if u was the
+ * last vertex. See Github bug #851 */
+ IGRAPH_CHECK(igraph_vector_long_push_back(&out_vertices, u));
break;
+ }
/* Find the prefix of index_array that consists solely of vertices with
* zero indegree. We don't need to sort these */
diff --git a/src/include/igraph_qsort.h b/src/structural_properties_internal.h
similarity index 51%
copy from src/include/igraph_qsort.h
copy to src/structural_properties_internal.h
index bb347da..1d9d652 100644
--- a/src/include/igraph_qsort.h
+++ b/src/structural_properties_internal.h
@@ -1,8 +1,8 @@
/* -*- mode: C -*- */
/*
IGraph library.
- Copyright (C) 2011-2012 Gabor Csardi <csardi.gabor at gmail.com>
- 334 Harvard st, Cambridge, MA 02139, USA
+ Copyright (C) 2011-2016 Gabor Csardi <csardi.gabor at gmail.com>
+ 334 Harvard st, Cambridge, MA, 02138 USA
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,26 +21,24 @@
*/
-#ifndef IGRAPH_QSORT_H
-#define IGRAPH_QSORT_H
+#ifndef STRUCTURAL_PROPERTIES_INTERNAL_H
+#define STRUCTURAL_PROPERTIES_INTERNAL_H
-#undef __BEGIN_DECLS
-#undef __END_DECLS
-#ifdef __cplusplus
-# define __BEGIN_DECLS extern "C" {
-# define __END_DECLS }
-#else
-# define __BEGIN_DECLS /* empty */
-# define __END_DECLS /* empty */
-#endif
+#include "igraph_constants.h"
+#include "igraph_types.h"
-__BEGIN_DECLS
+igraph_subgraph_implementation_t igraph_i_induced_subgraph_suggest_implementation(
+ const igraph_t *graph, const igraph_vs_t vids);
-void igraph_qsort(void *base, size_t nel, size_t width,
- int (*compar)(const void *, const void *));
-void igraph_qsort_r(void *base, size_t nel, size_t width, void *thunk,
- int (*compar)(void *, const void *, const void *));
+int igraph_i_subgraph_copy_and_delete(const igraph_t *graph, igraph_t *res,
+ const igraph_vs_t vids,
+ igraph_vector_t *map,
+ igraph_vector_t *invmap);
-__END_DECLS
+int igraph_i_subgraph_create_from_scratch(const igraph_t *graph,
+ igraph_t *res,
+ const igraph_vs_t vids,
+ igraph_vector_t *map,
+ igraph_vector_t *invmap);
#endif
diff --git a/src/structure_generators.c b/src/structure_generators.c
index 97dcd88..ae424e0 100644
--- a/src/structure_generators.c
+++ b/src/structure_generators.c
@@ -22,6 +22,7 @@
*/
#include "igraph_constructors.h"
+#include "igraph_structural.h"
#include "igraph_memory.h"
#include "igraph_interface.h"
#include "igraph_attributes.h"
@@ -955,7 +956,7 @@ int igraph_tree(igraph_t *graph, igraph_integer_t n, igraph_integer_t children,
}
}
- IGRAPH_CHECK(igraph_create(graph, &edges, 0, type!=IGRAPH_TREE_UNDIRECTED));
+ IGRAPH_CHECK(igraph_create(graph, &edges, n, type!=IGRAPH_TREE_UNDIRECTED));
igraph_vector_destroy(&edges);
IGRAPH_FINALLY_CLEAN(1);
@@ -1235,12 +1236,13 @@ int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes,
* \function igraph_connect_neighborhood
* \brief Connects every vertex to its neighborhood
*
- * This function adds new edges to the input graph. For each vertex
- * vertices reachable by at most \p order steps and not yet connected
- * to the vertex a new edge is created.
+ * This function adds new edges to the input graph. Each vertex is connected
+ * to all vertices reachable by at most \p order steps from it
+ * (unless a connection already existed). In other words, the \p order power of
+ * the graph is computed.
*
* </para><para> Note that the input graph is modified in place, no
- * new graph is created, call \ref igraph_copy() if you want to keep
+ * new graph is created. Call \ref igraph_copy() if you want to keep
* the original graph as well.
*
* </para><para> For undirected graphs reachability is always
@@ -1260,8 +1262,8 @@ int igraph_extended_chordal_ring(igraph_t *graph, igraph_integer_t nodes,
* \sa \ref igraph_lattice() uses this function to connect the
* neighborhood of the vertices.
*
- * Time complexity: O(|V|*d^o), |V| is the number of vertices in the
- * graph, d is the average degree and o is the \p order argument.
+ * Time complexity: O(|V|*d^k), |V| is the number of vertices in the
+ * graph, d is the average degree and k is the \p order argument.
*/
int igraph_connect_neighborhood(igraph_t *graph, igraph_integer_t order,
@@ -1621,32 +1623,33 @@ int igraph_lcf_vector(igraph_t *graph, igraph_integer_t n,
long int no_of_shifts=igraph_vector_size(shifts);
long int ptr=0, i, sptr=0;
long int no_of_nodes=n;
- long int no_of_edges=n+no_of_shifts*repeats/2;
+ long int no_of_edges=n+no_of_shifts*repeats;
- if (repeats<0) IGRAPH_ERROR("number of repeats must be positive", IGRAPH_EINVAL);
+ if (repeats<0) IGRAPH_ERROR("number of repeats must be positive", IGRAPH_EINVAL);
IGRAPH_VECTOR_INIT_FINALLY(&edges, 2*no_of_edges);
- /* Create a ring first */
- for (i=0; i<no_of_nodes; i++) {
- VECTOR(edges)[ptr++]=i;
- VECTOR(edges)[ptr++]=i+1;
+ if (no_of_nodes > 0) {
+ /* Create a ring first */
+ for (i=0; i<no_of_nodes; i++) {
+ VECTOR(edges)[ptr++]=i;
+ VECTOR(edges)[ptr++]=i+1;
+ }
+ VECTOR(edges)[ptr-1]=0;
}
- VECTOR(edges)[ptr-1]=0;
-
+
/* Then add the rest */
while (ptr<2*no_of_edges) {
long int sh=(long int) VECTOR(*shifts)[sptr % no_of_shifts];
long int from=sptr % no_of_nodes;
long int to=(no_of_nodes+sptr+sh) % no_of_nodes;
- if (from < to) {
- VECTOR(edges)[ptr++]=from;
- VECTOR(edges)[ptr++]=to;
- }
+ VECTOR(edges)[ptr++]=from;
+ VECTOR(edges)[ptr++]=to;
sptr++;
}
IGRAPH_CHECK(igraph_create(graph, &edges, (igraph_integer_t) no_of_nodes,
IGRAPH_UNDIRECTED));
+ IGRAPH_CHECK(igraph_simplify(graph, 1 /* true */, 1 /* true */, NULL));
igraph_vector_destroy(&edges);
IGRAPH_FINALLY_CLEAN(1);
diff --git a/src/topology.c b/src/topology.c
index e384a50..5f06852 100644
--- a/src/topology.c
+++ b/src/topology.c
@@ -30,6 +30,7 @@
#include "igraph_conversion.h"
#include "igraph_stack.h"
#include "igraph_attributes.h"
+#include "igraph_structural.h"
#include "config.h"
const unsigned int igraph_i_isoclass_3[] = { 0, 1, 1, 3, 1, 5, 6, 7,
@@ -649,8 +650,7 @@ const unsigned int igraph_i_classedges_4u[] = { 2,3, 1,3, 0,3, 1,2, 0,2, 0,1 };
* starters.</para>
*
* <para>Functions for the BLISS algorithm constitute the third set,
- * see \ref igraph_isomorphic_bliss(). This implementation only works
- * for undirected graphs.</para>
+ * see \ref igraph_isomorphic_bliss().</para>
*
* <para>Finally, the isomorphism classes of all graphs with three and
* four vertices are precomputed and stored in igraph, so for these
@@ -760,8 +760,6 @@ int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass) {
* and edges it returns with \c FALSE.
* \oli Otherwise, if the graphs have three or four vertices then an O(1)
* algorithm is used with precomputed data.
- * \oli Otherwise, if the graphs are directed then VF2 is used, see
- * \ref igraph_isomorphic_vf2().
* \oli Otherwise BLISS is used, see \ref igraph_isomorphic_bliss().
* \endolist
* </para>
@@ -781,24 +779,31 @@ int igraph_isoclass(const igraph_t *graph, igraph_integer_t *isoclass) {
*/
int igraph_isomorphic(const igraph_t *graph1, const igraph_t *graph2,
- igraph_bool_t *iso) {
+ igraph_bool_t *iso) {
long int nodes1=igraph_vcount(graph1), nodes2=igraph_vcount(graph2);
long int edges1=igraph_ecount(graph1), edges2=igraph_ecount(graph2);
igraph_bool_t dir1=igraph_is_directed(graph1), dir2=igraph_is_directed(graph2);
+ igraph_bool_t loop1, loop2;
if (dir1 != dir2) {
IGRAPH_ERROR("Cannot compare directed and undirected graphs", IGRAPH_EINVAL);
} else if (nodes1 != nodes2 || edges1 != edges2) {
*iso=0;
} else if (nodes1==3 || nodes1==4) {
- igraph_isomorphic_34(graph1, graph2, iso);
- } else if (dir1) {
- igraph_isomorphic_vf2(graph1, graph2, 0, 0, 0, 0, iso, 0, 0, 0, 0, 0);
+ IGRAPH_CHECK(igraph_has_loop(graph1, &loop1));
+ IGRAPH_CHECK(igraph_has_loop(graph2, &loop2));
+ if (!loop1 && !loop2) {
+ IGRAPH_CHECK(igraph_isomorphic_34(graph1, graph2, iso));
+ } else {
+ IGRAPH_CHECK(igraph_isomorphic_bliss(graph1, graph2, NULL, NULL, iso,
+ 0, 0, /*sh=*/ IGRAPH_BLISS_F, 0, 0));
+ }
} else {
- igraph_isomorphic_bliss(graph1, graph2, iso, 0, 0, /*sh1=*/0, /*sh2=*/0, 0, 0);
+ IGRAPH_CHECK(igraph_isomorphic_bliss(graph1, graph2, NULL, NULL, iso,
+ 0, 0, /*sh=*/ IGRAPH_BLISS_F, 0, 0));
}
-
+
return 0;
}
@@ -1023,7 +1028,8 @@ int igraph_isoclass_create(igraph_t *graph, igraph_integer_t size,
* finds an isomorphism between the two graphs. The mapping between
* the two graphs will be also provided to this function. If the
* callback returns a nonzero value then the search is continued,
- * otherwise it stops.
+ * otherwise it stops. The callback function must not destroy the
+ * mapping vectors that are passed to it.
* \param graph1 The first input graph.
* \param graph2 The second input graph.
* \param vertex_color1 An optional color vector for the first graph. If
@@ -1100,6 +1106,11 @@ int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph
edge_color1 = edge_color2 = 0;
}
+ if (no_of_nodes != igraph_vcount(graph2) ||
+ no_of_edges != igraph_ecount(graph2)) {
+ return 0;
+ }
+
if (vertex_color1) {
if (igraph_vector_int_size(vertex_color1) != no_of_nodes ||
igraph_vector_int_size(vertex_color2) != no_of_nodes) {
@@ -1114,11 +1125,6 @@ int igraph_isomorphic_function_vf2(const igraph_t *graph1, const igraph_t *graph
}
}
- if (no_of_nodes != igraph_vcount(graph2) ||
- no_of_edges != igraph_ecount(graph2)) {
- return 0;
- }
-
/* Check color distribution */
if (vertex_color1) {
int ret=0;
@@ -2774,7 +2780,7 @@ int igraph_permute_vertices(const igraph_t *graph, igraph_t *res,
* </para>
*
* <para>
- * BLISS version 0.35 is included in igraph.
+ * BLISS version 0.73 is included in igraph.
* </para>
*/
@@ -2786,13 +2792,18 @@ int igraph_permute_vertices(const igraph_t *graph, igraph_t *res,
* successor of the famous NAUTY algorithm and implementation. BLISS
* is open source and licensed according to the GNU GPL. See
* http://www.tcs.hut.fi/Software/bliss/index.html for
- * details. Currently the 0.35 version of BLISS is included in igraph.
- * \param graph1 The first input graph, it is assumed to be
- * undirected, directed graphs are treated as undirected too.
- * The algorithm eliminates multiple edges from the graph first.
- * \param graph2 The second input graph, it is assumed to be
- * undirected, directed graphs are treated as undirected too.
- * The algorithm eliminates multiple edges from the graph first.
+ * details. Currently the 0.73 version of BLISS is included in igraph.
+ *
+ * </para><para>
+ *
+ * \param graph1 The first input graph. Multiple edges between the same nodes
+ * are not supported and will cause an incorrect result to be returned.
+ * \param graph2 The second input graph. Multiple edges between the same nodes
+ * are not supported and will cause an incorrect result to be returned.
+ * \param colors1 An optional vertex color vector for the first graph. Supply a
+ * null pointer if your graph is not colored.
+ * \param colors2 An optional vertex color vector for the second graph. Supply a
+ * null pointer if your graph is not colored.
* \param iso Pointer to a boolean, the result is stored here.
* \param map12 A vector or \c NULL pointer. If not \c NULL then an
* isomorphic mapping from \p graph1 to \p graph2 is stored here.
@@ -2800,10 +2811,8 @@ int igraph_permute_vertices(const igraph_t *graph, igraph_t *res,
* cleared, i.e. it will have length zero.
* \param map21 Similar to \p map12, but for the mapping from \p
* graph2 to \p graph1.
- * \param sh1 Splitting heuristics to be used for the first graph. See
+ * \param sh Splitting heuristics to be used for the graphs. See
* \ref igraph_bliss_sh_t.
- * \param sh2 Splitting heuristics to be used for the second
- * graph. See \ref igraph_bliss_sh_t.
* \param info1 If not \c NULL, information about the canonization of
* the first input graph is stored here. See \ref igraph_bliss_info_t
* for details. Note that if the two graphs have different number
@@ -2814,10 +2823,11 @@ int igraph_permute_vertices(const igraph_t *graph, igraph_t *res,
* Time complexity: exponential, but in practice it is quite fast.
*/
-int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
+int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
+ const igraph_vector_int_t *colors1, const igraph_vector_int_t *colors2,
igraph_bool_t *iso, igraph_vector_t *map12,
igraph_vector_t *map21,
- igraph_bliss_sh_t sh1, igraph_bliss_sh_t sh2,
+ igraph_bliss_sh_t sh,
igraph_bliss_info_t *info1, igraph_bliss_info_t *info2) {
long int no_of_nodes=igraph_vcount(graph1);
@@ -2826,24 +2836,30 @@ int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
igraph_vector_t vmap12, *mymap12=&vmap12;
igraph_vector_t from, to, index;
igraph_vector_t from2, to2, index2;
+ igraph_bool_t directed;
long int i, j;
*iso=0;
- if (info1) {
- info1->nof_nodes = info1->nof_leaf_nodes = info1->nof_bad_nodes =
- info1->nof_canupdates = info1->max_level = -1;
- info1->group_size = 0;
- }
- if (info2) {
- info2->nof_nodes = info2->nof_leaf_nodes = info2->nof_bad_nodes =
- info2->nof_canupdates = info2->max_level = -1;
- info2->group_size = 0;
- }
+ if (info1) {
+ info1->nof_nodes = info1->nof_leaf_nodes = info1->nof_bad_nodes =
+ info1->nof_canupdates = info1->max_level = info1->nof_generators = -1;
+ info1->group_size = 0;
+ }
+ if (info2) {
+ info2->nof_nodes = info2->nof_leaf_nodes = info2->nof_bad_nodes =
+ info2->nof_canupdates = info2->max_level = info2->nof_generators = -1;
+ info2->group_size = 0;
+ }
- if (igraph_is_directed(graph1) != igraph_is_directed(graph2)) {
+ directed = igraph_is_directed(graph1);
+ if (igraph_is_directed(graph2) != directed) {
IGRAPH_ERROR("Cannot compare directed and undirected graphs",
IGRAPH_EINVAL);
}
+ if ((colors1 == NULL || colors2 == NULL) && colors1 != colors2) {
+ IGRAPH_WARNING("Only one of the graphs is vertex colored, colors will be ignored");
+ colors1 = NULL; colors2 = NULL;
+ }
if (no_of_nodes != igraph_vcount(graph2) ||
no_of_edges != igraph_ecount(graph2)) {
@@ -2861,8 +2877,8 @@ int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
IGRAPH_VECTOR_INIT_FINALLY(&perm1, no_of_nodes);
IGRAPH_VECTOR_INIT_FINALLY(&perm2, no_of_nodes);
- IGRAPH_CHECK(igraph_canonical_permutation(graph1, &perm1, sh1, info1));
- IGRAPH_CHECK(igraph_canonical_permutation(graph2, &perm2, sh2, info2));
+ IGRAPH_CHECK(igraph_canonical_permutation(graph1, colors1, &perm1, sh, info1));
+ IGRAPH_CHECK(igraph_canonical_permutation(graph2, colors2, &perm2, sh, info2));
IGRAPH_CHECK(igraph_vector_resize(mymap12, no_of_nodes));
@@ -2894,7 +2910,7 @@ int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
for (i=0; i<no_of_edges; i++) {
VECTOR(from)[i] = VECTOR(*mymap12)[ (long int) IGRAPH_FROM(graph1, i) ];
VECTOR(to)[i] = VECTOR(*mymap12)[ (long int) IGRAPH_TO (graph1, i) ];
- if (VECTOR(from)[i] < VECTOR(to)[i]) {
+ if (! directed && VECTOR(from)[i] < VECTOR(to)[i]) {
igraph_real_t tmp=VECTOR(from)[i];
VECTOR(from)[i] = VECTOR(to)[i];
VECTOR(to)[i] = tmp;
@@ -2905,7 +2921,7 @@ int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
igraph_get_edgelist(graph2, &from2, /*bycol=*/ 1);
for (i=0, j=no_of_edges; i<no_of_edges; i++, j++) {
VECTOR(to2)[i] = VECTOR(from2)[j];
- if (VECTOR(from2)[i] < VECTOR(to2)[i]) {
+ if (! directed && VECTOR(from2)[i] < VECTOR(to2)[i]) {
igraph_real_t tmp=VECTOR(from2)[i];
VECTOR(from2)[i] = VECTOR(to2)[i];
VECTOR(to2)[i] = tmp;
@@ -2924,6 +2940,17 @@ int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
break;
}
}
+
+ /* If the graphs are coloured, we also need to check that applying the
+ permutation mymap12 to colors1 gives colors2. */
+ if (*iso && colors1 != NULL) {
+ for (i=0; i < no_of_nodes; i++) {
+ if (VECTOR(*colors1)[ (long int) VECTOR(*mymap12)[i] ] != VECTOR(*colors2)[i]) {
+ *iso = 0;
+ break;
+ }
+ }
+ }
igraph_vector_destroy(&index2);
igraph_vector_destroy(&to2);
@@ -2938,7 +2965,7 @@ int igraph_isomorphic_bliss(const igraph_t *graph1, const igraph_t *graph2,
if (map21) {
IGRAPH_CHECK(igraph_vector_resize(map21, no_of_nodes));
for (i=0; i<no_of_nodes; i++) {
- VECTOR(*map21)[ (long int) VECTOR(*mymap12)[i] ] = i;
+ VECTOR(*map21)[ (long int) VECTOR(*mymap12)[i] ] = i;
}
}
} else {
diff --git a/src/triangles.c b/src/triangles.c
index 60dd738..86df782 100644
--- a/src/triangles.c
+++ b/src/triangles.c
@@ -83,7 +83,6 @@ int igraph_transitivity_avglocal_undirected(const igraph_t *graph,
igraph_adjlist_t allneis;
igraph_vector_int_t *neis1, *neis2;
long int neilen1, neilen2;
- igraph_real_t triples;
long int *neis;
long int maxdegree;
@@ -126,7 +125,6 @@ int igraph_transitivity_avglocal_undirected(const igraph_t *graph,
neis1=igraph_adjlist_get(&allneis, node);
neilen1=igraph_vector_int_size(neis1);
- triples = ((double)neilen1) * (neilen1 - 1) / 2.0;
/* Mark the neighbors of 'node' */
for (i=0; i<neilen1; i++) {
neis[ (long int)VECTOR(*neis1)[i] ] = node+1;
@@ -151,8 +149,8 @@ int igraph_transitivity_avglocal_undirected(const igraph_t *graph,
}
}
- if (triples != 0) {
- sum += VECTOR(triangles)[node] / triples;
+ if (neilen1 >= 2) {
+ sum += VECTOR(triangles)[node] / neilen1 / (neilen1-1) * 2.0;
count++;
} else if (mode == IGRAPH_TRANSITIVITY_ZERO) {
count++;
@@ -175,10 +173,8 @@ int igraph_transitivity_local_undirected1(const igraph_t *graph,
const igraph_vs_t vids,
igraph_transitivity_mode_t mode) {
-#define TRIPLES
#define TRANSIT
#include "triangles_template1.h"
-#undef TRIPLES
#undef TRANSIT
return 0;
@@ -314,11 +310,10 @@ int igraph_transitivity_local_undirected2(const igraph_t *graph,
igraph_vector_t *neis2=igraph_lazy_adjlist_get(&adjlist,
(igraph_integer_t) node);
long int deg=igraph_vector_size(neis2);
- igraph_real_t triples=(double) deg * (deg-1) / 2;
- if (mode == IGRAPH_TRANSITIVITY_ZERO && triples == 0)
+ if (mode == IGRAPH_TRANSITIVITY_ZERO && deg < 2)
VECTOR(*res)[i] = 0.0;
else
- VECTOR(*res)[i] = VECTOR(triangles)[idx] / triples;
+ VECTOR(*res)[i] = VECTOR(triangles)[idx] / deg / (deg-1) * 2.0;
/* fprintf(stderr, "%f %f\n", VECTOR(triangles)[idx], triples); */
}
@@ -432,10 +427,8 @@ int igraph_transitivity_local_undirected4(const igraph_t *graph,
const igraph_vs_t vids,
igraph_transitivity_mode_t mode) {
-#define TRIPLES 1
#define TRANSIT 1
#include "triangles_template.h"
-#undef TRIPLES
#undef TRANSIT
return 0;
diff --git a/src/triangles_template.h b/src/triangles_template.h
index a3137be..376ad34 100644
--- a/src/triangles_template.h
+++ b/src/triangles_template.h
@@ -27,9 +27,6 @@
igraph_adjlist_t allneis;
igraph_vector_int_t *neis1, *neis2;
long int neilen1, neilen2, deg1;
-#ifdef TRIPLES
- igraph_real_t triples;
-#endif
long int *neis;
long int maxdegree;
@@ -76,9 +73,6 @@
neis1=igraph_adjlist_get(&allneis, node);
neilen1=igraph_vector_int_size(neis1);
deg1=(long int) VECTOR(degree)[node];
-#ifdef TRIPLES
- triples= ((double)deg1*(deg1-1)/2);
-#endif
/* Mark the neighbors of the node */
for (i=0; i<neilen1; i++) {
neis[ (long int) VECTOR(*neis1)[i] ] = node+1;
@@ -105,10 +99,10 @@
}
#ifdef TRANSIT
- if (mode == IGRAPH_TRANSITIVITY_ZERO && triples == 0)
+ if (mode == IGRAPH_TRANSITIVITY_ZERO && deg1 < 2)
VECTOR(*res)[node] = 0.0;
else
- VECTOR(*res)[node] /= triples;
+ VECTOR(*res)[node] = VECTOR(*res)[node] / deg1 / (deg1-1) * 2.0;
#endif
#ifdef TRIEDGES
VECTOR(*res)[node] += deg1;
diff --git a/src/triangles_template1.h b/src/triangles_template1.h
index 3fa74b6..aa7473c 100644
--- a/src/triangles_template1.h
+++ b/src/triangles_template1.h
@@ -26,9 +26,6 @@
igraph_vit_t vit;
long int nodes_to_calc;
igraph_vector_t *neis1, *neis2;
-#ifdef TRIPLES
- igraph_real_t triples;
-#endif
igraph_real_t triangles;
long int i, j, k;
long int neilen1, neilen2;
@@ -60,9 +57,6 @@
for (j=0; j<neilen1; j++) {
neis[ (long int)VECTOR(*neis1)[j] ] = i+1;
}
-#ifdef TRIPLES
- triples = (double)neilen1*(neilen1-1);
-#endif
triangles = 0;
for (j=0; j<neilen1; j++) {
@@ -78,10 +72,10 @@
}
#ifdef TRANSIT
- if (mode == IGRAPH_TRANSITIVITY_ZERO && triples == 0)
+ if (mode == IGRAPH_TRANSITIVITY_ZERO && neilen1 < 2)
VECTOR(*res)[i] = 0.0;
else
- VECTOR(*res)[i] = triangles/triples;
+ VECTOR(*res)[i] = triangles/neilen1/(neilen1-1);
#else
VECTOR(*res)[i] = triangles/2;
#endif
diff --git a/src/uuid/gen_uuid.c b/src/uuid/gen_uuid.c
index 69ad494..e7c12b3 100644
--- a/src/uuid/gen_uuid.c
+++ b/src/uuid/gen_uuid.c
@@ -36,7 +36,7 @@
* Force inclusion of SVID stuff since we need it if we're compiling in
* gcc-wall wall mode
*/
-#define _SVID_SOURCE
+#define _DEFAULT_SOURCE
#include "config.h"
@@ -332,10 +332,6 @@ static int flock(int fd, int op)
}
#endif
-#if !defined(HAVE_FLOCK) && !defined(__sun)
-# define HAVE_FLOCK 1
-#endif
-
/* Assume that the gettimeofday() has microsecond granularity */
#define MAX_ADJUSTMENT 10
@@ -376,17 +372,6 @@ static int get_clock(uint32_t *clock_high, uint32_t *clock_low,
}
if (state_fd >= 0) {
rewind(state_f);
-#ifdef HAVE_FLOCK
- while (flock(state_fd, LOCK_EX) < 0) {
- if ((errno == EAGAIN) || (errno == EINTR))
- continue;
- fclose(state_f);
- close(state_fd);
- state_fd = -1;
- ret = -1;
- break;
- }
-#endif
}
if (state_fd >= 0) {
unsigned int cl;
@@ -450,9 +435,6 @@ try_again:
fflush(state_f);
}
rewind(state_f);
-#ifdef HAVE_FLOCK
- flock(state_fd, LOCK_UN);
-#endif
}
*clock_high = clock_reg >> 32;
diff --git a/src/vector.pmt b/src/vector.pmt
index 8187248..c576fb8 100644
--- a/src/vector.pmt
+++ b/src/vector.pmt
@@ -146,7 +146,7 @@ int FUNCTION(igraph_vector,init) (TYPE(igraph_vector)* v, int long size) {
* Be sure that you \em don't ever call the destructor (\ref
* igraph_vector_destroy()) on objects created by this constructor.
* \param v Pointer to an uninitialized \type igraph_vector_t object.
- * \param data Pointer, the C array.
+ * \param data Pointer, the C array. It may not be \c NULL.
* \param length The length of the C array.
* \return Pointer to the vector object, the same as the
* \p v parameter, for convenience.
@@ -158,6 +158,9 @@ const TYPE(igraph_vector)*FUNCTION(igraph_vector,view) (const TYPE(igraph_vector
const BASE *data,
long int length) {
TYPE(igraph_vector) *v2=(TYPE(igraph_vector)*)v;
+
+ assert(data != 0);
+
v2->stor_begin=(BASE*)data;
v2->stor_end=(BASE*)data+length;
v2->end=v2->stor_end;
diff --git a/src/vector_ptr.c b/src/vector_ptr.c
index 3b8c717..88487b7 100644
--- a/src/vector_ptr.c
+++ b/src/vector_ptr.c
@@ -324,14 +324,11 @@ int igraph_vector_ptr_push_back (igraph_vector_ptr_t* v, void* e) {
}
void *igraph_vector_ptr_pop_back (igraph_vector_ptr_t *v) {
- void *tmp;
assert(v != NULL);
assert(v->stor_begin != NULL);
assert(v->stor_begin != v->end);
- tmp=*(v->end);
v->end -= 1;
-
- return tmp;
+ return *(v->end);
}
/**
diff --git a/tests/testthat.R b/tests/testthat.R
new file mode 100644
index 0000000..0040927
--- /dev/null
+++ b/tests/testthat.R
@@ -0,0 +1,4 @@
+library(testthat)
+library(igraph)
+
+test_check("igraph")
diff --git a/inst/tests/celegansneural.gml.gz b/tests/testthat/celegansneural.gml.gz
similarity index 100%
rename from inst/tests/celegansneural.gml.gz
rename to tests/testthat/celegansneural.gml.gz
diff --git a/inst/tests/dyad.census.R b/tests/testthat/dyad.census.R
similarity index 100%
rename from inst/tests/dyad.census.R
rename to tests/testthat/dyad.census.R
diff --git a/inst/tests/football.gml.gz b/tests/testthat/football.gml.gz
similarity index 100%
rename from inst/tests/football.gml.gz
rename to tests/testthat/football.gml.gz
diff --git a/inst/tests/power.gml.gz b/tests/testthat/power.gml.gz
similarity index 100%
rename from inst/tests/power.gml.gz
rename to tests/testthat/power.gml.gz
diff --git a/inst/tests/test-constructor-modifiers.R b/tests/testthat/test-constructor-modifiers.R
similarity index 100%
rename from inst/tests/test-constructor-modifiers.R
rename to tests/testthat/test-constructor-modifiers.R
diff --git a/tests/testthat/test-graph-ids.R b/tests/testthat/test-graph-ids.R
new file mode 100644
index 0000000..870facc
--- /dev/null
+++ b/tests/testthat/test-graph-ids.R
@@ -0,0 +1,72 @@
+
+context("Graph ids")
+
+test_that("ids change when updating the graph", {
+
+ g <- make_ring(10)
+
+ g2 <- g + 1
+ g3 <- g + edge(1,5)
+ g4 <- set_vertex_attr(g, "color", value = "red")
+
+ expect_false( graph_id(g) == graph_id(g2) )
+ expect_false( graph_id(g) == graph_id(g3) )
+
+})
+
+
+test_that("ids don't change when attributes change", {
+
+ g <- make_ring(10)
+ V(g)$color <- "green"
+ E(g)$weight <- 1
+
+ g2 <- set_vertex_attr(g, "color", value = "red")
+ g3 <- set_edge_attr(g, "weight", value = 3)
+ g4 <- set_vertex_attr(g, "name", value = LETTERS[1:10])
+ g5 <- set_edge_attr(g, "name", value = LETTERS[1:10])
+
+ expect_equal(graph_id(g), graph_id(g2))
+ expect_equal(graph_id(g), graph_id(g3))
+ expect_equal(graph_id(g), graph_id(g4))
+ expect_equal(graph_id(g), graph_id(g5))
+
+})
+
+
+test_that("ids of vertex and edge sequences are correct", {
+
+ g <- make_ring(10)
+
+ vs <- V(g)
+ vs2 <- vs[1:5]
+ es <- E(g)
+ es2 <- es[1:5]
+
+ expect_equal(graph_id(g), graph_id(vs))
+ expect_equal(graph_id(g), graph_id(vs2))
+ expect_equal(graph_id(g), graph_id(es))
+ expect_equal(graph_id(g), graph_id(es2))
+
+})
+
+
+test_that("ids of vertex and edge sequence remain after removing graph", {
+
+ g <- make_ring(10)
+ id <- graph_id(g)
+
+ vs <- V(g)
+ vs2 <- vs[1:5]
+ es <- E(g)
+ es2 <- es[1:5]
+
+ rm(g)
+ gc()
+
+ expect_equal(id, graph_id(vs))
+ expect_equal(id, graph_id(vs2))
+ expect_equal(id, graph_id(es))
+ expect_equal(id, graph_id(es2))
+
+})
diff --git a/inst/tests/test-index-es.R b/tests/testthat/test-index-es.R
similarity index 92%
rename from inst/tests/test-index-es.R
rename to tests/testthat/test-index-es.R
index ebb8270..12097e3 100644
--- a/inst/tests/test-index-es.R
+++ b/tests/testthat/test-index-es.R
@@ -36,5 +36,5 @@ test_that("I can index an es twice", {
x <- E(g)['BOS' %->% 'JFK'][carrier == 'foo']
- expect_equal(x, E(g)[ carrier == 'foo' & from('BOS') & to('JFK')])
+ expect_equal(x, E(g)[ carrier == 'foo' & .from('BOS') & .to('JFK')])
})
diff --git a/inst/tests/test-isomorphism.R b/tests/testthat/test-isomorphism.R
similarity index 100%
rename from inst/tests/test-isomorphism.R
rename to tests/testthat/test-isomorphism.R
diff --git a/inst/tests/test-make.R b/tests/testthat/test-make.R
similarity index 100%
rename from inst/tests/test-make.R
rename to tests/testthat/test-make.R
diff --git a/inst/tests/test-make_graph.R b/tests/testthat/test-make_graph.R
similarity index 100%
rename from inst/tests/test-make_graph.R
rename to tests/testthat/test-make_graph.R
diff --git a/inst/tests/test-new-layout-api.R b/tests/testthat/test-new-layout-api.R
similarity index 100%
rename from inst/tests/test-new-layout-api.R
rename to tests/testthat/test-new-layout-api.R
diff --git a/inst/tests/test-notable.R b/tests/testthat/test-notable.R
similarity index 100%
rename from inst/tests/test-notable.R
rename to tests/testthat/test-notable.R
diff --git a/inst/tests/test-old-data-type.R b/tests/testthat/test-old-data-type.R
similarity index 100%
rename from inst/tests/test-old-data-type.R
rename to tests/testthat/test-old-data-type.R
diff --git a/inst/tests/test-random_walk.R b/tests/testthat/test-random_walk.R
similarity index 100%
rename from inst/tests/test-random_walk.R
rename to tests/testthat/test-random_walk.R
diff --git a/inst/tests/test-version.R b/tests/testthat/test-version.R
similarity index 100%
rename from inst/tests/test-version.R
rename to tests/testthat/test-version.R
diff --git a/inst/tests/test-versions.R b/tests/testthat/test-versions.R
similarity index 100%
rename from inst/tests/test-versions.R
rename to tests/testthat/test-versions.R
diff --git a/tests/testthat/test-vs-es-printing.R b/tests/testthat/test-vs-es-printing.R
new file mode 100644
index 0000000..8f0fe6e
--- /dev/null
+++ b/tests/testthat/test-vs-es-printing.R
@@ -0,0 +1,110 @@
+
+context("Detailed printing of vs and es")
+
+test_that("vs printing", {
+
+ set.seed(42)
+ g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
+ set_vertex_attr("color", value = "red") %>%
+ set_vertex_attr("weight", value = sample(1:10, 3))
+ sid <- substr(graph_id(g), 1, 7)
+
+ o1 <- c(
+ paste0("+ 1/3 vertex, named, from ", sid, ":"),
+ " name color weight",
+ "1 A red 10")
+ expect_output(print(V(g)[[1]]), paste(o1, collapse = "\n"), fixed = TRUE)
+
+ o2 <- c(
+ paste0("+ 1/3 vertex, named, from ", sid, ":"),
+ " name color weight",
+ "2 B red 9")
+ expect_output(print(V(g)[[2]]), paste(o2, collapse = "\n"), fixed = TRUE)
+
+ o3 <- c(
+ paste0("+ 2/3 vertices, named, from ", sid, ":"),
+ " name color weight",
+ "1 A red 10", "2 B red 9")
+ expect_output(print(V(g)[[1:2]]), paste(o3, collapse = "\n"), fixed = TRUE)
+
+ o4 <- c(
+ paste0("+ 2/3 vertices, named, from ", sid, ":"),
+ " name color weight",
+ "2 B red 9", "3 C red 3")
+ expect_output(print(V(g)[[2:3]]), paste(o4, collapse = "\n"), fixed = TRUE)
+
+})
+
+test_that("vs printing, complex attributes", {
+
+ set.seed(42)
+ g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
+ set_vertex_attr("color", value = "red") %>%
+ set_vertex_attr("weight", value = sample(1:10, 3)) %>%
+ set_vertex_attr("cplx", value = replicate(3, 1:4, simplify = FALSE))
+ sid <- substr(graph_id(g), 1, 7)
+
+ o1 <- c(
+ paste0("+ 1/3 vertex, named, from ", sid, ":"),
+ "$name", "[1] \"A\"", "", "$color",
+ "[1] \"red\"", "", "$weight", "[1] 10", "", "$cplx", "$cplx[[1]]",
+ "[1] 1 2 3 4", "", "")
+ expect_output(print(V(g)[[1]]), paste(o1, collapse = "\n"), fixed = TRUE)
+
+ o2 <- c(
+ paste0("+ 2/3 vertices, named, from ", sid, ":"),
+ "$name", "[1] \"B\" \"C\"", "", "$color",
+ "[1] \"red\" \"red\"", "", "$weight", "[1] 9 3", "", "$cplx",
+ "$cplx[[1]]", "[1] 1 2 3 4", "", "$cplx[[2]]", "[1] 1 2 3 4",
+ "", "")
+ expect_output(print(V(g)[[2:3]]), paste(o2, collapse = "\n"), fixed = TRUE)
+
+})
+
+test_that("es printing", {
+
+ set.seed(42)
+ g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
+ set_edge_attr("color", value = "red") %>%
+ set_edge_attr("weight", value = sample(1:10, 3))
+ sid <- substr(graph_id(g), 1, 7)
+
+ o1 <- c(
+ paste0("+ 1/3 edge from ", sid, " (vertex names):"),
+ " tail head tid hid color weight",
+ "1 A B 1 2 red 10")
+ expect_output(print(E(g)[[1]]), paste(o1, collapse = "\n"), fixed = TRUE)
+
+ o2 <- c(
+ paste0("+ 2/3 edges from ", sid, " (vertex names):"),
+ " tail head tid hid color weight",
+ "2 A C 1 3 red 9",
+ "3 B C 2 3 red 3")
+ expect_output(print(E(g)[[2:3]]), paste(o2, collapse = "\n"), fixed = TRUE)
+
+})
+
+test_that("es printing, complex attributes", {
+
+ set.seed(42)
+ g <- make_graph(~ A - A:B:C, B - A:B:C) %>%
+ set_edge_attr("color", value = "red") %>%
+ set_edge_attr("weight", value = sample(1:10, 3)) %>%
+ set_edge_attr("cmpx", value = replicate(3, 1:4, simplify = FALSE))
+ sid <- substr(graph_id(g), 1, 7)
+
+ o1 <- c(
+ paste0("+ 1/3 edge from ", sid, " (vertex names):"),
+ "$color", "[1] \"red\"", "",
+ "$weight", "[1] 10", "", "$cmpx", "$cmpx[[1]]", "[1] 1 2 3 4",
+ "", "")
+ expect_output(print(E(g)[[1]]), paste(o1, collapse = "\n"), fixed = TRUE)
+
+ o2 <- c(
+ paste0("+ 2/3 edges from ", sid, " (vertex names):"),
+ "$color", "[1] \"red\" \"red\"",
+ "", "$weight", "[1] 9 3", "", "$cmpx", "$cmpx[[1]]",
+ "[1] 1 2 3 4", "", "$cmpx[[2]]", "[1] 1 2 3 4", "", "")
+ expect_output(print(E(g)[[2:3]]), paste(o2, collapse = "\n"), fixed = TRUE)
+
+})
diff --git a/inst/tests/test-vs-es-quirks.R b/tests/testthat/test-vs-es-quirks.R
similarity index 100%
rename from inst/tests/test-vs-es-quirks.R
rename to tests/testthat/test-vs-es-quirks.R
diff --git a/inst/tests/test-vs-es.R b/tests/testthat/test-vs-es.R
similarity index 63%
rename from inst/tests/test-vs-es.R
rename to tests/testthat/test-vs-es.R
index 876b614..f64a472 100644
--- a/inst/tests/test-vs-es.R
+++ b/tests/testthat/test-vs-es.R
@@ -162,48 +162,71 @@ test_that("printing connected vs/es works", {
g <- make_ring(10)
vs <- V(g)
es <- E(g)
-
- expect_output(print(vs), fixed = TRUE,
- "+ 10/10 vertices:\n [1] 1 2 3 4 5 6 7 8 9 10")
- expect_output(print(es), fixed = TRUE,
- "+ 10/10 edges:\n [1] 1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10")
+ sid <- substr(graph_id(g), 1, 7)
+
+ expect_output(
+ print(vs), fixed = TRUE,
+ paste0("+ 10/10 vertices, from ", sid,
+ ":\n [1] 1 2 3 4 5 6 7 8 9 10")
+ )
+ expect_output(
+ print(es), fixed = TRUE,
+ paste0("+ 10/10 edges from ", sid,
+ ":\n [1] 1-- 2 2-- 3 3-- 4 4-- 5 5-- 6 6-- 7 7-- 8 8-- 9 9--10 1--10")
+ )
vs2 <- vs[1:5]
es2 <- es[1:5]
expect_output(print(vs2), fixed = TRUE,
- "+ 5/10 vertices:\n[1] 1 2 3 4 5")
+ paste0("+ 5/10 vertices, from ", sid, ":\n[1] 1 2 3 4 5"))
expect_output(print(es2), fixed = TRUE,
- "+ 5/10 edges:\n[1] 1--2 2--3 3--4 4--5 5--6")
+ paste0("+ 5/10 edges from ", sid,
+ ":\n[1] 1--2 2--3 3--4 4--5 5--6"))
vs3 <- vs[numeric()]
es3 <- es[numeric()]
- expect_output(print(vs3), fixed = TRUE, "+ 0/10 vertices:")
- expect_output(print(es3), fixed = TRUE, "+ 0/10 edges:")
+ expect_output(print(vs3), fixed = TRUE,
+ paste0("+ 0/10 vertices, from ", sid, ":"))
+ expect_output(print(es3), fixed = TRUE,
+ paste0("+ 0/10 edges from ", sid, ":"))
V(g)$name <- letters[1:10]
vs <- V(g)
es <- E(g)
- expect_output(print(vs), fixed = TRUE,
- "+ 10/10 vertices, named:\n [1] a b c d e f g h i j")
- expect_output(print(es), fixed = TRUE,
- "+ 10/10 edges (vertex names):\n [1] a--b b--c c--d d--e e--f f--g g--h h--i i--j a--j")
+ expect_output(
+ print(vs), fixed = TRUE,
+ paste0("+ 10/10 vertices, named, from ", sid,
+ ":\n [1] a b c d e f g h i j")
+ )
+ expect_output(
+ print(es), fixed = TRUE,
+ paste0("+ 10/10 edges from ", sid, " (vertex names):\n",
+ " [1] a--b b--c c--d d--e e--f f--g g--h h--i i--j a--j")
+ )
vs2 <- vs[1:5]
es2 <- es[1:5]
- expect_output(print(vs2), fixed = TRUE,
- "+ 5/10 vertices, named:\n[1] a b c d e")
- expect_output(print(es2), fixed = TRUE,
- "+ 5/10 edges (vertex names):\n[1] a--b b--c c--d d--e e--f")
+ expect_output(
+ print(vs2), fixed = TRUE,
+ paste0("+ 5/10 vertices, named, from ", sid, ":\n[1] a b c d e")
+ )
+ expect_output(
+ print(es2), fixed = TRUE,
+ paste0("+ 5/10 edges from ", sid, " (vertex names):\n",
+ "[1] a--b b--c c--d d--e e--f")
+ )
vs3 <- vs[numeric()]
es3 <- es[numeric()]
- expect_output(print(vs3), fixed = TRUE, "+ 0/10 vertices, named:")
- expect_output(print(es3), fixed = TRUE, "+ 0/10 edges (vertex names):")
+ expect_output(print(vs3), fixed = TRUE,
+ paste0("+ 0/10 vertices, named, from ", sid, ":"))
+ expect_output(print(es3), fixed = TRUE,
+ paste0("+ 0/10 edges from ", sid, " (vertex names):"))
})
test_that("printing unconnected vs/es works", {
@@ -211,27 +234,41 @@ test_that("printing unconnected vs/es works", {
g <- make_ring(10)
vs <- V(g)
es <- E(g)
+ sid <- substr(graph_id(g), 1, 7)
rm(g)
gc()
- expect_output(print(vs), fixed = TRUE,
- "+ 10/? vertices:\n [1] 1 2 3 4 5 6 7 8 9 10")
- expect_output(print(es), fixed = TRUE,
- "+ 10/? edges, unknown graph:\n [1] 1 2 3 4 5 6 7 8 9 10")
+ expect_output(
+ print(vs), fixed = TRUE,
+ paste0("+ 10/? vertices, from ", sid,
+ " (deleted):\n [1] 1 2 3 4 5 6 7 8 9 10")
+ )
+ expect_output(
+ print(es), fixed = TRUE,
+ paste0("+ 10/? edges from ", sid,
+ " (deleted):\n [1] 1 2 3 4 5 6 7 8 9 10")
+ )
g <- make_ring(10)
V(g)$name <- letters[1:10]
vs <- V(g)
es <- E(g)
+ sid <- substr(graph_id(g), 1, 7)
rm(g)
gc()
- expect_output(print(vs), fixed = TRUE,
- "+ 10/? vertices, named:\n [1] a b c d e f g h i j")
- expect_output(print(es), fixed = TRUE,
- "+ 10/? edges, unknown graph (vertex names):\n [1] a|b b|c c|d d|e e|f f|g g|h h|i i|j a|j")
+ expect_output(
+ print(vs), fixed = TRUE,
+ paste0("+ 10/? vertices, named, from ", sid,
+ " (deleted):\n [1] a b c d e f g h i j")
+ )
+ expect_output(
+ print(es), fixed = TRUE,
+ paste0("+ 10/? edges from ", sid,
+ " (deleted) (vertex names):\n [1] a|b b|c c|d d|e e|f f|g g|h h|i i|j a|j")
+ )
})
diff --git a/inst/tests/test-vs-operators.R b/tests/testthat/test-vs-operators.R
similarity index 100%
rename from inst/tests/test-vs-operators.R
rename to tests/testthat/test-vs-operators.R
diff --git a/inst/tests/test-weakref.R b/tests/testthat/test-weakref.R
similarity index 100%
rename from inst/tests/test-weakref.R
rename to tests/testthat/test-weakref.R
diff --git a/inst/tests/test_add.edges.R b/tests/testthat/test_add.edges.R
similarity index 100%
rename from inst/tests/test_add.edges.R
rename to tests/testthat/test_add.edges.R
diff --git a/inst/tests/test_add.vertices.R b/tests/testthat/test_add.vertices.R
similarity index 100%
rename from inst/tests/test_add.vertices.R
rename to tests/testthat/test_add.vertices.R
diff --git a/inst/tests/test_adjacency.spectral.embedding.R b/tests/testthat/test_adjacency.spectral.embedding.R
similarity index 100%
rename from inst/tests/test_adjacency.spectral.embedding.R
rename to tests/testthat/test_adjacency.spectral.embedding.R
diff --git a/inst/tests/test_all.st.cuts.R b/tests/testthat/test_all.st.cuts.R
similarity index 100%
rename from inst/tests/test_all.st.cuts.R
rename to tests/testthat/test_all.st.cuts.R
diff --git a/inst/tests/test_alpha.centrality.R b/tests/testthat/test_alpha.centrality.R
similarity index 100%
rename from inst/tests/test_alpha.centrality.R
rename to tests/testthat/test_alpha.centrality.R
diff --git a/inst/tests/test_are.connected.R b/tests/testthat/test_are.connected.R
similarity index 100%
rename from inst/tests/test_are.connected.R
rename to tests/testthat/test_are.connected.R
diff --git a/inst/tests/test_arpack.R b/tests/testthat/test_arpack.R
similarity index 100%
rename from inst/tests/test_arpack.R
rename to tests/testthat/test_arpack.R
diff --git a/inst/tests/test_articulation.points.R b/tests/testthat/test_articulation.points.R
similarity index 100%
rename from inst/tests/test_articulation.points.R
rename to tests/testthat/test_articulation.points.R
diff --git a/inst/tests/test_as.directed.R b/tests/testthat/test_as.directed.R
similarity index 100%
rename from inst/tests/test_as.directed.R
rename to tests/testthat/test_as.directed.R
diff --git a/inst/tests/test_as.undirected.R b/tests/testthat/test_as.undirected.R
similarity index 100%
rename from inst/tests/test_as.undirected.R
rename to tests/testthat/test_as.undirected.R
diff --git a/inst/tests/test_assortativity.R b/tests/testthat/test_assortativity.R
similarity index 100%
rename from inst/tests/test_assortativity.R
rename to tests/testthat/test_assortativity.R
diff --git a/inst/tests/test_attributes.R b/tests/testthat/test_attributes.R
similarity index 100%
rename from inst/tests/test_attributes.R
rename to tests/testthat/test_attributes.R
diff --git a/inst/tests/test_authority.score.R b/tests/testthat/test_authority.score.R
similarity index 100%
rename from inst/tests/test_authority.score.R
rename to tests/testthat/test_authority.score.R
diff --git a/inst/tests/test_average.path.length.R b/tests/testthat/test_average.path.length.R
similarity index 100%
rename from inst/tests/test_average.path.length.R
rename to tests/testthat/test_average.path.length.R
diff --git a/inst/tests/test_ba.game.R b/tests/testthat/test_ba.game.R
similarity index 100%
rename from inst/tests/test_ba.game.R
rename to tests/testthat/test_ba.game.R
diff --git a/inst/tests/test_betweenness.R b/tests/testthat/test_betweenness.R
similarity index 100%
rename from inst/tests/test_betweenness.R
rename to tests/testthat/test_betweenness.R
diff --git a/inst/tests/test_biconnected.components.R b/tests/testthat/test_biconnected.components.R
similarity index 100%
rename from inst/tests/test_biconnected.components.R
rename to tests/testthat/test_biconnected.components.R
diff --git a/inst/tests/test_bipartite.projection.R b/tests/testthat/test_bipartite.projection.R
similarity index 100%
rename from inst/tests/test_bipartite.projection.R
rename to tests/testthat/test_bipartite.projection.R
diff --git a/inst/tests/test_bipartite.random.game.R b/tests/testthat/test_bipartite.random.game.R
similarity index 89%
rename from inst/tests/test_bipartite.random.game.R
rename to tests/testthat/test_bipartite.random.game.R
index dceaacd..dcdac60 100644
--- a/inst/tests/test_bipartite.random.game.R
+++ b/tests/testthat/test_bipartite.random.game.R
@@ -18,10 +18,10 @@ test_that("sample_bipartite works", {
expect_that(ecount(g2), equals(6))
expect_that(bipartite_mapping(g2)$res, is_true())
expect_that(is_directed(g2), is_true())
- expect_that(str(g2), prints_text("5->11"));
+ expect_that(print_all(g2), prints_text("5->11"));
g3 <- sample_bipartite(10, 5, type="gnp", p=.1, directed=TRUE, mode="in")
- expect_that(str(g3), prints_text("11->3"));
+ expect_that(print_all(g3), prints_text("11->3"));
g4 <- sample_bipartite(10, 5, type="gnm", m=8)
expect_that(vcount(g4), equals(15))
@@ -34,14 +34,14 @@ test_that("sample_bipartite works", {
expect_that(ecount(g5), equals(8))
expect_that(bipartite_mapping(g5)$res, is_true())
expect_that(is_directed(g5), is_true())
- expect_that(str(g5), prints_text("5->12"))
+ expect_that(print_all(g5), prints_text("5->12"))
g6 <- sample_bipartite(10, 5, type="gnm", m=8, directed=TRUE, mode="in")
expect_that(vcount(g6), equals(15))
expect_that(ecount(g6), equals(8))
expect_that(bipartite_mapping(g6)$res, is_true())
expect_that(is_directed(g6), is_true())
- expect_that(str(g6), prints_text("12->10"))
+ expect_that(print_all(g6), prints_text("12->10"))
#####
diff --git a/inst/tests/test_bonpow.R b/tests/testthat/test_bonpow.R
similarity index 100%
rename from inst/tests/test_bonpow.R
rename to tests/testthat/test_bonpow.R
diff --git a/inst/tests/test_bug-1019624.R b/tests/testthat/test_bug-1019624.R
similarity index 100%
rename from inst/tests/test_bug-1019624.R
rename to tests/testthat/test_bug-1019624.R
diff --git a/inst/tests/test_bug-1032819.R b/tests/testthat/test_bug-1032819.R
similarity index 100%
rename from inst/tests/test_bug-1032819.R
rename to tests/testthat/test_bug-1032819.R
diff --git a/inst/tests/test_bug-1033045.R b/tests/testthat/test_bug-1033045.R
similarity index 100%
rename from inst/tests/test_bug-1033045.R
rename to tests/testthat/test_bug-1033045.R
diff --git a/inst/tests/test_bug-1073705-indexing.R b/tests/testthat/test_bug-1073705-indexing.R
similarity index 100%
rename from inst/tests/test_bug-1073705-indexing.R
rename to tests/testthat/test_bug-1073705-indexing.R
diff --git a/inst/tests/test_bug-1073800-clique.R b/tests/testthat/test_bug-1073800-clique.R
similarity index 100%
rename from inst/tests/test_bug-1073800-clique.R
rename to tests/testthat/test_bug-1073800-clique.R
diff --git a/inst/tests/test_canonical.permutation.R b/tests/testthat/test_canonical.permutation.R
similarity index 100%
rename from inst/tests/test_canonical.permutation.R
rename to tests/testthat/test_canonical.permutation.R
diff --git a/inst/tests/test_cliques.R b/tests/testthat/test_cliques.R
similarity index 100%
rename from inst/tests/test_cliques.R
rename to tests/testthat/test_cliques.R
diff --git a/inst/tests/test_closeness.R b/tests/testthat/test_closeness.R
similarity index 100%
rename from inst/tests/test_closeness.R
rename to tests/testthat/test_closeness.R
diff --git a/inst/tests/test_clusters.R b/tests/testthat/test_clusters.R
similarity index 100%
rename from inst/tests/test_clusters.R
rename to tests/testthat/test_clusters.R
diff --git a/inst/tests/test_communities.R b/tests/testthat/test_communities.R
similarity index 100%
rename from inst/tests/test_communities.R
rename to tests/testthat/test_communities.R
diff --git a/inst/tests/test_constraint.R b/tests/testthat/test_constraint.R
similarity index 100%
rename from inst/tests/test_constraint.R
rename to tests/testthat/test_constraint.R
diff --git a/inst/tests/test_contract.vertices.R b/tests/testthat/test_contract.vertices.R
similarity index 100%
rename from inst/tests/test_contract.vertices.R
rename to tests/testthat/test_contract.vertices.R
diff --git a/inst/tests/test_correlated.R b/tests/testthat/test_correlated.R
similarity index 100%
rename from inst/tests/test_correlated.R
rename to tests/testthat/test_correlated.R
diff --git a/inst/tests/test_count.multiple.R b/tests/testthat/test_count.multiple.R
similarity index 100%
rename from inst/tests/test_count.multiple.R
rename to tests/testthat/test_count.multiple.R
diff --git a/inst/tests/test_decompose.graph.R b/tests/testthat/test_decompose.graph.R
similarity index 100%
rename from inst/tests/test_decompose.graph.R
rename to tests/testthat/test_decompose.graph.R
diff --git a/inst/tests/test_degree.R b/tests/testthat/test_degree.R
similarity index 100%
rename from inst/tests/test_degree.R
rename to tests/testthat/test_degree.R
diff --git a/inst/tests/test_degree.sequence.game.R b/tests/testthat/test_degree.sequence.game.R
similarity index 100%
rename from inst/tests/test_degree.sequence.game.R
rename to tests/testthat/test_degree.sequence.game.R
diff --git a/inst/tests/test_delete.edges.R b/tests/testthat/test_delete.edges.R
similarity index 100%
rename from inst/tests/test_delete.edges.R
rename to tests/testthat/test_delete.edges.R
diff --git a/inst/tests/test_delete.vertices.R b/tests/testthat/test_delete.vertices.R
similarity index 100%
rename from inst/tests/test_delete.vertices.R
rename to tests/testthat/test_delete.vertices.R
diff --git a/inst/tests/test_diameter.R b/tests/testthat/test_diameter.R
similarity index 100%
rename from inst/tests/test_diameter.R
rename to tests/testthat/test_diameter.R
diff --git a/inst/tests/test_dimSelect.R b/tests/testthat/test_dimSelect.R
similarity index 100%
rename from inst/tests/test_dimSelect.R
rename to tests/testthat/test_dimSelect.R
diff --git a/inst/tests/test_dominator.tree.R b/tests/testthat/test_dominator.tree.R
similarity index 100%
rename from inst/tests/test_dominator.tree.R
rename to tests/testthat/test_dominator.tree.R
diff --git a/inst/tests/test_dot.product.game.R b/tests/testthat/test_dot.product.game.R
similarity index 100%
rename from inst/tests/test_dot.product.game.R
rename to tests/testthat/test_dot.product.game.R
diff --git a/inst/tests/test_dyad.census.R b/tests/testthat/test_dyad.census.R
similarity index 100%
rename from inst/tests/test_dyad.census.R
rename to tests/testthat/test_dyad.census.R
diff --git a/inst/tests/test_edge.betweenness.R b/tests/testthat/test_edge.betweenness.R
similarity index 95%
rename from inst/tests/test_edge.betweenness.R
rename to tests/testthat/test_edge.betweenness.R
index c64d21d..573fe63 100644
--- a/inst/tests/test_edge.betweenness.R
+++ b/tests/testthat/test_edge.betweenness.R
@@ -19,7 +19,7 @@ test_that("edge_betweenness works", {
ebet <- edge_betweenness(kite)
bet2 <- sapply(1:vcount(kite), function(x) {
- ae <- E(kite)[ adj(x) ]
+ ae <- E(kite)[ .inc(x) ]
(sum(ebet[ae])-vcount(kite)+1) / 2
})
@@ -32,7 +32,7 @@ test_that("edge_betweenness works", {
bet <- betweenness(kite)
ebet <- edge_betweenness(kite)
bet2 <- sapply(1:vcount(kite), function(x) {
- ae <- E(kite)[ adj(x) ]
+ ae <- E(kite)[ .inc(x) ]
(sum(ebet[ae])-vcount(kite)+1) / 2
})
diff --git a/inst/tests/test_edge.betweenness.community.R b/tests/testthat/test_edge.betweenness.community.R
similarity index 100%
rename from inst/tests/test_edge.betweenness.community.R
rename to tests/testthat/test_edge.betweenness.community.R
diff --git a/inst/tests/test_edge.connectivity.R b/tests/testthat/test_edge.connectivity.R
similarity index 100%
rename from inst/tests/test_edge.connectivity.R
rename to tests/testthat/test_edge.connectivity.R
diff --git a/inst/tests/test_edgenames.R b/tests/testthat/test_edgenames.R
similarity index 100%
rename from inst/tests/test_edgenames.R
rename to tests/testthat/test_edgenames.R
diff --git a/inst/tests/test_evcent.R b/tests/testthat/test_evcent.R
similarity index 100%
rename from inst/tests/test_evcent.R
rename to tests/testthat/test_evcent.R
diff --git a/inst/tests/test_fartherst.nodes.R b/tests/testthat/test_fartherst.nodes.R
similarity index 100%
rename from inst/tests/test_fartherst.nodes.R
rename to tests/testthat/test_fartherst.nodes.R
diff --git a/inst/tests/test_fastgreedy.community.R b/tests/testthat/test_fastgreedy.community.R
similarity index 100%
rename from inst/tests/test_fastgreedy.community.R
rename to tests/testthat/test_fastgreedy.community.R
diff --git a/inst/tests/test_forestfire.R b/tests/testthat/test_forestfire.R
similarity index 100%
rename from inst/tests/test_forestfire.R
rename to tests/testthat/test_forestfire.R
diff --git a/inst/tests/test_get.adjacency.R b/tests/testthat/test_get.adjacency.R
similarity index 100%
rename from inst/tests/test_get.adjacency.R
rename to tests/testthat/test_get.adjacency.R
diff --git a/inst/tests/test_get.adjlist.R b/tests/testthat/test_get.adjlist.R
similarity index 93%
rename from inst/tests/test_get.adjlist.R
rename to tests/testthat/test_get.adjlist.R
index e1122a6..a0fb6d1 100644
--- a/inst/tests/test_get.adjlist.R
+++ b/tests/testthat/test_get.adjlist.R
@@ -17,7 +17,7 @@ test_that("as_adj_list works", {
el <- as_adj_edge_list(g)
for (i in 1:vcount(g)) {
- a <- E(g)[adj(i)]
+ a <- E(g)[.inc(i)]
expect_that(length(a), is_equivalent_to(length(el[[i]])))
expect_that(sort(el[[i]]), is_equivalent_to(sort(a)))
}
@@ -26,12 +26,12 @@ test_that("as_adj_list works", {
el1 <- as_adj_edge_list(g, mode="out")
el2 <- as_adj_edge_list(g, mode="in")
for (i in 1:vcount(g)) {
- a <- E(g)[from(i)]
+ a <- E(g)[.from(i)]
expect_that(length(a), is_equivalent_to(length(el1[[i]])))
expect_that(sort(el1[[i]]), is_equivalent_to(sort(a)))
}
for (i in 1:vcount(g)) {
- a <- E(g)[to(i)]
+ a <- E(g)[.to(i)]
expect_that(length(a), is_equivalent_to(length(el2[[i]])))
expect_that(sort(el2[[i]]), is_equivalent_to(sort(a)))
}
diff --git a/inst/tests/test_get.all.shortest.paths.R b/tests/testthat/test_get.all.shortest.paths.R
similarity index 100%
rename from inst/tests/test_get.all.shortest.paths.R
rename to tests/testthat/test_get.all.shortest.paths.R
diff --git a/inst/tests/test_get.diameter.R b/tests/testthat/test_get.diameter.R
similarity index 100%
rename from inst/tests/test_get.diameter.R
rename to tests/testthat/test_get.diameter.R
diff --git a/inst/tests/test_get.edge.R b/tests/testthat/test_get.edge.R
similarity index 100%
rename from inst/tests/test_get.edge.R
rename to tests/testthat/test_get.edge.R
diff --git a/inst/tests/test_get.edgelist.R b/tests/testthat/test_get.edgelist.R
similarity index 100%
rename from inst/tests/test_get.edgelist.R
rename to tests/testthat/test_get.edgelist.R
diff --git a/inst/tests/test_get.incidence.R b/tests/testthat/test_get.incidence.R
similarity index 100%
rename from inst/tests/test_get.incidence.R
rename to tests/testthat/test_get.incidence.R
diff --git a/inst/tests/test_get.shortest.paths.R b/tests/testthat/test_get.shortest.paths.R
similarity index 100%
rename from inst/tests/test_get.shortest.paths.R
rename to tests/testthat/test_get.shortest.paths.R
diff --git a/inst/tests/test_girth.R b/tests/testthat/test_girth.R
similarity index 100%
rename from inst/tests/test_girth.R
rename to tests/testthat/test_girth.R
diff --git a/inst/tests/test_graph.adhesion.R b/tests/testthat/test_graph.adhesion.R
similarity index 100%
rename from inst/tests/test_graph.adhesion.R
rename to tests/testthat/test_graph.adhesion.R
diff --git a/inst/tests/test_graph.adjacency.R b/tests/testthat/test_graph.adjacency.R
similarity index 100%
rename from inst/tests/test_graph.adjacency.R
rename to tests/testthat/test_graph.adjacency.R
diff --git a/inst/tests/test_graph.adjlist.R b/tests/testthat/test_graph.adjlist.R
similarity index 100%
rename from inst/tests/test_graph.adjlist.R
rename to tests/testthat/test_graph.adjlist.R
diff --git a/inst/tests/test_graph.atlas.R b/tests/testthat/test_graph.atlas.R
similarity index 100%
rename from inst/tests/test_graph.atlas.R
rename to tests/testthat/test_graph.atlas.R
diff --git a/inst/tests/test_graph.bfs.R b/tests/testthat/test_graph.bfs.R
similarity index 74%
rename from inst/tests/test_graph.bfs.R
rename to tests/testthat/test_graph.bfs.R
index 7299bc4..10734ef 100644
--- a/inst/tests/test_graph.bfs.R
+++ b/tests/testthat/test_graph.bfs.R
@@ -19,3 +19,13 @@ test_that("BFS works from multiple root vertices", {
equals(c(12,11,13,20,14,19,15,18,16,17,1,2,10,3,9,4,8,5,7,6)))
})
+
+test_that("issue 133", {
+
+ g <- graph_from_edgelist(matrix(c(1,2,2,3), ncol = 2, byrow = TRUE))
+
+ expect_equal(
+ bfs(g, 1, restricted = c(1, 2), unreachable = FALSE)$order,
+ V(g)[c(1, 2, NA_real_), na_ok = TRUE]
+ )
+})
diff --git a/inst/tests/test_graph.bipartite.R b/tests/testthat/test_graph.bipartite.R
similarity index 100%
rename from inst/tests/test_graph.bipartite.R
rename to tests/testthat/test_graph.bipartite.R
diff --git a/inst/tests/test_graph.complementer.R b/tests/testthat/test_graph.complementer.R
similarity index 100%
rename from inst/tests/test_graph.complementer.R
rename to tests/testthat/test_graph.complementer.R
diff --git a/inst/tests/test_graph.compose.R b/tests/testthat/test_graph.compose.R
similarity index 100%
rename from inst/tests/test_graph.compose.R
rename to tests/testthat/test_graph.compose.R
diff --git a/inst/tests/test_graph.coreness.R b/tests/testthat/test_graph.coreness.R
similarity index 100%
rename from inst/tests/test_graph.coreness.R
rename to tests/testthat/test_graph.coreness.R
diff --git a/inst/tests/test_graph.data.frame.R b/tests/testthat/test_graph.data.frame.R
similarity index 100%
rename from inst/tests/test_graph.data.frame.R
rename to tests/testthat/test_graph.data.frame.R
diff --git a/inst/tests/test_graph.de.bruijn.R b/tests/testthat/test_graph.de.bruijn.R
similarity index 100%
rename from inst/tests/test_graph.de.bruijn.R
rename to tests/testthat/test_graph.de.bruijn.R
diff --git a/inst/tests/test_graph.density.R b/tests/testthat/test_graph.density.R
similarity index 100%
rename from inst/tests/test_graph.density.R
rename to tests/testthat/test_graph.density.R
diff --git a/inst/tests/test_graph.edgelist.R b/tests/testthat/test_graph.edgelist.R
similarity index 100%
rename from inst/tests/test_graph.edgelist.R
rename to tests/testthat/test_graph.edgelist.R
diff --git a/inst/tests/test_graph.eigen.R b/tests/testthat/test_graph.eigen.R
similarity index 100%
rename from inst/tests/test_graph.eigen.R
rename to tests/testthat/test_graph.eigen.R
diff --git a/inst/tests/test_graph.formula.R b/tests/testthat/test_graph.formula.R
similarity index 100%
rename from inst/tests/test_graph.formula.R
rename to tests/testthat/test_graph.formula.R
diff --git a/inst/tests/test_graph.isoclass.R b/tests/testthat/test_graph.isoclass.R
similarity index 100%
rename from inst/tests/test_graph.isoclass.R
rename to tests/testthat/test_graph.isoclass.R
diff --git a/inst/tests/test_graph.kautz.R b/tests/testthat/test_graph.kautz.R
similarity index 100%
rename from inst/tests/test_graph.kautz.R
rename to tests/testthat/test_graph.kautz.R
diff --git a/inst/tests/test_graph.knn.R b/tests/testthat/test_graph.knn.R
similarity index 100%
rename from inst/tests/test_graph.knn.R
rename to tests/testthat/test_graph.knn.R
diff --git a/inst/tests/test_graph.maxflow.R b/tests/testthat/test_graph.maxflow.R
similarity index 100%
rename from inst/tests/test_graph.maxflow.R
rename to tests/testthat/test_graph.maxflow.R
diff --git a/inst/tests/test_graph.mincut.R b/tests/testthat/test_graph.mincut.R
similarity index 100%
rename from inst/tests/test_graph.mincut.R
rename to tests/testthat/test_graph.mincut.R
diff --git a/inst/tests/test_graph.subisomorphic.lad.R b/tests/testthat/test_graph.subisomorphic.lad.R
similarity index 100%
rename from inst/tests/test_graph.subisomorphic.lad.R
rename to tests/testthat/test_graph.subisomorphic.lad.R
diff --git a/inst/tests/test_graph.subisomorphic.vf2.R b/tests/testthat/test_graph.subisomorphic.vf2.R
similarity index 100%
rename from inst/tests/test_graph.subisomorphic.vf2.R
rename to tests/testthat/test_graph.subisomorphic.vf2.R
diff --git a/inst/tests/test_graphNEL.R b/tests/testthat/test_graphNEL.R
similarity index 91%
rename from inst/tests/test_graphNEL.R
rename to tests/testthat/test_graphNEL.R
index adc6f40..5678d27 100644
--- a/inst/tests/test_graphNEL.R
+++ b/tests/testthat/test_graphNEL.R
@@ -3,7 +3,8 @@ context("graphNEL conversion")
test_that("graphNEL conversion works", {
- library(igraph)
+ if (!requireNamespace("graph", quietly = TRUE)) skip("No graph package")
+
library(graph, warn.conflicts=FALSE)
g <- sample_gnp(100, 5/100)
diff --git a/inst/tests/test_graphlets.R b/tests/testthat/test_graphlets.R
similarity index 78%
rename from inst/tests/test_graphlets.R
rename to tests/testthat/test_graphlets.R
index e2bc82b..9b1a301 100644
--- a/inst/tests/test_graphlets.R
+++ b/tests/testthat/test_graphlets.R
@@ -1,39 +1,6 @@
context("Graphlets")
-test_that("Getting subcliques works", {
- library(igraph)
- set.seed(42*42)
- g <- sample_gnp(10, 4/10)
- E(g)$weight <- as.double(sample(1:10, ecount(g), replace=TRUE))
- ids <- 1:vcount(g)
-
- cl <- max_cliques(g)
- cl <- lapply(cl, "-", 1)[c(9, 2, 3, 10, 5, 7, 6, 1, 4, 8)]
-
- res <- .Call("R_igraph_subclique_next", g, E(g)$weight, ids, cl,
- PACKAGE="igraph")
-
- for (i in seq_along(res$graphs)) {
- V(res$graphs[[i]])$name <- res$ids[[i]]
- E(res$graphs[[i]])$weight <- res$weights[[i]]
- }
-
- expect_that(res$thr, equals(c(7,2,5,3,1,7,3,2,4,7)))
- expect_that(res$next_thr, equals(c(Inf, 4, 8, 8, Inf, 9, 5, 3, 5, Inf)))
- expect_that(res$weights, equals(list(numeric(), c(4,8), c(8,8), c(9,8),
- numeric(), c(9,9), c(7,7,9,10,5),
- c(7,3,4,5), c(5,7,5,9,10),
- numeric())))
- expect_that(res$ids, equals(list(integer(), c(5,9,10), c(1,9,10),
- c(1,8,9), integer(), c(3,7,6),
- c(3,6,5,4), c(3,5,10,2), c(2,5,3,4),
- integer())))
- expect_that(sapply(res$graphs, vcount), equals(sapply(res$ids, length)))
- expect_that(sapply(res$graphs, ecount),
- equals(sapply(res$weights, length)))
-})
-
sortgl <- function(x) {
cl <- lapply(x$cliques, sort)
n <- sapply(cl, length)
diff --git a/inst/tests/test_hrg.R b/tests/testthat/test_hrg.R
similarity index 100%
rename from inst/tests/test_hrg.R
rename to tests/testthat/test_hrg.R
diff --git a/inst/tests/test_hsbm.R b/tests/testthat/test_hsbm.R
similarity index 100%
rename from inst/tests/test_hsbm.R
rename to tests/testthat/test_hsbm.R
diff --git a/tests/testthat/test_igraph.options.R b/tests/testthat/test_igraph.options.R
new file mode 100644
index 0000000..374cecf
--- /dev/null
+++ b/tests/testthat/test_igraph.options.R
@@ -0,0 +1,45 @@
+
+context("igraph_options")
+
+test_that("igraph_options works", {
+
+ library(igraph)
+
+ igraph_options(verbose=TRUE)
+ expect_that(igraph_opt("verbose"), is_true())
+
+ igraph_options(verbose=FALSE)
+ expect_that(igraph_opt("verbose"), is_false())
+
+})
+
+test_that("we can restore old options", {
+
+ old_1 <- igraph_opt("sparsematrices")
+ old_2 <- igraph_opt("annotate.plot")
+
+ old <- igraph_options(sparsematrices = FALSE,
+ annotate.plot = TRUE)
+
+ expect_equal(igraph_opt("sparsematrices"), FALSE)
+ expect_equal(igraph_opt("annotate.plot"), TRUE)
+
+ igraph_options(old)
+
+ expect_equal(igraph_opt("sparsematrices"), old_1)
+ expect_equal(igraph_opt("annotate.plot"), old_2)
+
+})
+
+test_that("with_igraph_opt works", {
+
+ on.exit(try(igraph_options(old)), add = TRUE)
+ old <- igraph_options(sparsematrices = TRUE)
+
+ res <- with_igraph_opt(list(sparsematrices = FALSE),
+ make_ring(3)[])
+
+ expect_equal(igraph_opt("sparsematrices"), TRUE)
+ expect_equal(class(res), "matrix")
+
+})
diff --git a/inst/tests/test_independent.vertex.sets.R b/tests/testthat/test_independent.vertex.sets.R
similarity index 100%
rename from inst/tests/test_independent.vertex.sets.R
rename to tests/testthat/test_independent.vertex.sets.R
diff --git a/inst/tests/test_indexing.R b/tests/testthat/test_indexing.R
similarity index 100%
rename from inst/tests/test_indexing.R
rename to tests/testthat/test_indexing.R
diff --git a/inst/tests/test_indexing2.R b/tests/testthat/test_indexing2.R
similarity index 100%
rename from inst/tests/test_indexing2.R
rename to tests/testthat/test_indexing2.R
diff --git a/inst/tests/test_indexing3.R b/tests/testthat/test_indexing3.R
similarity index 100%
rename from inst/tests/test_indexing3.R
rename to tests/testthat/test_indexing3.R
diff --git a/inst/tests/test_is.bipartite.R b/tests/testthat/test_is.bipartite.R
similarity index 100%
rename from inst/tests/test_is.bipartite.R
rename to tests/testthat/test_is.bipartite.R
diff --git a/inst/tests/test_is.chordal.R b/tests/testthat/test_is.chordal.R
similarity index 100%
rename from inst/tests/test_is.chordal.R
rename to tests/testthat/test_is.chordal.R
diff --git a/inst/tests/test_iterators.R b/tests/testthat/test_iterators.R
similarity index 100%
rename from inst/tests/test_iterators.R
rename to tests/testthat/test_iterators.R
diff --git a/inst/tests/test_label.propagation.community.R b/tests/testthat/test_label.propagation.community.R
similarity index 100%
rename from inst/tests/test_label.propagation.community.R
rename to tests/testthat/test_label.propagation.community.R
diff --git a/inst/tests/test_laplacian.spectral.embedding.R b/tests/testthat/test_laplacian.spectral.embedding.R
similarity index 100%
rename from inst/tests/test_laplacian.spectral.embedding.R
rename to tests/testthat/test_laplacian.spectral.embedding.R
diff --git a/inst/tests/test_largest.cliques.R b/tests/testthat/test_largest.cliques.R
similarity index 100%
rename from inst/tests/test_largest.cliques.R
rename to tests/testthat/test_largest.cliques.R
diff --git a/inst/tests/test_largest.independent.vertex.sets.R b/tests/testthat/test_largest.independent.vertex.sets.R
similarity index 100%
rename from inst/tests/test_largest.independent.vertex.sets.R
rename to tests/testthat/test_largest.independent.vertex.sets.R
diff --git a/inst/tests/test_layout.fr.R b/tests/testthat/test_layout.fr.R
similarity index 95%
rename from inst/tests/test_layout.fr.R
rename to tests/testthat/test_layout.fr.R
index 9b8b988..4b3318a 100644
--- a/inst/tests/test_layout.fr.R
+++ b/tests/testthat/test_layout.fr.R
@@ -3,6 +3,8 @@ context("Fruchterman-Reingold layout")
test_that("", {
+ skip_on_os("solaris")
+
library(igraph)
set.seed(42)
g <- make_ring(10)
diff --git a/inst/tests/test_layout.kk.R b/tests/testthat/test_layout.kk.R
similarity index 100%
rename from inst/tests/test_layout.kk.R
rename to tests/testthat/test_layout.kk.R
diff --git a/inst/tests/test_layout.mds.R b/tests/testthat/test_layout.mds.R
similarity index 100%
rename from inst/tests/test_layout.mds.R
rename to tests/testthat/test_layout.mds.R
diff --git a/inst/tests/test_layout.merge.R b/tests/testthat/test_layout.merge.R
similarity index 100%
rename from inst/tests/test_layout.merge.R
rename to tests/testthat/test_layout.merge.R
diff --git a/inst/tests/test_leading.eigenvector.community.R b/tests/testthat/test_leading.eigenvector.community.R
similarity index 100%
rename from inst/tests/test_leading.eigenvector.community.R
rename to tests/testthat/test_leading.eigenvector.community.R
diff --git a/inst/tests/test_maximal_cliques.R b/tests/testthat/test_maximal_cliques.R
similarity index 100%
rename from inst/tests/test_maximal_cliques.R
rename to tests/testthat/test_maximal_cliques.R
diff --git a/inst/tests/test_minimal.st.separators.R b/tests/testthat/test_minimal.st.separators.R
similarity index 100%
rename from inst/tests/test_minimal.st.separators.R
rename to tests/testthat/test_minimal.st.separators.R
diff --git a/inst/tests/test_minimum.size.separators.R b/tests/testthat/test_minimum.size.separators.R
similarity index 100%
rename from inst/tests/test_minimum.size.separators.R
rename to tests/testthat/test_minimum.size.separators.R
diff --git a/inst/tests/test_modularity_matrix.R b/tests/testthat/test_modularity_matrix.R
similarity index 100%
rename from inst/tests/test_modularity_matrix.R
rename to tests/testthat/test_modularity_matrix.R
diff --git a/inst/tests/test_motifs.R b/tests/testthat/test_motifs.R
similarity index 100%
rename from inst/tests/test_motifs.R
rename to tests/testthat/test_motifs.R
diff --git a/inst/tests/test_multilevel.community.R b/tests/testthat/test_multilevel.community.R
similarity index 100%
rename from inst/tests/test_multilevel.community.R
rename to tests/testthat/test_multilevel.community.R
diff --git a/inst/tests/test_neighborhood.R b/tests/testthat/test_neighborhood.R
similarity index 100%
rename from inst/tests/test_neighborhood.R
rename to tests/testthat/test_neighborhood.R
diff --git a/inst/tests/test_neighbors.R b/tests/testthat/test_neighbors.R
similarity index 100%
rename from inst/tests/test_neighbors.R
rename to tests/testthat/test_neighbors.R
diff --git a/inst/tests/test_operators.R b/tests/testthat/test_operators.R
similarity index 100%
rename from inst/tests/test_operators.R
rename to tests/testthat/test_operators.R
diff --git a/inst/tests/test_operators3.R b/tests/testthat/test_operators3.R
similarity index 100%
rename from inst/tests/test_operators3.R
rename to tests/testthat/test_operators3.R
diff --git a/inst/tests/test_operators4.R b/tests/testthat/test_operators4.R
similarity index 100%
rename from inst/tests/test_operators4.R
rename to tests/testthat/test_operators4.R
diff --git a/inst/tests/test_optimal.community.R b/tests/testthat/test_optimal.community.R
similarity index 100%
rename from inst/tests/test_optimal.community.R
rename to tests/testthat/test_optimal.community.R
diff --git a/inst/tests/test_pajek.R b/tests/testthat/test_pajek.R
similarity index 100%
rename from inst/tests/test_pajek.R
rename to tests/testthat/test_pajek.R
diff --git a/inst/tests/test_print.R b/tests/testthat/test_print.R
similarity index 71%
rename from inst/tests/test_print.R
rename to tests/testthat/test_print.R
index 476191e..f1fffd9 100644
--- a/inst/tests/test_print.R
+++ b/tests/testthat/test_print.R
@@ -9,16 +9,16 @@ test_that("print.igraph works", {
g <- make_ring(5)
expect_that(summary(g), prints_text("attr:.* name[ ]*[(]g/c[)]"))
- expect_that(g, prints_text("attr:.* name[ ]*[(]g/c[)]"))
- expect_that(g, prints_text("1--2"))
+ expect_that(print(g), prints_text("attr:.* name[ ]*[(]g/c[)]"))
+ expect_that(print(g), prints_text("1--2"))
V(g)$name <- letters[1:vcount(g)]
expect_that(summary(g), prints_text("name[ ]*[(]v/c[)]"))
- expect_that(g, prints_text("a--b"))
+ expect_that(print(g), prints_text("a--b"))
set.seed(42)
E(g)$weight <- sample(ecount(g))
- expect_that(summary(g), prints_text("weight[\n ]*[(]e/n[)]"))
+ expect_that(summary(g), prints_text("weight[\n |]*[(]e/n[)]"))
g$name <- "A ring"
expect_that(summary(g), prints_text("A ring"))
@@ -27,26 +27,26 @@ test_that("print.igraph works", {
set.seed(42)
g2 <- sample_gnp(13, p=0.6, directed=TRUE)
- expect_that(g2, prints_text("1 ->"))
+ expect_that(print(g2), prints_text("1 ->"))
g3 <- sample_gnp(20, p=0.8)
- expect_that(g3, prints_text("1 --"))
+ expect_that(print(g3), prints_text("1 --"))
g4 <- make_star(100)
- expect_that(g4, prints_text("2->1"))
+ expect_that(print(g4), prints_text("2->1"))
g5 <- make_star(100, mode="out")
- expect_that(g5, prints_text("1->"))
+ expect_that(print(g5), prints_text("1->"))
g6 <- sample_pa(100, m=6, directed=FALSE)
- expect_that(g6, prints_text(" "))
+ expect_that(print(g6), prints_text(" "))
kite <- make_empty_graph(directed=FALSE) + LETTERS[1:10]
kite <- kite + edges('A','B','A','C','A','D','A','F',
'B','D','B','E','B','G', 'C','D','C','F',
'D','E','D','F','D','G', 'E','G',
'F','G','F','H', 'G','H', 'H','I','I','J')
- expect_that(kite, prints_text("A -- "))
+ expect_that(print(kite), prints_text("A -- "))
igraph_options(print.full=FALSE)
})
diff --git a/inst/tests/test_psumtree.R b/tests/testthat/test_psumtree.R
similarity index 81%
rename from inst/tests/test_psumtree.R
rename to tests/testthat/test_psumtree.R
index 28b3d53..6e1fbc8 100644
--- a/inst/tests/test_psumtree.R
+++ b/tests/testthat/test_psumtree.R
@@ -7,8 +7,7 @@ test_that("Prefix sum tree works", {
set.seed(42)
mysample <- function(x, size, prob=NULL) {
if (!is.null(prob)) { prob <- as.numeric(prob) }
- .Call("R_igraph_psumtree_draw", as.integer(x), as.integer(size),
- prob, PACKAGE="igraph")
+ .Call(C_R_igraph_psumtree_draw, as.integer(x), as.integer(size), prob)
}
S <- mysample(100, 10000)
expect_that(range(table(S)), equals(c(69, 129)))
diff --git a/inst/tests/test_sample.R b/tests/testthat/test_sample.R
similarity index 100%
rename from inst/tests/test_sample.R
rename to tests/testthat/test_sample.R
diff --git a/inst/tests/test_sbm.game.R b/tests/testthat/test_sbm.game.R
similarity index 100%
rename from inst/tests/test_sbm.game.R
rename to tests/testthat/test_sbm.game.R
diff --git a/inst/tests/test_scan.R b/tests/testthat/test_scan.R
similarity index 100%
rename from inst/tests/test_scan.R
rename to tests/testthat/test_scan.R
diff --git a/inst/tests/test_sdf.R b/tests/testthat/test_sdf.R
similarity index 100%
rename from inst/tests/test_sdf.R
rename to tests/testthat/test_sdf.R
diff --git a/inst/tests/test_sgm.R b/tests/testthat/test_sgm.R
similarity index 100%
rename from inst/tests/test_sgm.R
rename to tests/testthat/test_sgm.R
diff --git a/inst/tests/test_sir.R b/tests/testthat/test_sir.R
similarity index 94%
rename from inst/tests/test_sir.R
rename to tests/testthat/test_sir.R
index 9c34453..bff59c2 100644
--- a/inst/tests/test_sir.R
+++ b/tests/testthat/test_sir.R
@@ -3,6 +3,8 @@ context("SIR epidemics model on a network")
test_that("SIR works", {
+ skip_on_os("solaris")
+
set.seed(42)
library(digest)
library(igraph)
diff --git a/inst/tests/test_sphere.R b/tests/testthat/test_sphere.R
similarity index 88%
rename from inst/tests/test_sphere.R
rename to tests/testthat/test_sphere.R
index 77dac22..27b9e58 100644
--- a/inst/tests/test_sphere.R
+++ b/tests/testthat/test_sphere.R
@@ -16,7 +16,6 @@ test_that("Sampling sphere surface works", {
s3 <- sample_sphere_surface(2, 100, radius=1/2, positive=TRUE)
expect_that(sqrt(colSums(s3^2)), equals(rep(1/2, 100)))
expect_that(all(s3 >= 0), is_true())
- expect_that(digest(s3), equals("b86e4a0dc877e3540fb8a88b4be6a781"))
})
@@ -35,6 +34,5 @@ test_that("Sampling sphere volume works", {
s3 <- sample_sphere_volume(2, 100, radius=1/2, positive=TRUE)
expect_that(all(sqrt(colSums(s3^2)) < 1/2), is_true())
expect_that(all(s3 >= 0), is_true())
- expect_that(digest(s3), equals("9fa27a0edba7bbb1787d507cbbbf84b7"))
})
diff --git a/inst/tests/test_transitivity.R b/tests/testthat/test_transitivity.R
similarity index 87%
rename from inst/tests/test_transitivity.R
rename to tests/testthat/test_transitivity.R
index 267e527..13bd397 100644
--- a/inst/tests/test_transitivity.R
+++ b/tests/testthat/test_transitivity.R
@@ -18,8 +18,8 @@ test_that("transitivity works", {
.Names = c("Min.", "1st Qu.", "Median", "Mean",
"3rd Qu.", "Max."),
class = c("summaryDefault", "table"))
- expect_that(summary(t3), equals(est3))
- expect_that(summary(t33), equals(est3))
+ expect_that(summary(t3), equals(est3, tolerance = 0.001))
+ expect_that(summary(t33), equals(est3, tolerance = 0.001))
})
test_that("no integer overflow", {
diff --git a/inst/tests/test_triangles.R b/tests/testthat/test_triangles.R
similarity index 100%
rename from inst/tests/test_triangles.R
rename to tests/testthat/test_triangles.R
diff --git a/inst/tests/test_unfold.tree.R b/tests/testthat/test_unfold.tree.R
similarity index 100%
rename from inst/tests/test_unfold.tree.R
rename to tests/testthat/test_unfold.tree.R
diff --git a/inst/tests/test_walktrap.community.R b/tests/testthat/test_walktrap.community.R
similarity index 100%
rename from inst/tests/test_walktrap.community.R
rename to tests/testthat/test_walktrap.community.R
diff --git a/inst/tests/test_watts.strogatz.game.R b/tests/testthat/test_watts.strogatz.game.R
similarity index 100%
rename from inst/tests/test_watts.strogatz.game.R
rename to tests/testthat/test_watts.strogatz.game.R
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/r-cran-igraph.git
More information about the debian-med-commit
mailing list