Skip to content

Commit

Permalink
Internal documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
scheinerman committed Sep 5, 2022
1 parent 95504de commit d4bae24
Show file tree
Hide file tree
Showing 24 changed files with 79 additions and 72 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "SimpleGraphs"
uuid = "55797a34-41de-5266-9ec1-32ac4eb504d3"
version = "0.8.2"
version = "0.8.3"

[deps]
AbstractLattices = "398f06c4-4d28-53ec-89ca-5b2656b7603d"
Expand Down
4 changes: 2 additions & 2 deletions extras/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To save a table of trees to a file (to later recall with `load_trees_table`) use

For example, here are the degree sequences of all distinct trees with 6 vertices:

```julia
```
julia> include("distinct_trees.jl");
julia> TT = build_trees_table(6); # Information output omitted
Expand All @@ -81,7 +81,7 @@ julia> for T in TT[6]

Aubrey de Grey created a unit distance graph with chromatic number 5. This graph can be seen using the function `deGrey` in the file `deGrey.jl`.

```julia
```
julia> include("deGrey.jl")
deGrey
Expand Down
12 changes: 6 additions & 6 deletions extras/distinct_trees.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const DEFAULT_FILE_NAME = "tree_codes.jl"
Create a new table of distinct trees on 1 and 2 vertices.
"""
function init_trees_table()
TT = Dict{Int,Vector{SimpleGraph{Int}}}()
TT = Dict{Int,Vector{UG{Int}}}()

TT[1] = [IntGraph(1)]
T = IntGraph(2)
Expand All @@ -23,7 +23,7 @@ end
check_in(G,S)
See if the set `S` contains a graph isomorphic to `G`. Return `true` if so.
"""
function check_in(G::SimpleGraph{Int}, S::Set{SimpleGraph{Int}})
function check_in(G::UG{Int}, S::Set{UG{Int}})
if isempty(S)
return false
end
Expand All @@ -40,9 +40,9 @@ end
Given a table of distinct trees up to size `n`, extend that table to include
all distinct trees of size `n+1`.
"""
function extend_trees_table!(TT::Dict{Int,Vector{SimpleGraph{Int}}})::Nothing
function extend_trees_table!(TT::Dict{Int,Vector{UG{Int}}})::Nothing
n = maximum(keys(TT))
outset = Set{SimpleGraph{Int}}() # set of trees with n+1 vertices
outset = Set{UG{Int}}() # set of trees with n+1 vertices
for T TT[n]
for w = 1:n
X = deepcopy(T)
Expand Down Expand Up @@ -74,7 +74,7 @@ end
Given a table of distinct trees, convert that into a table of Prufer codes.
This is used by `save_trees_table` and not useful to be called directly.
"""
function create_codes_table(TT::Dict{Int64,Vector{SimpleGraph{Int}}})
function create_codes_table(TT::Dict{Int64,Vector{UG{Int}}})
codes = Dict{Int64,Vector{Vector{Int}}}()
codes[2] = [Int[]]
for n = 3:maximum(keys(TT))
Expand All @@ -89,7 +89,7 @@ Save a trees table into a file specified by `filename`.
If the file name is omitted, use `codes.jl`.
"""
function save_trees_table(
TT::Dict{Int64,Vector{SimpleGraph{Int}}},
TT::Dict{Int64,Vector{UG{Int}}},
filename::String = DEFAULT_FILE_NAME,
)
outfile = open(filename, "w")
Expand Down
2 changes: 1 addition & 1 deletion src/SimpleGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using RingLists
import AbstractLattices: dist,

"""
`AbstractSimpleGraph` is a parent class for `SimpleGraph` and `SimpleDigraph`.
`AbstractSimpleGraph` is a parent class for `UndirectedGraph` and `DirectedGraph`.
"""
abstract type AbstractSimpleGraph end
export AbstractSimpleGraph
Expand Down
4 changes: 2 additions & 2 deletions src/bisect.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export bisect, cross_edges

"""
`bisect(G::SimpleGraph)` partitions the vertex set of `G` using the
`bisect(G::UndirectedGraph)` partitions the vertex set of `G` using the
eigenvector associated with the second smallest eigenvalue of the
graph's Laplacian matrix (called `x` below).
Expand Down Expand Up @@ -96,7 +96,7 @@ end
# import IterTools.product

"""
`cross_edges(G::SimpleGraph,A,B)` returns the set of edges of `G` with
`cross_edges(G::UndirectedGraph,A,B)` returns the set of edges of `G` with
one end in `A` and one end in `B`. Here `A` and `B` are collections
of vertices of `G`.
"""
Expand Down
10 changes: 7 additions & 3 deletions src/d_simple_core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export in_neighbors, out_neighbors, simplify, vertex_split
export is_strongly_connected

