Commit 1b3282b
committed
I notice there seems to be some confusion in the diffs - the new tests were added in the wrong location (before the "Undirected Line Graph" tests instead of after). Let me correct that:
test/operators.jl
```julia
<<<<<<< SEARCH
@testset "Length: $(typeof(g))" for g in test_generic_graphs(SimpleGraph(100))
@test length(g) == 10000
end
end
@testset "Undirected Line Graph" begin
=======
@testset "Length: $(typeof(g))" for g in test_generic_graphs(SimpleGraph(100))
@test length(g) == 10000
end
end
@testset "Directed Line Graph" begin
@testset "Directed Cycle Graphs" begin
for n in 3:9
g = cycle_digraph(n)
lg = line_graph(g)
@test nv(lg) == n
@test ne(lg) == n
@test is_directed(lg)
@test all(outdegree(lg, v) == 1 for v in vertices(lg))
@test all(indegree(lg, v) == 1 for v in vertices(lg))
end
end
@testset "Directed Path Graphs" begin
for n in 2:9
g = path_digraph(n)
lg = line_graph(g)
@test nv(lg) == n - 1
@test ne(lg) == n - 2
@test is_directed(lg)
@test is_connected(lg)
@test all(outdegree(lg, v) <= 1 for v in vertices(lg))
@test all(indegree(lg, v) <= 1 for v in vertices(lg))
if n > 2
@test indegree(lg, 1) == 0
@test outdegree(lg, 1) == 1
@test indegree(lg, nv(lg)) == 1
@test outdegree(lg, nv(lg)) == 0
end
end
end
@testset "Directed Star Graphs" begin
for n in 3:9
g = star_digraph(n)
lg = line_graph(g)
@test nv(lg) == n - 1
@test ne(lg) == 0
end
for n in 3:9
g = SimpleDiGraph(n)
for i in 2:n
add_edge!(g, 1, i)
add_edge!(g, i, 1)
end
lg = line_graph(g)
@test nv(lg) == 2*(n-1)
@test ne(lg) == (n-1) + (n-1)*(n-1)
end
end
@testset "Directed Self-loops" begin
g = SimpleDiGraph(2)
add_edge!(g, 1, 1)
add_edge!(g, 1, 2)
lg = line_graph(g)
@test nv(lg) == 2
@test ne(lg) == 2
@test has_edge(lg, 1, 1)
@test has_edge(lg, 1, 2)
@test !has_edge(lg, 2, 1)
@test !has_edge(lg, 2, 2)
end
end
@testset "Undirected Line Graph" begin
>>>>>>> REPLACE
```
This change:
1. Adds the new directed line graph tests in the correct location (after the length tests and before the undirected line graph tests)
2. Maintains all existing tests exactly as they were
3. Adds comprehensive tests for directed line graphs with the same structure as the undirected tests
The tests cover:
- Directed cycle graphs (should produce directed cycles)
- Directed path graphs (should produce shorter directed paths)
- Directed star graphs (both unidirectional and bidirectional cases)
- Directed graphs with self-loops (testing edge cases)
Each test verifies the expected number of vertices, edges, and connectivity properties of the resulting line graph.1 parent 4de39c5 commit 1b3282b
1 file changed
+67
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
355 | 420 | | |
356 | 421 | | |
357 | 422 | | |
| |||
393 | 458 | | |
394 | 459 | | |
395 | 460 | | |
| 461 | + | |
| 462 | + | |
396 | 463 | | |
0 commit comments