IGraphs.jl is a thin Julia wrapper around the C graphs library igraph. The package provides:
- Wrapper types: Most C types (like
igraph_vector_int_t) are directly available inIGraphs.LibIGraphand also have Julian wrappers (likeIGVectorInt) - High-level Julian interfaces: The Julian
IGraphwrapper follows theGraphs.jlinterface, whileIGVector*andIGMatrix*follow the Julia array interface - Alternatives to Graphs.jl algorithms: Some functions have new methods that dispatch to igraph C library implementations using the
IGraphAlgtype - Raw C bindings: Available in
IGraphs.LibIGraphnamespace - Low-level Julian bindings: Higher-level wrappers with error handling and type conversions
IGraphs.jl vX.Y.Z wraps igraph C library vx.y.z where X=x and Y=y. The patch versions Z and z might not match.
# Package
julia --project=. -e "using Pkg; Pkg.instantiate()"# Run default tests
julia --project=. -e "using Pkg; Pkg.test()"Do not try to run single test files.
# Instantiate project dependencies
julia --project=. -e "using Pkg; Pkg.instantiate()"
# Update dependencies
julia --project=. -e "using Pkg; Pkg.update()"
# Check package status
julia --project=. -e "using Pkg; Pkg.status()"Do not read the Manifest.jl files -- they are machine generated and should not be manipulated directly.
Before committing, ensure there are no trailing whitespaces in Julia files:
# Remove trailing whitespaces from all .jl files (requires gnu tools)
find . -type f -name '*.jl' -exec sed --in-place 's/[[:space:]]\+$//' {} \+Ensure all Julia files end with a newline to avoid misbehaving CLI tools:
# Add newline to end of all .jl files that don't have one
find . -type f -name '*.jl' -exec sed -i '$a\' {} \+- Use 4 spaces for indentation (no tabs)
- Remove trailing whitespaces from all lines
- Ensure files end with a single newline
- Follow Julia standard naming conventions
- Keep lines under 100 characters when reasonable
It is a good idea to keep two remotes - an upstream remote treated as a source of truth, and a personal origin remote on your own github account for storing branches and preparing pull requests. Pull requests can be managed with gh.
This package follows standard Julia development practices:
- Always pull latest changes first: Before creating any new feature or starting work, ensure you have the latest version by running
git pull upstream master(orgit pull upstream main) - Pull before continuing work: Other maintainers might have modified the branch you are working on. Always call
git pullbefore continuing work on an existing branch - Push changes to remote: Always push your local changes to the remote branch to keep the PR up to date:
git push origin <branch-name> - Run all tests before submitting: Before creating or updating a PR, always run the full test suite to ensure nothing is broken:
julia --project=. -e "using Pkg; Pkg.test()" - Fork and create feature branches
- Write tests for new functionality
- Ensure all tests pass before merging
- Keep PRs focused: A PR should implement one self-contained change. Avoid mixing feature work with formatting changes to unrelated files, even for improvements like adding missing newlines. Format unrelated files in separate commits or PRs.
When creating pull requests to solve GitHub issues:
-
Setup remotes properly: Make sure you have both
origin(your fork) andupstream(main repository) remotes configured:git remote add upstream https://github.com/JuliaGraphs/IGraphs.jl.git git remote add origin https://github.com/YOUR_USERNAME/IGraphs.jl.git
-
Create feature branch: Always create a feature branch from the latest upstream master:
git checkout master git pull upstream master git checkout -b descriptive-branch-name
-
Make your changes: Implement the solution, add tests, and ensure all tests pass:
julia --project=. -e "using Pkg; Pkg.test()" -
Commit and push: Commit your changes and push to your fork:
git add . git commit -m "Descriptive commit message" git push -u origin your-branch-name
-
Create PR using gh CLI: Use the GitHub CLI to create the pull request:
gh pr create --title "Your PR Title" --body "Description of changes" --repo JuliaGraphs/IGraphs.jl
This workflow ensures your PR targets the main repository from your personal fork.