"""
`SimpleDigraph()` creates a new directed graph with vertices of `Any`
`DirectedGraph()` creates a new directed graph with vertices of `Any`
type. This can be restricted to vertics of type `T` with
`SimpleDigraph{T}()`.
`DirectedGraph{T}()`.
"""
mutable struct DirectedGraph{T} <: AbstractSimpleGraph
V::Set{T} # vertex set of this graph
Expand All @@ -24,6 +24,10 @@ mutable struct DirectedGraph{T} <: AbstractSimpleGraph
end
end

"""
DG
Abbreviation for `DirectedGraph`.
"""
const DG = DirectedGraph
export DG

Expand Down Expand Up @@ -280,7 +284,7 @@ end
# directions (and loops)

"""
`simplify(G::SimpleDigraph)` converts a directed graph into a `SimpleGraph`
`simplify(G::DirectedGraph)` converts a directed graph into an `UndirectedGraph`
by removing directions and loops.
"""
function simplify(D::DirectedGraph{T}) where {T}
Expand Down
2 changes: 1 addition & 1 deletion src/embedding/distxy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ end
`demo_distxy(G,tol=1e-3)` presents an animation showing the evolving
drawing found by `distxy!`.
"""
function demo_distxy(G::SimpleGraph = BuckyBall(), tol = 1e-3)
function demo_distxy(G::UndirectedGraph = BuckyBall(), tol = 1e-3)
return demo_distxy(GraphEmbedding(G), tol)
end

Expand Down
4 changes: 2 additions & 2 deletions src/embedding/geogebra.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export geogebra

"""
`geogebra(G,file_name)` takes a `SimpleGraph` and writes out a
`geogebra(G,file_name)` takes a `UndirectedGraph` and writes out a
script to produce a drawing of this graph in GeoGebra.
Here is the secret sauce to make this work.
Expand Down Expand Up @@ -34,7 +34,7 @@ named parameters as follows:
default is `3`.
"""
function geogebra(
G::SimpleGraph,
G::UndirectedGraph,
file_name::String = "geogebra.txt";
vertex_labels::Bool = false,
vertex_color::String = "black",
Expand Down
6 changes: 3 additions & 3 deletions src/embedding/getset.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getxy(G::UndirectedGraph, v)
end

"""
`hasxy(G::SimpleGraph)` returns `true` if an embedding has been
`hasxy(G::UndirectedGraph)` returns `true` if an embedding has been
given to this graph.
"""
hasxy(G::UndirectedGraph)::Bool = cache_check(G, :xy)
Expand All @@ -36,7 +36,7 @@ function get_line_color(G::UndirectedGraph)
end

"""
`set_line_color(G::SimpleGraph, hue=:black)` sets the color of the graph's
`set_line_color(G::UndirectedGraph, hue=:black)` sets the color of the graph's
edges and vertex boundaries.
"""
function set_line_color(G::UndirectedGraph, hue = :black)
Expand Down Expand Up @@ -85,7 +85,7 @@ set_vertex_color(G::UndirectedGraph) = set_vertex_color(G, :white)


"""
`set_vertex_color(G::SimpleGraph, d::Dict, palette)` where `d` is a dictionary
`set_vertex_color(G::UndirectedGraph, d::Dict, palette)` where `d` is a dictionary
mapping vertices to integers and `palette` is a list of colors.
Convert a mapping of vertices to integers into colors for the vertices.
Expand Down
2 changes: 1 addition & 1 deletion src/embedding/graffle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ end


