Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: sparse.csgraph simple examples. #8910

Merged
merged 21 commits into from
Jun 9, 2018

Conversation

peterSweter
Copy link
Contributor

I have created simple examples for the following sparse.csgraph functions:

sparse.csgraph (18)
connected_components
shortest_path
floyd_warshall
dijkstra
bellman_ford
johnson
breadth_first_order
depth_first_order
reverse_cuthill_mckee
maximum_bipartite_matching
structural_rank
construct_dist_matrix
reconstruct_path
csgraph_masked_from_dense
csgraph_from_dense
csgraph_from_masked
csgraph_to_dense
csgraph_to_masked

@peterSweter
Copy link
Contributor Author

I don't understand why Travis CI is failing. The log says:

Failed example:
    csgraph_masked_from_dense(graph)
Expected:
    masked_array(data =
     [[-- 1 2 --]
     [-- -- -- 1]
     [-- -- -- 3]
     [-- -- -- --]],
                 mask =
     [[ True False False  True]
     [ True  True  True False]
     [ True  True  True False]
     [ True  True  True  True]],
           fill_value = 0)
Got:
    masked_array(
      data=[[--, 1, 2, --],
            [--, --, --, 1],
            [--, --, --, 3],
            [--, --, --, --]],
      mask=[[ True, False, False,  True],
            [ True,  True,  True, False],
            [ True,  True,  True, False],
            [ True,  True,  True,  True]],
      fill_value=0)

When I run the test locally I have masked_array printed without commas separating elements in the array. In Numpy masked_array examples, masked_array is printed without commas: https://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html

@peterSweter peterSweter changed the title sparse.csgraph simple examples. DOC: sparse.csgraph simple examples. Jun 8, 2018
@rgommers rgommers added Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.sparse.csgraph labels Jun 9, 2018
@rgommers
Copy link
Member

rgommers commented Jun 9, 2018

That will depend on the numpy version you use I think. The documentation checker on TravisCI uses the latest version, so 1.14.4. In numpy 1.13.x-1.14.x there was quite a mess with array formatting changes.

Just changing it in your example to the "Expected" format above should be fine.

@rgommers
Copy link
Member

rgommers commented Jun 9, 2018

Thanks @peterSweter, these examples look good!

@pv
Copy link
Member

pv commented Jun 9, 2018 via email

@rgommers rgommers added this to the 1.2.0 milestone Jun 9, 2018
@rgommers
Copy link
Member

rgommers commented Jun 9, 2018

LGTM now, merging. Thanks @peterSweter

@rgommers rgommers merged commit 9960ba9 into scipy:master Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.sparse.csgraph
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants