Skip to content
This repository has been archived by the owner on Sep 21, 2021. It is now read-only.

Re-write Short Path #221

Merged
merged 4 commits into from
Oct 30, 2018
Merged

Re-write Short Path #221

merged 4 commits into from
Oct 30, 2018

Conversation

Nosferican
Copy link
Collaborator

No description provided.

@Nosferican Nosferican mentioned this pull request Oct 29, 2018
53 tasks
Copy link
Member

@jlperla jlperla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definetely an improvement. I wonder if it would be reasonably easy to have it load a source file via http in one form or another? We could have it go off a static url to this repo, for example?

@Nosferican
Copy link
Collaborator Author

Nosferican commented Oct 29, 2018

We could with the HTTP.jl, but would require users to be online for the lectures (highly undesirable). The text files are silly since these are written and immediately after read and parsed into what one could just write directly. In the rare case, that one needs a text files representation for whatever purpose, one can use the Julia struct to export it. It also simplifies the code and focuses on the material rather than IO.

@jlperla
Copy link
Member

jlperla commented Oct 29, 2018

I haven't compiled the new version, but the old one looked odd in having a huge chunk of the printed notes taken up by what amounts to a test example. Does it take up less space in the output now?

If the tradeoff is between people having to be online to run the code for a solution , vs having a massive test file embedded in the lecture display, then I would pick the former.

@Nosferican
Copy link
Collaborator Author

Nosferican commented Oct 29, 2018

Collapse doesn't seem to work, but when it does, it should help. The cell is n lines so 100. Doesn't seem particularly long. If the priority is the length, putting the code without the line breaks would make it really compact, but harder to read if one desires to. The collapse functionality should handle it as first-best.

@jlperla
Copy link
Member

jlperla commented Oct 29, 2018

Jupyter notebooks don't collapse at all...I really don't see the benefit of ensuring that the code would work offline for people reading the document. But to me, the goal really is to get the source as compact as possible... And nothing is more compact than getting it directly from a URL.

@Nosferican
Copy link
Collaborator Author

Nosferican commented Oct 29, 2018

This is a one liner,

graph = Dict(zip(0:99, [[(14, 72.21), (8, 11.11), (1, 0.04)],[(13, 64.94), (6, 20.59), (46, 1247.25)],[(45, 1561.45), (31, 166.8), (66, 54.18)],[(11, 42.43), (6, 2.06), (20, 133.65)],[(7, 1.02), (5, 0.73), (75, 3706.67)],[(11, 34.54), (7, 3.33), (45, 1382.97)],[(10, 13.1), (9, 0.72), (31, 63.17)],[(10, 5.85), (9, 3.15), (50, 478.14)],[(12, 3.18), (11, 7.45), (69, 577.91)],[(20, 16.53), (13, 4.42), (70, 2454.28)],[(16, 25.16), (12, 1.87), (89, 5352.79)],[(20, 65.08), (18, 37.55), (94, 4961.32)],[(28, 170.04), (24, 34.32), (84, 3914.62)],[(40, 475.33), (38, 236.33), (60, 2135.95)],[(24, 38.65), (16, 2.7), (67, 1878.96)],[(18, 2.57), (17, 1.01), (91, 3597.11)],[(38, 278.71), (19, 3.49), (36, 392.92)],[(23, 26.45), (22, 24.78), (76, 783.29)],[(28, 55.84), (23, 16.23), (91, 3363.17)],[(28, 70.54), (20, 0.24), (26, 20.09)],[(33, 145.8), (24, 9.81), (98, 3523.33)],[(31, 27.06), (28, 36.65), (56, 626.04)],[(40, 124.22), (39, 136.32), (72, 1447.22)],[(33, 22.37), (26, 2.66), (52, 336.73)],[(28, 14.25), (26, 1.8), (66, 875.19)],[(35, 45.55), (32, 36.58), (70, 1343.63)],[(42, 122.0), (27, 0.01), (47, 135.78)],[(43, 246.24), (35, 48.1), (65, 480.55)],[(36, 15.52), (34, 21.79), (82, 2538.18)],[(33, 12.61), (32, 4.22), (64, 635.52)],[(35, 13.95), (33, 5.61), (98, 2616.03)],[(44, 125.88), (36, 20.44), (98, 3350.98)],[(35, 1.46), (34, 3.33), (97, 2613.92)],[(47, 111.54), (41, 3.23), (81, 1854.73)],[(48, 129.45), (42, 51.52), (73, 1075.38)],[(50, 78.81), (41, 2.09), (52, 17.57)],[(57, 260.46), (54, 101.08), (71, 1171.6)],[(46, 80.49), (38, 0.36), (75, 269.97)],[(42, 8.78), (40, 1.79), (93, 2767.85)],[(41, 1.34), (40, 0.95), (50, 39.88)],[(54, 53.46), (47, 28.57), (75, 548.68)],[(54, 162.24), (46, 0.28), (53, 18.23)],[(72, 437.49), (47, 10.08), (59, 141.86)],[(60, 116.23), (54, 95.06), (98, 2984.83)],[(47, 2.14), (46, 1.56), (91, 807.39)],[(49, 15.51), (47, 3.68), (58, 79.93)],[(67, 65.48), (57, 27.5), (52, 22.68)],[(61, 172.64), (56, 49.31), (50, 2.82)],[(60, 66.44), (59, 34.52), (99, 2564.12)],[(56, 10.89), (50, 0.51), (78, 53.79)],[(55, 20.1), (53, 1.38), (85, 251.76)],[(60, 73.79), (59, 23.67), (98, 2110.67)],[(66, 123.03), (64, 102.41), (94, 1471.8)],[(67, 88.35), (56, 4.33), (72, 22.85)],[(73, 238.61), (59, 24.3), (88, 967.59)],[(64, 60.8), (57, 2.13), (84, 86.09)],[(61, 11.06), (57, 0.02), (76, 197.03)],[(60, 7.01), (58, 0.46), (86, 701.09)],[(65, 34.32), (64, 29.85), (83, 556.7)],[(71, 0.67), (60, 0.72), (90, 820.66)],[(67, 1.63), (65, 4.76), (76, 48.03)],[(64, 4.88), (63, 0.95), (98, 1057.59)],[(76, 38.43), (64, 2.94), (91, 132.23)],[(75, 56.34), (72, 70.08), (66, 4.43)],[(76, 11.98), (65, 0.3), (80, 47.73)],[(73, 33.23), (66, 0.64), (94, 594.93)],[(73, 37.53), (68, 2.66), (98, 395.63)],[(70, 0.98), (68, 0.09), (82, 153.53)],[(71, 1.66), (70, 3.35), (94, 232.1)],[(73, 8.99), (70, 0.06), (99, 247.8)],[(73, 8.37), (72, 1.5), (76, 27.18)],[(91, 284.64), (74, 8.86), (89, 104.5)],[(92, 133.06), (84, 102.77), (76, 15.32)],[(90, 243.0), (76, 1.4), (83, 52.22)],[(78, 8.08), (76, 0.52), (81, 1.07)],[(77, 1.19), (76, 0.81), (92, 68.53)],[(78, 2.36), (77, 0.45), (85, 13.18)],[(86, 64.32), (78, 0.98), (80, 8.94)],[(81, 2.59), (98, 355.9)],[(91, 22.35), (85, 1.45), (81, 0.09)],[(98, 264.34), (88, 28.78), (92, 121.87)],[(92, 99.89), (89, 39.52), (94, 99.78)],[(93, 11.99), (88, 28.05), (91, 47.44)],[(88, 5.78), (86, 8.75), (94, 114.95)],[(98, 121.05), (94, 30.41), (89, 19.14)],[(89, 4.9), (87, 2.66), (97, 94.51)],[(97, 85.09)],[(92, 21.23), (91, 11.14), (88, 0.21)],[(98, 6.12), (91, 6.83), (93, 1.31)],[(99, 82.12), (97, 36.97)],[(99, 50.99), (94, 10.47), (96, 23.53)],[(97, 22.17)],[(99, 34.68), (97, 11.24), (96, 10.83)],[(99, 32.77), (97, 6.71), (94, 0.19)],[(96, 2.03), (98, 5.91)],[(99, 0.27), (98, 6.17)],[(99, 5.87), (97, 0.43), (98, 3.32)],[(98, 0.3)],[(99, 0.33)],[(99, 0.0)]]))