"""
`graffle(G::SimpleGraph, filename="julia.graffle",rad=9)` creates
`graffle(G::UndirectedGraph, filename="julia.graffle", rad=9)` creates
an OmniGraffle document of this drawing.
* `G` is the graph
Expand Down
2 changes: 1 addition & 1 deletion src/embedding/spectral.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function _spectral(G::UndirectedGraph, xcol::Int = 2, ycol::Int = 3)
end

"""
_normalized_spectral(G::SimpleGraph, xcol::Int = 2, ycol::Int = 3)
_normalized_spectral(G::UndirectedGraph, xcol::Int = 2, ycol::Int = 3)
Same as `_spectral`, but use the normalized Laplacian matrix.
"""
function _normalized_spectral(G::UndirectedGraph, xcol::Int = 2, ycol::Int = 3)
Expand Down
4 changes: 2 additions & 2 deletions src/embedding/tutte.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# export tutte

"""
`tutte(G::SimpleGraph, outside)` gives `G` a Tutte embedding in which
`tutte(G::UndirectedGraph, outside)` gives `G` a Tutte embedding in which
the list of vertices in `outside` form the outer boundary. The graph
should be connected (ideally, 3-connected) and, if planar and `outside`
defines a face, the embedding will be crossing free.
`tutte(G::SimpleGraph)` assumes `G` has a rotation system in which case a
`tutte(G::UndirectedGraph)` assumes `G` has a rotation system in which case a
largest face will be selected to be `outside`.
"""
function _tutte(G::UndirectedGraph{T}, outside::Vector{T}) where {T}
Expand Down
4 changes: 2 additions & 2 deletions src/hyper/graph.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
`SimpleGraph(H::HG)` demotes a hypergraph to
`UndirectedGraph(H::HG)` demotes a hypergraph to
a simple graph.
"""
function UndirectedGraph(H::HG{T})::UndirectedGraph{T} where {T}
Expand Down Expand Up @@ -34,7 +34,7 @@ end
`HG{T}()` creates a new hypergraph in which vertices have
type `T`. **Warning**: Do not use `T=Any`.
`HG(G::SimpleGraph)` converts a graph to
`HG(G::UndirectedGraph)` converts a graph to
the equivalent two-uniform hypergraph.
"""
function HG(G::UndirectedGraph{T}) where {T}
Expand Down
3 changes: 1 addition & 2 deletions src/indep_poly.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export indep_poly

"""
`indep_poly(G)` returns the independence polynomial of the
`SimpleGraph` `G`.
`indep_poly(G)` returns the independence polynomial of the `UndirectedGraph` `G`.
"""
function indep_poly(G::UndirectedGraph, cache_flag::Bool = true)
if cache_flag && cache_check(G, :indep_poly)
Expand Down
2 changes: 1 addition & 1 deletion src/matching_poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export matching_poly

"""
`matching_poly(G)` returns the matching polynomial of the
`SimpleGraph` `G`.
`UndirectedGraph` `G`.
"""
function matching_poly(G::UndirectedGraph, cache_flag::Bool = true)
if cache_flag && cache_check(G, :matching_poly)
Expand Down
8 changes: 4 additions & 4 deletions src/platonic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function add_edge_matrix!(G::UndirectedGraph, edges::Array{Int,2})
end

"""
`Tetrahedron()` creates the tetrahedron `SimpleGraph`.
`Tetrahedron()` creates the tetrahedron graph.
"""
function Tetrahedron()
G = Wheel(4)
Expand All @@ -19,7 +19,7 @@ function Tetrahedron()
end

"""
`Dodecahedron()` creates the dodecahedron `SimpleGraph`.
`Dodecahedron()` creates the dodecahedron graph.
"""
function Dodecahedron()
G = IntGraph()
Expand Down Expand Up @@ -63,7 +63,7 @@ function Dodecahedron()
end

"""
`Icosahedron()` creates the icosahedron `SimpleGraph`.
`Icosahedron()` creates the icosahedron graph.
"""
function Icosahedron()
G = IntGraph()
Expand Down Expand Up @@ -107,7 +107,7 @@ function Icosahedron()
end

"""
`Octahedron()` creates the octaahedron `SimpleGraph`.
`Octahedron()` creates the octaahedron graph.
"""
function Octahedron()
G = Complete([2, 2, 2])
Expand Down
8 changes: 4 additions & 4 deletions src/prufer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export prufer_code, is_tree, prufer_restore

"""
is_tree(G)
Determines if the `SimpleGraph` is a tree.
Determines if the `UndirectedGraph` is a tree.
"""
function is_tree(G::UndirectedGraph)
return is_connected(G) && (NE(G) == NV(G) - 1)
Expand All @@ -11,7 +11,7 @@ end

"""
lowest_leaf(G)
Return the leaf of the `SimpleGraph` with the smallest label.
Return the leaf of the `UndirectedGraph` with the smallest label.
"""
function lowest_leaf(G::UndirectedGraph)
leaves = [v for v G.V if deg(G, v) == 1]
Expand All @@ -20,7 +20,7 @@ end


"""
lowest_leaf_neighbor(G::SimpleGraph)
lowest_leaf_neighbor(G::UndirectedGraph)
Return the unique neighbor of `lowest_leaf(G)`.
"""
function lowest_leaf_neighbor(G::UndirectedGraph)
Expand All @@ -30,7 +30,7 @@ end

"""
prufer_code(G)
Return the Prufer code of the `SimpleGraph` which must be a tree.
Return the Prufer code of the `UndirectedGraph` which must be a tree.
The vertices must be `<`-comparable and preferrably are the integers
`{1,2,...,n}` (otherwise we cannot decode the sequence generated).
"""
Expand Down
Loading

0 comments on commit d4bae24

Please sign in to comment.