From 01bb444399b148880f73eeffd3ae914906f3bafb Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sun, 18 Jan 2026 15:53:48 +0530 Subject: [PATCH 1/5] Create bib file, modify toml, make.jl files to include DocumenterCitations as a dependency --- docs/Project.toml | 1 + docs/make.jl | 6 +++++- docs/src/references.bib | 0 3 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 docs/src/references.bib diff --git a/docs/Project.toml b/docs/Project.toml index dea978a5e..826aeeb94 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,7 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" [compat] Documenter = "1" diff --git a/docs/make.jl b/docs/make.jl index 8a6b91839..d23eba92c 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -1,4 +1,5 @@ using Documenter +using DocumenterCitations using Graphs # same for contributing and license @@ -85,7 +86,10 @@ pages = [ ] for (section_name, section_files) in pages_files ] -makedocs(; +bib = CitationBibliography(joinpath(@__DIR__,"src/references.bib"),style=:authoryear) + +makedocs( + plugins=[bib], modules=[Graphs], format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", diff --git a/docs/src/references.bib b/docs/src/references.bib new file mode 100644 index 000000000..e69de29bb From af82536183a2f7cb87702519e66e99cdb3fdab41 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sun, 18 Jan 2026 16:00:44 +0530 Subject: [PATCH 2/5] Add citations.css for optimal rendering of bibliography --- docs/make.jl | 2 +- docs/src/assets/citations.css | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 docs/src/assets/citations.css diff --git a/docs/make.jl b/docs/make.jl index d23eba92c..17c7d4cda 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -93,7 +93,7 @@ makedocs( modules=[Graphs], format=Documenter.HTML(; prettyurls=get(ENV, "CI", "false") == "true", - assets=String[], + assets=String["assets/citations.css"], collapselevel=1, canonical="https://gdalle.github.io/Graphs.jl", ), diff --git a/docs/src/assets/citations.css b/docs/src/assets/citations.css new file mode 100644 index 000000000..687d0a5d2 --- /dev/null +++ b/docs/src/assets/citations.css @@ -0,0 +1,17 @@ +.citation dl { + display: grid; + grid-template-columns: max-content auto; } +.citation dt { + grid-column-start: 1; } +.citation dd { + grid-column-start: 2; + margin-bottom: 0.75em; } +.citation ul { + padding: 0 0 2.25em 0; + margin: 0; + list-style: none !important;} +.citation ul li { + text-indent: -2.25em; + margin: 0.33em 0.5em 0.5em 2.25em;} +.citation ol li { + padding-left:0.75em;} \ No newline at end of file From 50b27057563ad3cd046aa7cf1c04785dc8147119 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sun, 18 Jan 2026 18:08:18 +0530 Subject: [PATCH 3/5] Add citations in docstring of relevant source files --- Project.toml | 2 ++ docs/Project.toml | 1 - docs/src/algorithms/centrality.md | 5 +++ docs/src/references.bib | 51 +++++++++++++++++++++++++++++++ src/centrality/eigenvector.jl | 7 ++--- src/centrality/radiality.jl | 2 +- src/centrality/stress.jl | 4 +-- 7 files changed, 63 insertions(+), 9 deletions(-) diff --git a/Project.toml b/Project.toml index 59e8596d9..09dc49271 100644 --- a/Project.toml +++ b/Project.toml @@ -5,6 +5,8 @@ version = "1.13.3" [deps] ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d" DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" +Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" +DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" Inflate = "d25df0c9-e2be-5dd7-82c8-3ad0b3e990b9" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" diff --git a/docs/Project.toml b/docs/Project.toml index 826aeeb94..dea978a5e 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,7 +1,6 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" -DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" [compat] Documenter = "1" diff --git a/docs/src/algorithms/centrality.md b/docs/src/algorithms/centrality.md index 9f61819b1..6f366efbb 100644 --- a/docs/src/algorithms/centrality.md +++ b/docs/src/algorithms/centrality.md @@ -24,3 +24,8 @@ Pages = [ ] ``` + +## References + +```@bibliography +``` diff --git a/docs/src/references.bib b/docs/src/references.bib index e69de29bb..ee83a8e19 100644 --- a/docs/src/references.bib +++ b/docs/src/references.bib @@ -0,0 +1,51 @@ +@article{brandes2001faster, + title={A faster algorithm for betweenness centrality}, + author={Brandes, Ulrik}, + journal={Journal of mathematical sociology}, + volume={25}, + number={2}, + pages={163--177}, + year={2001}, + publisher={Taylor \& Francis} +} + +@article{barabasi2004network, + title={Network biology: understanding the cell's functional organization}, + author={Barabasi, Albert-Laszlo and Oltvai, Zoltan N}, + journal={Nature reviews genetics}, + volume={5}, + number={2}, + pages={101--113}, + year={2004}, + publisher={Nature Publishing Group UK London} +} + +@article{shimbel1953structural, + title={Structural parameters of communication networks}, + author={Shimbel, Alfonso}, + journal={The bulletin of mathematical biophysics}, + volume={15}, + number={4}, + pages={501--507}, + year={1953}, + publisher={Springer} +} + +@article{bonacich1987power, + title={Power and centrality: A family of measures}, + author={Bonacich, Phillip}, + journal={American journal of sociology}, + volume={92}, + number={5}, + pages={1170--1182}, + year={1987}, + publisher={University of Chicago Press} +} + +@misc{datta2012book, + title={Book Review: “Networks: An Introduction”, by Mark EJ Newman, Oxford University Press, 2010; ISBN: 978-0-19-920665-0 (Hardback)}, + author={Datta, Sujit S}, + year={2012}, + publisher={Springer} +} + diff --git a/src/centrality/eigenvector.jl b/src/centrality/eigenvector.jl index 3639ca633..63442fc39 100644 --- a/src/centrality/eigenvector.jl +++ b/src/centrality/eigenvector.jl @@ -18,11 +18,8 @@ eigenvector of the adjacency matrix \$\\mathbf{A}\$. ### References -- Phillip Bonacich: Power and Centrality: A Family of Measures. - American Journal of Sociology 92(5):1170–1182, 1986 - http://www.leonidzhukov.net/hse/2014/socialnetworks/papers/Bonacich-Centrality.pdf -- Mark E. J. Newman: Networks: An Introduction. - Oxford University Press, USA, 2010, pp. 169. +- [bonacich1987power](@cite) +- [datta2012book](@cite) """ function eigenvector_centrality(g::AbstractGraph) return abs.(vec(eigs(adjacency_matrix(g); which=LM(), nev=1)[2]))::Vector{Float64} diff --git a/src/centrality/radiality.jl b/src/centrality/radiality.jl index d1b77e26d..989c53f3c 100644 --- a/src/centrality/radiality.jl +++ b/src/centrality/radiality.jl @@ -14,7 +14,7 @@ where ``D_g`` is the diameter of the graph and ``d_{u,v}`` is the length of the shortest path from ``u`` to ``v``. ### References -- Brandes, U.: A faster algorithm for betweenness centrality. J Math Sociol 25 (2001) 163-177 +- [brandes2001faster](@cite) # Examples ```jldoctest diff --git a/src/centrality/stress.jl b/src/centrality/stress.jl index 0ca728544..632ce90fe 100644 --- a/src/centrality/stress.jl +++ b/src/centrality/stress.jl @@ -9,8 +9,8 @@ vertices. Return a vector representing the centrality calculated for each node i The stress centrality of a vertex ``n`` is defined as the number of shortest paths passing through ``n``. ### References -- Barabási, A.L., Oltvai, Z.N.: Network biology: understanding the cell's functional organization. Nat Rev Genet 5 (2004) 101-113 -- Shimbel, A.: Structural parameters of communication networks. Bull Math Biophys 15 (1953) 501-507. +- [barabasi2004network](@cite) +- [shimbel1953structural](@cite) # Examples ```jldoctest From 3bd81c3a86c980c5c549d96f61d696d72e7b0635 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sun, 18 Jan 2026 18:38:03 +0530 Subject: [PATCH 4/5] Add DocumenterCitations as a dep in docs/Project.toml --- docs/Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Project.toml b/docs/Project.toml index dea978a5e..826aeeb94 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -1,6 +1,7 @@ [deps] Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6" +DocumenterCitations = "daee34ce-89f3-4625-b898-19384cb65244" [compat] Documenter = "1" From 9f328ced538a5ecb1f88caaeeeadf571b4c710b0 Mon Sep 17 00:00:00 2001 From: Hemant Kumar Date: Sun, 18 Jan 2026 18:53:29 +0530 Subject: [PATCH 5/5] Fix formatting issue --- docs/make.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index 17c7d4cda..daa908ab1 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -86,9 +86,9 @@ pages = [ ] for (section_name, section_files) in pages_files ] -bib = CitationBibliography(joinpath(@__DIR__,"src/references.bib"),style=:authoryear) +bib = CitationBibliography(joinpath(@__DIR__, "src/references.bib"); style=:authoryear) -makedocs( +makedocs(; plugins=[bib], modules=[Graphs], format=Documenter.HTML(;