Skip to content

Commit

Permalink
Merge branch 'master' into mincut
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennedeg authored Jul 4, 2023
2 parents d658882 + 745add6 commit 0c8e4da
Show file tree
Hide file tree
Showing 295 changed files with 9,693 additions and 5,695 deletions.
1 change: 1 addition & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
style = "blue"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ docs/site/
benchmark/.results/*
benchmark/.tune.jld
*.cov
Manifest.toml
/Manifest.toml
2 changes: 1 addition & 1 deletion CITATION.bib
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@misc{Graphs2021,
author = {James Fairbanks, Mathieu Besançon, Simon Schölly, Júlio Hoffiman, Nick Eubank, and Stefan Karpinski},
author = {Fairbanks, James and Besan{\c{c}}on, Mathieu and Simon, Sch{\"o}lly and Hoffiman, J{\'u}lio and Eubank, Nick and Karpinski, Stefan},
title = {JuliaGraphs/Graphs.jl: an optimized graphs package for the Julia programming language},
year = 2021,
url = {https://github.com/JuliaGraphs/Graphs.jl/}
Expand Down
60 changes: 38 additions & 22 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,32 @@ Following these guidelines will reduce friction and improve the speed at which y

## Bug reports

If you notice code that crashes, is incorrect, or is too slow, please file a bug report. The report should be raised as a github issue with a minimal working example that reproduces the condition.
If you notice code that crashes, is incorrect, or is too slow, please file a bug report. The report should be raised as a GitHub issue with a minimal working example that reproduces the condition.
The example should include any data needed. If the problem is incorrectness, then please post the correct result along with an incorrect result.

Please include version numbers of all relevant libraries and Julia itself.

## Development guidelines

- Correctness is a necessary requirement; efficiency is desirable. Once you have a correct implementation, make a Pull Request (PR) so we can help improve performance.
- PRs should contain one logical enhancement to the codebase.
- Squash commits in a PR.
- If you want to introduce a new feature, open an issue can to discuss a feature before you start coding (this maximizes the likelihood of patch acceptance).
- Minimize dependencies on external packages, and avoid introducing new dependencies that would increase the compilation time by a lot.
Here are a few principles to keep in mind when writing a Pull Request (PR).

### Correctness

- Correctness is a necessary requirement. Add tests to make sure that any new function displays the right behavior.
- Since Graphs.jl supports multiple implementations of the graph data structure using the `AbstractGraph` [type](https://juliagraphs.github.io/Graphs.jl/latest/types.html#AbstractGraph-Type-1), you should refrain from using the internal fields of structs such as `fadjlist`. Instead, you should use the functions provided in the API. Code that is instrumental to defining a concrete graph type can use the internal structure of that type.
- Put type assertions on all function arguments where conflict may arise (use abstract types, `Union`, or `Any` if necessary).
- If the algorithm was presented in a paper, include a reference to the paper (_e.g._, a proper academic citation along with an eprint link).
- Take steps to ensure that code works correctly and efficiently on edge cases (disconnected graphs, empty graphs, ...).
- We can accept code that does not work for directed graphs as long as it comes with an explanation of what it would take to make it work for directed graphs.
- Prefer the short circuiting conditional over `if`/`else` when convenient, and where state is not explicitly being mutated (*e.g.*, `condition && error("message")` is good; `condition && i += 1` is not).

### Style

- Write your code using Invenia's [BlueStyle](https://github.com/invenia/BlueStyle)
- Format it with [JuliaFormatter](https://github.com/domluna/JuliaFormatter.jl) before pushing

### Efficiency

- Once you have a correct implementation, make a PR so we can help improve performance.
- Minimize dependencies on external packages, and avoid introducing new dependencies that would increase the compilation time by a lot.
- Write code to reuse memory wherever possible. For example:

```julia
Expand All @@ -34,7 +43,9 @@ function f(g, v)
return sum(storage)
end
```

should be rewritten as two functions

```julia
function f(g::AbstractGraph, v::Integer)
storage = Vector{Int}(undef, nv(g))
Expand All @@ -49,45 +60,50 @@ function f!(g::AbstractGraph, v::Integer, storage::AbstractVector{Int})
return sum(storage)
end
```

This gives users the option of reusing memory and improving performance.

### Minimizing use of internal struct fields
### Misc

Since Graphs supports multiple implementations of the graph data structure using the `AbstractGraph` [type](https://juliagraphs.github.io/Graphs.jl/latest/types.html#AbstractGraph-Type-1), you should refrain from using the internal fields of structs such as `fadjlist`. Instead, you should use the functions provided in the API.
Code that is instrumental to defining a concrete graph type can use the internal structure of that type.
- If the algorithm was presented in a paper, include a reference to the paper (_e.g._, a proper academic citation along with an eprint link).

## Git usage
## Git(Hub) usage

### Getting started on a package contribution

In order to make it easier for you to contribute and review Pull Requests (PRs),
it would be better to be familiar with git fundamentals.

In order to make it easier for you to contribute and review PRs, it would be better to be familiar with Git fundamentals.
Most importantly:

- clone the repository from JuliaGraphs/Graphs.jl
- fork the repository on your own github account
- fork the repository on your own GitHub account
- make the modification to the repository, test and document all your changes
- push to the fork you created
- open a PR.

See the [JuMP documentation](https://jump.dev/JuMP.jl/dev/developers/contributing/) for a more detailed guide.

### Advanced: visualize opened PRs locally:
### PR hygiene

- PRs should contain one logical enhancement to the codebase.
- Squash commits in a PR.
- If you want to introduce a new feature, open an issue to discuss a feature before you start coding (this maximizes the likelihood of patch acceptance).

### Advanced: visualize opened PRs locally

In order to make it easier for you to review Pull Requests (PRs), you can add this to your git config file, which should be located at `PACKAGE_LOCATION/.git/config`, where `PACKAGE_LOCATION` is where the Graphs.jl was cloned.
In order to make it easier for you to review PRs, you can add this to your git config file, which should be located at `PACKAGE_LOCATION/.git/config`, where `PACKAGE_LOCATION` is where the Graphs.jl was cloned.
If you added the package with the `] dev` command, it is likely at `$HOME/.julia/dev/Graphs`.

These instructions were taken from [this gist](https://gist.github.com/piscisaureus/3342247).

Locate the section for your github remote in the `.git/config` file. It looks like this:
Locate the section for your GitHub remote in the `.git/config` file. It looks like this:

```
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:JuliaGraphs/Graphs.jl.git
```

Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. Obviously, change the GitHub URL to match your project's URL. It ends up looking like this:

```
[remote "origin"]
Expand All @@ -96,7 +112,7 @@ Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this se
fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
```

Now fetch all the pull requests:
Now fetch all the PRs:

```
$ git fetch origin
Expand All @@ -108,7 +124,7 @@ From github.com:JuliaGraphs/Graphs.jl
...
```

To check out a particular pull request:
To check out a particular PR:

```
$ git checkout pr/999
Expand Down
2 changes: 2 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# License information

The Graphs.jl (formerly called LightGraphs.jl) package is licensed under the Simplified "2-clause" BSD
License:
> Copyright (c) 2015: Seth Bromberger and other contributors.
Expand Down
22 changes: 18 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Graphs"
uuid = "86223c79-3864-5bf0-83f7-82e725a168b6"
version = "1.6.0"
version = "1.8.0"

[deps]
ArnoldiMethod = "ec485272-7323-5ecc-a04f-4719b315124d"
Expand All @@ -16,17 +16,31 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

[compat]
Aqua = "0.6"
ArnoldiMethod = "0.1, 0.2"
Compat = "3.40"
Compat = "3.40, 4"
DataStructures = "0.17, 0.18"
Inflate = "0.1.2"
Documenter = "0.27"
Inflate = "0.1.3"
JuliaFormatter = "1"
SimpleTraits = "0.9"
StableRNGs = "1"
julia = "1.6"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Base64", "DelimitedFiles", "Test"]
test = ["Aqua", "Base64", "DelimitedFiles", "Documenter", "JET", "JuliaFormatter", "LinearAlgebra", "Pkg", "Random", "SparseArrays", "StableRNGs", "Statistics", "Test"]
Loading

0 comments on commit 0c8e4da

Please sign in to comment.