Reading and parsing from the web will add a few lines. Don't know how it would look on a PDF for example, but for a notebook is fine. One horizontal scrolling short cell.

An alternative is to have a data management package that the lectures would call.

@jlperla
Copy link
Member

jlperla commented Oct 29, 2018

Lets see how that looks when we have HTML output.

I really don't see the problem with a few lectures requiring an internet connection for students to run code, as the vast majority will be using Jupyter on an internet connected computer. There may only be one or two of them, . For anything statistical we should be careful to use RDatasets


graph = = Dict(zip(0:99, [[(14, 72.21), (8, 11.11), (1, 0.04)],[(13, 64.94), (6, 20.59), (46, 1247.25)],[(45, 1561.45), (31, 166.8), (66, 54.18)],[(11, 42.43), (6, 2.06), (20, 133.65)],[(7, 1.02), (5, 0.73), (75, 3706.67)],[(11, 34.54), (7, 3.33), (45, 1382.97)],[(10, 13.1), (9, 0.72), (31, 63.17)],[(10, 5.85), (9, 3.15), (50, 478.14)],[(12, 3.18), (11, 7.45), (69, 577.91)],[(20, 16.53), (13, 4.42), (70, 2454.28)],[(16, 25.16), (12, 1.87), (89, 5352.79)],[(20, 65.08), (18, 37.55), (94, 4961.32)],[(28, 170.04), (24, 34.32), (84, 3914.62)],[(40, 475.33), (38, 236.33), (60, 2135.95)],[(24, 38.65), (16, 2.7), (67, 1878.96)],[(18, 2.57), (17, 1.01), (91, 3597.11)],[(38, 278.71), (19, 3.49), (36, 392.92)],[(23, 26.45), (22, 24.78), (76, 783.29)],[(28, 55.84), (23, 16.23), (91, 3363.17)],[(28, 70.54), (20, 0.24), (26, 20.09)],[(33, 145.8), (24, 9.81), (98, 3523.33)],[(31, 27.06), (28, 36.65), (56, 626.04)],[(40, 124.22), (39, 136.32), (72, 1447.22)],[(33, 22.37), (26, 2.66), (52, 336.73)],[(28, 14.25), (26, 1.8), (66, 875.19)],[(35, 45.55), (32, 36.58), (70, 1343.63)],[(42, 122.0), (27, 0.01), (47, 135.78)],[(43, 246.24), (35, 48.1), (65, 480.55)],[(36, 15.52), (34, 21.79), (82, 2538.18)],[(33, 12.61), (32, 4.22), (64, 635.52)],[(35, 13.95), (33, 5.61), (98, 2616.03)],[(44, 125.88), (36, 20.44), (98, 3350.98)],[(35, 1.46), (34, 3.33), (97, 2613.92)],[(47, 111.54), (41, 3.23), (81, 1854.73)],[(48, 129.45), (42, 51.52), (73, 1075.38)],[(50, 78.81), (41, 2.09), (52, 17.57)],[(57, 260.46), (54, 101.08), (71, 1171.6)],[(46, 80.49), (38, 0.36), (75, 269.97)],[(42, 8.78), (40, 1.79), (93, 2767.85)],[(41, 1.34), (40, 0.95), (50, 39.88)],[(54, 53.46), (47, 28.57), (75, 548.68)],[(54, 162.24), (46, 0.28), (53, 18.23)],[(72, 437.49), (47, 10.08), (59, 141.86)],[(60, 116.23), (54, 95.06), (98, 2984.83)],[(47, 2.14), (46, 1.56), (91, 807.39)],[(49, 15.51), (47, 3.68), (58, 79.93)],[(67, 65.48), (57, 27.5), (52, 22.68)],[(61, 172.64), (56, 49.31), (50, 2.82)],[(60, 66.44), (59, 34.52), (99, 2564.12)],[(56, 10.89), (50, 0.51), (78, 53.79)],[(55, 20.1), (53, 1.38), (85, 251.76)],[(60, 73.79), (59, 23.67), (98, 2110.67)],[(66, 123.03), (64, 102.41), (94, 1471.8)],[(67, 88.35), (56, 4.33), (72, 22.85)],[(73, 238.61), (59, 24.3), (88, 967.59)],[(64, 60.8), (57, 2.13), (84, 86.09)],[(61, 11.06), (57, 0.02), (76, 197.03)],[(60, 7.01), (58, 0.46), (86, 701.09)],[(65, 34.32), (64, 29.85), (83, 556.7)],[(71, 0.67), (60, 0.72), (90, 820.66)],[(67, 1.63), (65, 4.76), (76, 48.03)],[(64, 4.88), (63, 0.95), (98, 1057.59)],[(76, 38.43), (64, 2.94), (91, 132.23)],[(75, 56.34), (72, 70.08), (66, 4.43)],[(76, 11.98), (65, 0.3), (80, 47.73)],[(73, 33.23), (66, 0.64), (94, 594.93)],[(73, 37.53), (68, 2.66), (98, 395.63)],[(70, 0.98), (68, 0.09), (82, 153.53)],[(71, 1.66), (70, 3.35), (94, 232.1)],[(73, 8.99), (70, 0.06), (99, 247.8)],[(73, 8.37), (72, 1.5), (76, 27.18)],[(91, 284.64), (74, 8.86), (89, 104.5)],[(92, 133.06), (84, 102.77), (76, 15.32)],[(90, 243.0), (76, 1.4), (83, 52.22)],[(78, 8.08), (76, 0.52), (81, 1.07)],[(77, 1.19), (76, 0.81), (92, 68.53)],[(78, 2.36), (77, 0.45), (85, 13.18)],[(86, 64.32), (78, 0.98), (80, 8.94)],[(81, 2.59), (98, 355.9)],[(91, 22.35), (85, 1.45), (81, 0.09)],[(98, 264.34), (88, 28.78), (92, 121.87)],[(92, 99.89), (89, 39.52), (94, 99.78)],[(93, 11.99), (88, 28.05), (91, 47.44)],[(88, 5.78), (86, 8.75), (94, 114.95)],[(98, 121.05), (94, 30.41), (89, 19.14)],[(89, 4.9), (87, 2.66), (97, 94.51)],[(97, 85.09)],[(92, 21.23), (91, 11.14), (88, 0.21)],[(98, 6.12), (91, 6.83), (93, 1.31)],[(99, 82.12), (97, 36.97)],[(99, 50.99), (94, 10.47), (96, 23.53)],[(97, 22.17)],[(99, 34.68), (97, 11.24), (96, 10.83)],[(99, 32.77), (97, 6.71), (94, 0.19)],[(96, 2.03), (98, 5.91)],[(99, 0.27), (98, 6.17)],[(99, 5.87), (97, 0.43), (98, 3.32)],[(98, 0.3)],[(99, 0.33)],[(99, 0.0)]]))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is going to be good enough until we can think about rewriting this with LightGraphs.

The one problem is that there seems to be a typo here (multiple = = signs if you try to run it).

Otherwise, I think this is an improvement and should be merged when @arnavs has taken a look.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree as well. This is definitely a step forward. Merging now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you make that fix I identified before merging? If not it will need to be made on master.

@arnavs arnavs merged commit 05a90ed into master Oct 30, 2018
@arnavs arnavs deleted the Short-Path branch December 14, 2018 19:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants