From 4c2b38bfc5274ee2bc0190787fdbd1b297e68b32 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Mon, 12 Aug 2019 10:28:28 -0700 Subject: [PATCH 01/20] topological sort by component size w/ new tests --- src/CurricularAnalytics.jl | 2 +- src/GraphAlgs.jl | 22 +++++++++++++++++++--- test/GraphAlgs.jl | 21 +++++++++++++++++++++ test/runtests.jl | 1 + 4 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 test/GraphAlgs.jl diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 68ed17f0..d62e3f8b 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -25,7 +25,7 @@ include("Visualization.jl") export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, - Term, DegreePlan, find_term, course_from_id, dfs, longest_path, long_paths, + Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, long_paths, isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, bin_packing, bin_packing2, find_min_terms, add_lo_requisite!, update_plan, write_csv, find_min_terms, diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index c25fa2c1..cff3110f 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -1,7 +1,7 @@ # File: GraphAlgs.jl -# Depth-first search, returns edge classification using EdgeClass +# Depth-first search, returns edge classification using EdgeClass, as well as the discovery and finish time for each vertex. function dfs(g::AbstractGraph{T}) where T time = 0 # discover and finish times @@ -35,9 +35,25 @@ function dfs(g::AbstractGraph{T}) where T return edge_type, d, f end # end dfs -function topological_sort(g::AbstractGraph{T}) where T +# In a DFS of a DAG, sorting the vertices according to their finish times in the DFS will yeild a topological sorting of the +# DAG vertices. This function returns the indicies of the vertiecs in the DAG in topological sort order. +# If component_order is set to true, the largest components in the graph will appear at the beginning of the topological ordering. +function topological_sort(g::AbstractGraph{T}, component_order=false) where T edges_type, d, f = dfs(g) - return sortperm(f, rev=true) + topo_order = sortperm(f, rev=true) + if component_order == true + reorder = [] + wcc = weakly_connected_components(g) + sort!(wcc, lt = (x,y) -> size(x) > size(y)) # order components by size + for component in wcc + sort!(component, lt = (x,y) -> indexin(x, topo_order)[1] < indexin(y, topo_order)[1]) # topological sort within each component + for i in component + push!(reorder, i) # add verteix indicies to the end of the reorder array + end + end + topo_order = reorder + end + return topo_order end # transpose of DAG diff --git a/test/GraphAlgs.jl b/test/GraphAlgs.jl new file mode 100644 index 00000000..38d300ba --- /dev/null +++ b/test/GraphAlgs.jl @@ -0,0 +1,21 @@ +# Graph Algs tests + +@testset "GraphAlgs Tests" begin + +# 12-vertex test diagraph with 5 components + +g = SimpleDiGraph(12) +add_edge!(g, 2, 3) +add_edge!(g, 2, 5) +add_edge!(g, 2, 6) +add_edge!(g, 4, 2) +add_edge!(g, 6, 10) +add_edge!(g, 7, 8) +add_edge!(g, 7, 11) + +# topological sort w/ no ordering by component size +@test topological_sort(g) == [12, 9, 7, 11, 8, 4, 2, 6, 10, 5, 3, 1] +# topological sort w/ ordering by component size +@test topological_sort(g, true) == [4, 2, 6, 10, 5, 3, 7, 11, 8, 1, 9, 12] + +end; \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index 9c4035a6..f2aad51c 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -9,5 +9,6 @@ using Test include("DataTypes.jl") include("CurricularAnalytics.jl") +include("GraphAlgs.jl") include("DegreePlanAnalytics.jl") include("DataHandler.jl") \ No newline at end of file From 8360d99dfe43f439c4d6e5ecc89d8bfe90b97f12 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Wed, 14 Aug 2019 16:47:40 -0700 Subject: [PATCH 02/20] updated topologicall_sort() and documentation --- src/CSVUtilities.jl | 31 ++++++++++++----------- src/DataTypes.jl | 25 +++++++++++-------- src/GraphAlgs.jl | 61 ++++++++++++++++++++++++++++++++------------- 3 files changed, 74 insertions(+), 43 deletions(-) diff --git a/src/CSVUtilities.jl b/src/CSVUtilities.jl index 6f4b3fe7..e7f56a73 100644 --- a/src/CSVUtilities.jl +++ b/src/CSVUtilities.jl @@ -61,24 +61,24 @@ function course_line(course, term_id) end course_prereq = chop(course_prereq) if length(course_prereq) > 0 - course_prereq=course_prereq * "\"" + course_prereq = course_prereq * "\"" end course_coreq = chop(course_coreq) if length(course_coreq) > 0 - course_coreq=course_coreq * "\"" + course_coreq = course_coreq * "\"" end course_scoreq = chop(course_scoreq) if length(course_scoreq) > 0 - course_scoreq=course_scoreq * "\"" + course_scoreq = course_scoreq * "\"" end course_chours = course.credit_hours course_inst = course.institution course_canName = course.canonical_name course_term = typeof(term_id) == Int ? string(term_id) : term_id c_line= "\n" * string(course_ID) * ",\"" * string(course_name) * "\",\"" * string(course_prefix) * "\",\"" * - string(course_num) * "\"," * string(course_prereq) * "," * string(course_coreq) * "," * - string(course_scoreq) * "," * string(course_chours) *",\""* string(course_inst) * "\",\"" * - string(course_canName) * "\"," * course_term + string(course_num) * "\"," * string(course_prereq) * "," * string(course_coreq) * "," * + string(course_scoreq) * "," * string(course_chours) *",\""* string(course_inst) * "\",\"" * + string(course_canName) * "\"," * course_term return c_line end @@ -103,7 +103,7 @@ function csv_line_reader(line::AbstractString, delimeter::Char=',') end function find_cell(row, header) - if !(header in names(row)) + if !(header in names(row)) #I assume this means if header is not in names return "" elseif typeof(row[header]) == Missing return "" @@ -113,7 +113,7 @@ function find_cell(row, header) end function read_all_courses(df_courses::DataFrame, lo_Course:: Dict{Int, Array{LearningOutcome}}=Dict{Int, Array{LearningOutcome}}()) - course_dict= Dict{Int, Course}() + course_dict = Dict{Int, Course}() for row in DataFrames.eachrow(df_courses) c_ID = row[Symbol("Course ID")] c_Name = find_cell(row, Symbol("Course Name")) @@ -121,7 +121,9 @@ function read_all_courses(df_courses::DataFrame, lo_Course:: Dict{Int, Array{Lea c_Credit = typeof(c_Credit) == String ? parse(Float64, c_Credit) : c_Credit c_Prefix = string(find_cell(row, Symbol("Prefix"))) c_Number = find_cell(row, Symbol("Number")) - if typeof(c_Number) != String c_Number = string(c_Number) end + if typeof(c_Number) != String + c_Number = string(c_Number) + end c_Inst = find_cell(row, Symbol("Institution")) c_col_name = find_cell(row, Symbol("Canonical Name")) learning_outcomes = if c_ID in keys(lo_Course) lo_Course[c_ID] else LearningOutcome[] end @@ -130,7 +132,7 @@ function read_all_courses(df_courses::DataFrame, lo_Course:: Dict{Int, Array{Lea return false else course_dict[c_ID] = Course(c_Name, c_Credit, prefix=c_Prefix, learning_outcomes=learning_outcomes, - num=c_Number, institution=c_Inst, canonical_name=c_col_name, id=c_ID) + num=c_Number, institution=c_Inst, canonical_name=c_col_name, id=c_ID) end end for row in DataFrames.eachrow(df_courses) @@ -175,8 +177,8 @@ function read_terms(df_courses::DataFrame, course_dict::Dict{Int, Course}, cours c_ID = find_cell(row, Symbol("Course ID")) term_ID = find_cell(row, Symbol("Term")) for course in course_arr - if course_dict[c_ID].id == course.id - if typeof(row[Symbol("Term")]) != Missing + if course_dict[c_ID].id == course.id #This could be simplified with logic + if typeof(row[Symbol("Term")]) != Missing #operations rather than four if statemnts push!(have_term, course) if term_ID in keys(terms) push!(terms[term_ID], course) @@ -276,9 +278,8 @@ function write_learning_outcomes(curric::Curriculum, csv_file, all_course_lo) lo_prereq = lo_prereq * "\"" end lo_hours = lo.hours - lo_line = "\n" * string(course_ID) * "," * string(lo_ID) * ",\"" * string(lo_name) * "\",\"" * string(lo_desc) * "\",\"" * - string(lo_prereq) * "\"," * string(lo_hours) * ",,,,," - + lo_line = "\n" * string(course_ID) * "," * string(lo_ID) * ",\"" * string(lo_name) * "\",\"" * + string(lo_desc) * "\",\"" * string(lo_prereq) * "\"," * string(lo_hours) * ",,,,," write(csv_file, lo_line) end end diff --git a/src/DataTypes.jl b/src/DataTypes.jl index 27c113be..737e4d47 100644 --- a/src/DataTypes.jl +++ b/src/DataTypes.jl @@ -31,8 +31,8 @@ mutable struct LearningOutcome description::AbstractString # A description of the learning outcome hours::Int # number of class hours that should be devoted # to the learning outcome - requisites::Dict{Int, Requisite} # List of requisites, in - #(requisite_learning_outcome, requisite_type) format + requisites::Dict{Int, Requisite} # List of requisites, in + #(requisite_learning_outcome, requisite_type) format metrics::Dict{String, Any} # Learning outcome-related metrics # Constructor @@ -50,8 +50,7 @@ end #""" -# add_lo_requisite!(rlo, tlo, requisite_type) -# +#add_lo_requisite!(rlo, tlo, requisite_type) #Add learning outcome rlo as a requisite, of type requisite_type, for target learning #outcome tlo. #""" @@ -93,10 +92,10 @@ julia> Course("Calculus with Applications", 4, prefix="MA", num="112", canonical mutable struct Course id::Int # Unique course id vertex_id::Dict{Int, Int} # The vertex id of the course w/in a curriculum graph, stored as - # (curriculum_id, vertex_id) + # (curriculum_id, vertex_id) name::AbstractString # Name of the course, e.g., Introduction to Psychology - credit_hours::Real # Number of credit hours associated with course. For the - # purpose of analytics, variable credits are not supported + credit_hours::Real # Number of credit hours associated with course. For the + # purpose of analytics, variable credits are not supported prefix::AbstractString # Typcially a department prefix, e.g., PSY num::AbstractString # Course number, e.g., 101, or 302L institution::AbstractString # Institution offering the course @@ -238,7 +237,7 @@ mutable struct Curriculum CIP::AbstractString # CIP code associated with the curriculum courses::Array{Course} # Array of required courses in curriculum num_courses::Int # Number of required courses in curriculum - credit_hours::Real # Total number of credit hours in required curriculum + credit_hours::Real # Total number of credit hours in required curriculum graph::SimpleDiGraph{Int} # Directed graph representation of pre-/co-requisite structure # of the curriculum learning_outcomes::Array{LearningOutcome} # A list of learning outcomes associated with the curriculum @@ -246,7 +245,8 @@ mutable struct Curriculum # Constructor function Curriculum(name::AbstractString, courses::Array{Course}; learning_outcomes::Array{LearningOutcome} = Array{LearningOutcome,1}(), - degree_type::Degree=BS, system_type::System=semester, institution::AbstractString="", CIP::AbstractString="26.0101", id::Int=0, sortby_ID::Bool=true) + degree_type::Degree=BS, system_type::System=semester, institution::AbstractString="", CIP::AbstractString="26.0101", + id::Int=0, sortby_ID::Bool=true) this = new() this.name = name this.degree_type = degree_type @@ -285,6 +285,7 @@ end # # if courses array is empty, no new courses were added #end +# Map course IDs to vertex IDs in an underlying curriculum graph. function map_vertex_ids(curriculum::Curriculum) mapped_ids = Dict{Int, Int}() for c in curriculum.courses @@ -293,6 +294,7 @@ function map_vertex_ids(curriculum::Curriculum) return mapped_ids end +# Determine the course ID associated with a vertex in a curriculum graph. function course_from_id(id::Int, curriculum::Curriculum) for c in curriculum.courses if c.id == id @@ -301,6 +303,7 @@ function course_from_id(id::Int, curriculum::Curriculum) end end +# The total number of credit hours in a curriculum function total_credits(curriculum::Curriculum) total_credits = 0 for c in curriculum.courses @@ -365,7 +368,7 @@ where c1, c2, ... are `Course` data objects mutable struct Term courses::Array{Course} # The courses associated with a term in a degree plan num_courses::Int # The number of courses in the Term - credit_hours::Real # The number of credit hours associated with the term + credit_hours::Real # The number of credit hours associated with the term metrics::Dict{String, Any} # Term-related metrics # Constructor @@ -413,7 +416,7 @@ mutable struct DegreePlan # of the degre plan terms::Array{Term} # The terms associated with the degree plan num_terms::Int # Number of terms in the degree plan - credit_hours::Real # Total number of credit hours in the degree plan + credit_hours::Real # Total number of credit hours in the degree plan metrics::Dict{String, Any} # Dergee Plan-related metrics # Constructor diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index cff3110f..19334337 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -10,7 +10,7 @@ function dfs(g::AbstractGraph{T}) where T edge_type = Dict{Edge,EdgeClass}() for s in vertices(g) if d[s] == 0 # undiscovered - # nested function definition, shares variable space w/ outer function + # a closure, shares variable space w/ outer function function dfs_visit(s) d[s] = time += 1 # discovered for n in neighbors(g, s) @@ -28,35 +28,62 @@ function dfs(g::AbstractGraph{T}) where T end end f[s] = time += 1 # finished - end # end dfs_visit nested function - dfs_visit(s) # call the nested function + end # end closure + dfs_visit(s) # call the closure end end return edge_type, d, f end # end dfs # In a DFS of a DAG, sorting the vertices according to their finish times in the DFS will yeild a topological sorting of the -# DAG vertices. This function returns the indicies of the vertiecs in the DAG in topological sort order. -# If component_order is set to true, the largest components in the graph will appear at the beginning of the topological ordering. -function topological_sort(g::AbstractGraph{T}, component_order=false) where T +# DAG vertices. + """ + topological_sort(g; ) + +Perform a topoloical sort on graph `g`, returning the weakly connected components of the graph, each in topological sort order. +If the `sort` keyword agrument is supplied, the components will be sorted according to their size, in either ascending or +descending order. If two or more components have the same size, the one with the smallest vertex ID in the first position of the +topological sort will appear first. +``` + +# Arguments +Required: +- `g::AbstractGraph` : input graph. +Keyword: +- `sort::String` : sort weakly connected components according to their size, allowable +strings: `ascending`, `descending`. +""" +function topological_sort(g::AbstractGraph{T}; sort::String="") where T edges_type, d, f = dfs(g) topo_order = sortperm(f, rev=true) - if component_order == true - reorder = [] - wcc = weakly_connected_components(g) - sort!(wcc, lt = (x,y) -> size(x) > size(y)) # order components by size - for component in wcc - sort!(component, lt = (x,y) -> indexin(x, topo_order)[1] < indexin(y, topo_order)[1]) # topological sort within each component - for i in component - push!(reorder, i) # add verteix indicies to the end of the reorder array - end + wcc = weakly_connected_components(g) + if sort == "descending" + sort!(wcc, lt = (x,y) -> size(x) != size(y) ? size(x) > size(y) : x[1] < y[1]) # order components by size, if same size, by lower index + elseif sort == "ascending" + sort!(wcc, lt = (x,y) -> size(x) != size(y) ? size(x) < size(y) : x[1] < y[1]) # order components by size, if same size, by lower index + end + reorder = [] + for component in wcc + sort!(component, lt = (x,y) -> indexin(x, topo_order)[1] < indexin(y, topo_order)[1]) # topological sort within each component + for i in component + push!(reorder, i) # add verteix indicies to the end of the reorder array end - topo_order = reorder end - return topo_order + return wcc end # transpose of DAG +""" + gad(g) + +Returns the transpose of directed acyclic graph (DAG) `g`, i.e., a DAG identical to `g`, except the direction +of all edges is reversed. If `g` is not a DAG, and error is thrown. +``` + +# Arguments +Required: +- `g::SimpleDiGraph` : input graph. +""" function gad(g::AbstractGraph{T}) where T @assert typeof(g) == SimpleDiGraph{T} return SimpleDiGraph(transpose(adjacency_matrix(g))) From 72434b7d260b9b9b3bb59e23268613ab2f888981 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Sat, 17 Aug 2019 16:49:43 -0700 Subject: [PATCH 03/20] suppressed redundant requisite printing multiple times --- docs/src/contributing.md | 1 + src/CurricularAnalytics.jl | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/src/contributing.md b/docs/src/contributing.md index 5e0199c6..2076abc9 100644 --- a/docs/src/contributing.md +++ b/docs/src/contributing.md @@ -3,6 +3,7 @@ We welcome all contributors and ask that you read these guidelines before starting to work on this project. Following these guidelines will facilitate collaboration and improve the speed at which your contributions gets merged. ## Bug reports + If you encounter code in this toolbox that does not function properly please file a bug report. The report should be raised as a github issue with a minimal working example that reproduces the error message or erroneous result. The example should include any data needed, and if the issue is incorrectness, please post the correct result along with the incorrect result produced by the toolbox. Please include version numbers of all relevant libraries and Julia itself. diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index d62e3f8b..8d2dd5b3 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -56,7 +56,7 @@ julia> println(String(take!(errors))) There are two reasons why a curriculum graph might not be valid: - Cycles : If a curriculum graph contains a directed cycle, it is not possible to complete the curriculum. -- Extraneous Requisites : These are redundant requisites that introduce spurious complexity. +- Extraneous Requisites : These are redundant requisites that may introduce spurious complexity. If a curriculum has the prerequisite relationships \$c_1 \\rightarrow c_2 \\rightarrow c_3\$ and \$c_1 \\rightarrow c_3\$, and \$c_1\$ and \$c_2\$ are *not* co-requisites, then \$c_1 \\rightarrow c_3\$ is redundant and therefore extraneous. @@ -98,6 +98,7 @@ function extraneous_requisites(c::Curriculum, error_msg::IOBuffer) que = Queue{Int}() components = weakly_connected_components(g) extraneous = false + str = "" # create an empty string to hold any error messages for wcc in components if length(wcc) > 1 # only consider components with more than one vertex for u in wcc @@ -125,7 +126,10 @@ function extraneous_requisites(c::Curriculum, error_msg::IOBuffer) end end if remove == true - write(error_msg, "-$(c.courses[v].name) has redundant requisite $(c.courses[u].name)\n") + temp_str = "-$(c.courses[v].name) has redundant requisite $(c.courses[u].name)\n" + if !occursin(temp_str, str) + str = str * temp_str + end extraneous = true end end @@ -134,6 +138,9 @@ function extraneous_requisites(c::Curriculum, error_msg::IOBuffer) end end end + if extraneous == true + write(error_msg, str) + end return extraneous end From 241dd5ca26974da9caf783b3cd01811e1ff5feb3 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Sun, 18 Aug 2019 16:11:10 -0700 Subject: [PATCH 04/20] updated basic_metrics(dp) and created basic_metrics(curric) --- src/CurricularAnalytics.jl | 98 ++++++++++++++++++++++++++++++++++++++ src/DegreePlanAnalytics.jl | 29 +++++++---- 2 files changed, 118 insertions(+), 9 deletions(-) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 8d2dd5b3..842e46b7 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -388,4 +388,102 @@ function compare_curricula(c1::Curriculum, c2::Curriculum) return report end + +# Basic metrics for a currciulum. +""" + basic_metrics(c::Curriculum) + +Compute the basic metrics associated with curriculum `c`, and return an IO buffer containing these metrics. The basic +metrics are also stored in the `metrics` dictionary associated with the curriculum. + +The basic metrics computed include: + +- number of credit hours : +- number of courses : The total number of terms (semesters or quarters) in the degree plan, ``m``. +- blocking factor : +- centrality : +- delay factor : +- curricular complexity : + +```julia-repl +julia> metrics = basic_metrics(curriculum) +julia> println(String(take!(metrics))) +julia> # The metrics are also stored in a dictonary that can be accessed as follows +julia> curriculum.metrics +``` + +""" +function basic_metrics(curric::Curriculum) + buf = IOBuffer() + complexity(curric), centrality(curric) # compute all curricular metrics + max_bf = 0; max_df = 0; max_cc = 0; max_cent = 0 + max_bf_courses = Array{Course,1}(); max_df_courses = Array{Course,1}(); max_cc_courses = Array{Course,1}(); max_cent_courses = Array{Course,1}() + for c in curric.courses + if c.metrics["blocking factor"] == max_bf + push!(max_bf_courses, c) + elseif c.metrics["blocking factor"] > max_bf + max_bf = c.metrics["blocking factor"] + max_bf_courses = Array{Course,1}() + push!(max_bf_courses, c) + end + if c.metrics["delay factor"] == max_df + push!(max_df_courses, c) + elseif c.metrics["delay factor"] > max_df + max_df = c.metrics["delay factor"] + max_df_courses = Array{Course,1}() + push!(max_df_courses, c) + end + if c.metrics["complexity"] == max_cc + push!(max_cc_courses, c) + elseif c.metrics["complexity"] > max_cc + max_cc = c.metrics["complexity"] + max_cc_courses = Array{Course,1}() + push!(max_cc_courses, c) + end + if c.metrics["centrality"] == max_cent + push!(max_cent_courses, c) + elseif c.metrics["centrality"] > max_cent + max_cent = c.metrics["centrality"] + max_cent_courses = Array{Course,1}() + push!(max_cent_courses, c) + end + end + write(buf, "\nCurriculum: $(curric.name)\n") + write(buf, " credit hours = $(curric.credit_hours)\n") + write(buf, " number of courses = $(curric.num_courses)") + write(buf, "\n Blocking Factor --\n") + write(buf, " entire curriculum = $(curric.metrics["blocking factor"][1])\n") + write(buf, " max. value = $(max_bf), ") + write(buf, "for course(s): ") + write(buf, "$(max_bf_courses[1].prefix) $(max_bf_courses[1].num) $(max_bf_courses[1].name)") + for c in max_bf_courses[2:end] + write(buf, ", $(c.prefix) $(c.num) $(c.name)") + end + write(buf, "\n Centrality --\n") + write(buf, " entire curriculum = $(curric.metrics["centrality"][1])\n") + write(buf, " max. value = $(max_cent), ") + write(buf, "for course(s): ") + write(buf, "$(max_cent_courses[1].prefix) $(max_cent_courses[1].num) $(max_cent_courses[1].name)") + for c in max_cent_courses[2:end] + write(buf, ", $(c.prefix) $(c.num) $(c.name)") + end + write(buf, "\n Delay Factor --\n") + write(buf, " entire curriculum = $(curric.metrics["delay factor"][1])\n") + write(buf, " max. value = $(max_df), ") + write(buf, "for course(s): ") + write(buf, "$(max_df_courses[1].prefix) $(max_df_courses[1].num) $(max_df_courses[1].name)") + for c in max_df_courses[2:end] + write(buf, ", $(c.prefix) $(c.num) $(c.name)") + end + write(buf, "\n Complexity --\n") + write(buf, " entire curriculum = $(curric.metrics["complexity"][1])\n") + write(buf, " max. value = $(max_cc), ") + write(buf, "for course(s): ") + write(buf, "$(max_cc_courses[1].prefix) $(max_cc_courses[1].num) $(max_cc_courses[1].name)") + for c in max_cc_courses[2:end] + write(buf, ", $(c.prefix) $(c.num) $(c.name)") + end + return buf +end + end # module \ No newline at end of file diff --git a/src/DegreePlanAnalytics.jl b/src/DegreePlanAnalytics.jl index b1e0e2ef..36d691f1 100644 --- a/src/DegreePlanAnalytics.jl +++ b/src/DegreePlanAnalytics.jl @@ -1,11 +1,12 @@ #File DegreePlanAnalytics.jl -# Basic metrics for degree plans, based soley on credits +# Basic metrics for a degree plan, based soley on credits """ basic_metrics(plan::DegreePlan) -Computes basic metrics associated with degree plan `plan`. These metrics are primarily concerned with how credits -hours are distributed across the terms in a plan. +Compute the basic metrics associated with degree plan `plan`, and return an IO buffer containing these metrics. The baseic +metrics are primarily concerned with how credits hours are distributed across the terms in a plan. The basic metrics are +also stored in the `metrics` dictionary associated with the degree plan. The basic metrics computed include: @@ -16,24 +17,30 @@ The basic metrics computed include: - max. credit term : The earliest term in the degree plan that has the maximum number of credit hours. - min. credit term : The earliest term in the degree plan that has the minimum number of credit hours. - avg. credits per term : The average number of credit hours per term in the degree plan, ``\\overline{ch}``. -- credit hour variance : The term-by-term credit hour variance, ``\\sigma^2``. If ``ch_i`` denotes the number +- term credit hour std. dev. : The standard deviation of credit hours across all terms ``\\sigma``. If ``ch_i`` denotes the number of credit hours in term ``i``, then ```math -\\sigma^2 = \\sum_{i=1}^m {(ch_i - \\overline{ch})^2 \\over m} +\\sigma = \\sqrt{\\sum_{i=1}^m {(ch_i - \\overline{ch})^2 \\over m}} ``` To view the basic degree plan metrics associated with degree plan `plan` in the Julia console use: ```julia-repl -julia> basic_metrics(plan) +julia> metrics = basic_metrics(plan) +julia> println(String(take!(metrics))) +julia> # The metrics are also stored in a dictonary that can be accessed as follows julia> plan.metrics ``` """ function basic_metrics(plan::DegreePlan) - plan.metrics["number of terms"] = plan.num_terms + buf = IOBuffer() + write(buf, "\nCurriculum: $(plan.curriculum.name)\nDegree Plan: $(plan.name)\n") plan.metrics["total credit hours"] = plan.credit_hours + write(buf, " total credit hours = $(plan.credit_hours)\n") + plan.metrics["number of terms"] = plan.num_terms + write(buf, " number of terms = $(plan.num_terms)\n") max = 0 min = plan.credit_hours max_term = 0 @@ -53,11 +60,15 @@ function basic_metrics(plan::DegreePlan) var = var + (plan.terms[i].credit_hours - avg)^2 end plan.metrics["max. credits in a term"] = max - plan.metrics["min. credits in a term"] = min plan.metrics["max. credit term"] = max_term + write(buf, " max. credits in a term = $(max), in term $(max_term)\n") + plan.metrics["min. credits in a term"] = min plan.metrics["min. credit term"] = min_term + write(buf, " min. credits in a term = $(min), in term $(min_term)\n") plan.metrics["avg. credits per term"] = avg - plan.metrics["credit hour variance"] = var/plan.num_terms + plan.metrics["term credit hour std. dev."] = sqrt(var/plan.num_terms) + write(buf, " avg. credits per term = $(avg), with std. dev. = $(plan.metrics["term credit hour std. dev."])\n") + return buf end # Degree plan metrics based upon the distance between requsites and the classes that require them. From 41ca4c77e3a29cd367110f6ce6943885b4a695e8 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Mon, 19 Aug 2019 17:29:04 -0700 Subject: [PATCH 05/20] Updated basic_metrics(curric) and added tests --- src/CurricularAnalytics.jl | 24 ++++++++++++++++-------- src/DataTypes.jl | 2 +- test/CurricularAnalytics.jl | 36 ++++++++++++++++++++++++++++++------ test/DataHandler.jl | 4 ++-- test/GraphAlgs.jl | 8 +++++--- 5 files changed, 54 insertions(+), 20 deletions(-) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 842e46b7..f6ada5f9 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -388,7 +388,6 @@ function compare_curricula(c1::Curriculum, c2::Curriculum) return report end - # Basic metrics for a currciulum. """ basic_metrics(c::Curriculum) @@ -398,12 +397,14 @@ metrics are also stored in the `metrics` dictionary associated with the curricul The basic metrics computed include: -- number of credit hours : -- number of courses : The total number of terms (semesters or quarters) in the degree plan, ``m``. -- blocking factor : -- centrality : -- delay factor : -- curricular complexity : +- number of credit hours : The total number of credit hours in the curriculum. +- number of courses : The total courses in the curriculum. +- blocking factor : The blocking factor of the entire curriculum, and of each course in the curriculum. +- centrality : The centrality measure associated with the entire curriculum, and of each course in the curriculum. +- delay factor : The delay factor of the entire curriculum, and of each course in the curriculum. +- curricular complexity : The curricular complexity of the entire curriculum, and of each course in the curriculum. + +Complete descriptions of these metrics are provided above. ```julia-repl julia> metrics = basic_metrics(curriculum) @@ -411,7 +412,6 @@ julia> println(String(take!(metrics))) julia> # The metrics are also stored in a dictonary that can be accessed as follows julia> curriculum.metrics ``` - """ function basic_metrics(curric::Curriculum) buf = IOBuffer() @@ -447,6 +447,14 @@ function basic_metrics(curric::Curriculum) max_cent_courses = Array{Course,1}() push!(max_cent_courses, c) end + curric.metrics["max. blocking factor"] = max_bf + curric.metrics["max. blocking factor courses"] = max_bf_courses + curric.metrics["max. centrality"] = max_cent + curric.metrics["max. centrality courses"] = max_cent_courses + curric.metrics["max. delay factor"] = max_df + curric.metrics["max. delay factor courses"] = max_df_courses + curric.metrics["max. complexity"] = max_cc + curric.metrics["max. complexity courses"] = max_cc_courses end write(buf, "\nCurriculum: $(curric.name)\n") write(buf, " credit hours = $(curric.credit_hours)\n") diff --git a/src/DataTypes.jl b/src/DataTypes.jl index 737e4d47..be116fff 100644 --- a/src/DataTypes.jl +++ b/src/DataTypes.jl @@ -259,7 +259,7 @@ mutable struct Curriculum end this.CIP = CIP if sortby_ID - this.courses = sort(collect(courses), by=c->c.id) + this.courses = sort(collect(courses), by = c -> c.id) else this.courses = courses end diff --git a/test/CurricularAnalytics.jl b/test/CurricularAnalytics.jl index 6400c5d7..549de283 100644 --- a/test/CurricularAnalytics.jl +++ b/test/CurricularAnalytics.jl @@ -16,7 +16,7 @@ add_requisite!(A,A,pre) curric = Curriculum("Cycle", [A]) -# Test curriculum validity +# Test is_valid_curriculum() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == false #@test String(take!(errors)) == "\nCurriculum Cycle contains the following requisite cycles:\n(A)\n" @@ -40,9 +40,9 @@ add_requisite!(b,c,pre) add_requisite!(d,c,co) add_requisite!(a,b,pre) -curric = Curriculum("Extraneous", [a,b,c,d],sortby_ID=false) +curric = Curriculum("Extraneous", [a, b, c, d], sortby_ID=false) -# Test curriculum validity +# Test is_valid_curriculum() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == false #@test String(take!(errors)) == "\nCurriculum Extraneous contains the following extraneous requisites:\nCourse C has redundant requisite: A" @@ -74,7 +74,7 @@ add_requisite!(D,F,pre) curric = Curriculum("Underwater Basket Weaving", [A,B,C,D,E,F,G,H], institution="ACME State University", CIP="445786",sortby_ID=false) -# Test curriculum validity +# Test is_valid_curriculum() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == true @@ -117,7 +117,7 @@ add_requisite!(G,F,pre) curric = Curriculum("Postmodern Basket Weaving", [A,B,C,D,E,F,G], sortby_ID=false) -# Test curriculum validity +# Test is_valid_curriculum() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == true @@ -127,6 +127,8 @@ errors = IOBuffer() @test centrality(curric) == (49, [0, 9, 12, 18, 0, 0, 10]) @test complexity(curric) == (48.0, [11.0, 8.0, 8.0, 7.0, 3.0, 5.0, 6.0]) + + ################################################### #8-vertex test curriculum - valid # @@ -155,6 +157,28 @@ add_requisite!(D,F,pre) curric = Curriculum("Underwater Basket Weaving", [A,B,C,D,E,F,G,H], institution="ACME State University", CIP="445786",sortby_ID=false) -# Test curriculum validity +# Test is_valid_curriculum() +errors = IOBuffer() +@test isvalid_curriculum(curric, errors) == true +# Test basic_metrics() +basic_metrics(curric) +@test curric.credit_hours == 22 +@test curric.num_courses == 8 +@test curric.metrics["blocking factor"] == (8, [2, 2, 1, 3, 0, 0, 0, 0]) +@test curric.metrics["delay factor"] == (19.0, [3.0, 3.0, 3.0, 3.0, 3.0, 2.0, 1.0, 1.0]) +@test curric.metrics["centrality"] == (9, [0, 0, 9, 0, 0, 0, 0, 0]) +@test curric.metrics["complexity"] == (27.0, [5.0, 5.0, 4.0, 6.0, 3.0, 2.0, 1.0, 1.0]) +@test curric.metrics["max. blocking factor"] == 3 +@test length(curric.metrics["max. blocking factor courses"]) == 1 +@test curric.metrics["max. blocking factor courses"][1].name == "Basic Basket Forms Lab" +@test curric.metrics["max. centrality"] == 9 +@test length(curric.metrics["max. centrality courses"]) == 1 +@test curric.metrics["max. centrality courses"][1].name == "Basic Basket Forms" +@test curric.metrics["max. delay factor"] == 3.0 +@test length(curric.metrics["max. delay factor courses"]) == 5 +@test curric.metrics["max. delay factor courses"][1].name == "Introduction to Baskets" +@test curric.metrics["max. complexity"] == 6.0 +@test length(curric.metrics["max. complexity courses"]) == 1 +@test curric.metrics["max. complexity courses"][1].name == "Basic Basket Forms Lab" end; \ No newline at end of file diff --git a/test/DataHandler.jl b/test/DataHandler.jl index 73fc7b8d..5bbabffc 100644 --- a/test/DataHandler.jl +++ b/test/DataHandler.jl @@ -3,7 +3,7 @@ @testset "DataHandler Tests" begin # test the data file format used for curricula -# uncomment for top for local test +# uncomment next line, and comment out the one after it, for local test # curric = read_csv("./test/curriculum.csv") curric = read_csv("./curriculum.csv") @@ -110,7 +110,7 @@ end # TODO: add learning outcomes # test the data file format used for degree plans -# uncomment for local test +# uncomment next line, and comment out the one after it, for local test # dp = read_csv("./test/degree_plan.csv") dp = read_csv("degree_plan.csv") @test dp.name == "4-Term Plan" diff --git a/test/GraphAlgs.jl b/test/GraphAlgs.jl index 38d300ba..9e8cbb0f 100644 --- a/test/GraphAlgs.jl +++ b/test/GraphAlgs.jl @@ -14,8 +14,10 @@ add_edge!(g, 7, 8) add_edge!(g, 7, 11) # topological sort w/ no ordering by component size -@test topological_sort(g) == [12, 9, 7, 11, 8, 4, 2, 6, 10, 5, 3, 1] -# topological sort w/ ordering by component size -@test topological_sort(g, true) == [4, 2, 6, 10, 5, 3, 7, 11, 8, 1, 9, 12] +@test topological_sort(g) == [[1], [4, 2, 6, 10, 5, 3], [7, 11, 8], [9], [12]] +# topological sort w/ ordering by component size in descenting order +@test topological_sort(g, sort = "descending") == [[4, 2, 6, 10, 5, 3], [7, 11, 8], [1], [9], [12]] +# topological sort w/ ordering by component size in ascending order +@test topological_sort(g, sort = "ascending") == [[1], [9], [12], [7, 11, 8], [4, 2, 6, 10, 5, 3]] end; \ No newline at end of file From adf39336a6592c4e2a4cfb82166d98fe4ba96137 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Mon, 19 Aug 2019 19:19:17 -0700 Subject: [PATCH 06/20] updated documentation --- docs/src/metrics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/metrics.md b/docs/src/metrics.md index 8d3e3c22..481a8085 100644 --- a/docs/src/metrics.md +++ b/docs/src/metrics.md @@ -1,6 +1,6 @@ # Metrics -A number of predefined metrics that have been defined for curricula and degree plans are described below. You may also define your own metrics for curricula and degree plans. Each of these data types has a `metrics` dictionary where you may write these user-defined metrics. +A number of predefined metrics for analyzing curricula and degree plans are described below. You may also define your own metrics for curricula and degree plans. Each of these data types has a `metrics` dictionary where you may write these user-defined metrics. ## Curricular Metrics From 7c48ef0a8533de79d75b082daed43d89d8227f31 Mon Sep 17 00:00:00 2001 From: Hayden Free Date: Tue, 20 Aug 2019 10:14:41 -0400 Subject: [PATCH 07/20] Update project version to 5.0.2 --- Project.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 05853491..325d38e9 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "CurricularAnalytics" uuid = "593ffa3d-269e-5d81-88bc-c3b6809c35a6" authors = ["Greg Heileman ", "Hayden Free ", "Orhan Abar ", "Will Thompson "] -version = "0.5.1" +version = "0.5.2" [deps] Blink = "ad839575-38b3-5650-b840-f874b8c74a25" From 1e198cb6c040f5806ddd572d77d5f8f2e33c0637 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 08:58:57 -0700 Subject: [PATCH 08/20] added basic_metrics() to documentaton --- docs/src/metrics.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/src/metrics.md b/docs/src/metrics.md index 481a8085..3e2dff33 100644 --- a/docs/src/metrics.md +++ b/docs/src/metrics.md @@ -58,16 +58,28 @@ As an example of the structural complexity metric, consider the same four-course complexity ``` +### Basic Metrics (Curriculum) + +All of the predefined metrics for a given curriculum described above will be computed and stored in the curriculum's `metric` dictionary by using the following function. + +```@docs +basic_metrics(::Curriculum) +``` + ## Degree Plan Metrics The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimzed Degree Plans]@ref. +### Basic Metrics (Degree Plans) + A set of basic statistics associated with the distribution of credit hours in a degree plan can be obtained by using: ```@docs -basic_metrics +basic_metrics(::DegreePlan) ``` +### Requisite Distance + A degree plan metric that is based upon the separation of courses and their pre- and co-requisites in a degree plan is described next. ```@docs From e0a8adb23487a457fb26b5f9dd13546ba2f96d41 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 14:23:28 -0700 Subject: [PATCH 09/20] Added documentation for GraphAlgs.jl --- docs/make.jl | 1 + docs/src/graph_algs.md | 16 ++++ docs/src/metrics.md | 2 +- src/CurricularAnalytics.jl | 1 + src/DegreePlanAnalytics.jl | 33 +++++-- src/GraphAlgs.jl | 174 +++++++++++++++++++++++++++++++------ 6 files changed, 191 insertions(+), 36 deletions(-) create mode 100644 docs/src/graph_algs.md diff --git a/docs/make.jl b/docs/make.jl index 1364a014..a91911db 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -19,6 +19,7 @@ makedocs( "Metrics" => "metrics.md", "Creating Degree Plans" => "degreeplans.md", #"Simulating Student Flows" => "simulating.md", + "Graph Algorithms" => "graph_algs.md", "Contributing" => "contributing.md", "License Information" => "license.md", "Citing CurricularAnalytics.jl" => "citing.md" diff --git a/docs/src/graph_algs.md b/docs/src/graph_algs.md new file mode 100644 index 00000000..37c55f45 --- /dev/null +++ b/docs/src/graph_algs.md @@ -0,0 +1,16 @@ +# Graph Algorithms + +This toolbox makes use of a number of the graph algorithms provided in the [LightGraphs](https://juliagraphs.github.io/LightGraphs.jl/latest/index.html) package. In addition, we have implemented a number of graph algorithms that you may find useful when developing analytics around curriculum graphs. The functions implementing these algorithms are described next. + +```@docs +dfs +gad +longest_path +long_paths +reachable_from +reachable_from_subgraph +reachable_to +reachable_to_subgraph +reach +topological_sort +``` diff --git a/docs/src/metrics.md b/docs/src/metrics.md index 3e2dff33..29b5f4b5 100644 --- a/docs/src/metrics.md +++ b/docs/src/metrics.md @@ -68,7 +68,7 @@ basic_metrics(::Curriculum) ## Degree Plan Metrics -The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimzed Degree Plans]@ref. +The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimzed Degree Plans](@ref). ### Basic Metrics (Degree Plans) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index f6ada5f9..3cb32d2f 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -26,6 +26,7 @@ include("Visualization.jl") export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, long_paths, + gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, bin_packing, bin_packing2, find_min_terms, add_lo_requisite!, update_plan, write_csv, find_min_terms, diff --git a/src/DegreePlanAnalytics.jl b/src/DegreePlanAnalytics.jl index 36d691f1..fc3bbdec 100644 --- a/src/DegreePlanAnalytics.jl +++ b/src/DegreePlanAnalytics.jl @@ -2,11 +2,15 @@ # Basic metrics for a degree plan, based soley on credits """ - basic_metrics(plan::DegreePlan) + basic_metrics(plan) Compute the basic metrics associated with degree plan `plan`, and return an IO buffer containing these metrics. The baseic metrics are primarily concerned with how credits hours are distributed across the terms in a plan. The basic metrics are -also stored in the `metrics` dictionary associated with the degree plan. +also stored in the `metrics` dictionary associated with the degree plan. + +# Arguments +Required: +- `plan::DegreePlan` : a valid degree plan (see [Degree Plans](@ref)). The basic metrics computed include: @@ -32,7 +36,6 @@ julia> println(String(take!(metrics))) julia> # The metrics are also stored in a dictonary that can be accessed as follows julia> plan.metrics ``` - """ function basic_metrics(plan::DegreePlan) buf = IOBuffer() @@ -73,10 +76,18 @@ function basic_metrics(plan::DegreePlan) # Degree plan metrics based upon the distance between requsites and the classes that require them. """ - requisite_distance(plan::DegreePlan, course::Int) + requisite_distance(DegreePlan, course::Int) For a given degree plan `plan` and course `course`, this function computes the total distance between `course` and -each of its requisites. The distance between a course a requisite is given by the number of terms that separate +each of its requisites. + +# Arguments +Required: +- `plan::DegreePlan` : a valid degree plan (see [Degree Plans](@ref)). +- `course::Int` : the vertex ID of a course in the curriclum graph `plan.curriculum.graph`. + + +The distance between a course a requisite is given by the number of terms that separate the course from its requisite in the degree plan. If we let ``T_i^p`` denote the term in degree plan ``p`` that course ``c_i`` appears in, then for a degree plan with underlying curriculum graph ``G_c = (V,E)``, the requisite distance for course ``c_i`` in degree plan ``p``, denoted ``rd_{v_i}^p``, is: @@ -101,9 +112,15 @@ end requisite_distance(plan::DegreePlan) For a given degree plan `plan`, this function computes the total distance between all courses in the degree plan, and -the requisites for those courses. The distance between a course a requisite is given by the number of terms that -separate the course from its requisite in the degree plan. If ``rd_{v_i}^p`` denotes the requisite distance -between course ``c_i`` and its requisites in degree plan ``p``, then the total requisite distance for a degree plan, +the requisites for those courses. + +# Arguments +Required: +- `plan::DegreePlan` : a valid degree plan (see [Degree Plans](@ref)). + +The distance between a course a requisite is given by the number of terms that separate the course from +its requisite in the degree plan. If ``rd_{v_i}^p`` denotes the requisite distance between course +``c_i`` and its requisites in degree plan ``p``, then the total requisite distance for a degree plan, denoted ``rd^p``, is given by: ```math diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index 19334337..f42f6e3e 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -2,6 +2,33 @@ # File: GraphAlgs.jl # Depth-first search, returns edge classification using EdgeClass, as well as the discovery and finish time for each vertex. +""" +dfs(g) + +Perform a depth-first traversal of input graph `g`. + +# Arguments +Required: +- `g::AbstractGraph` : input graph. + +This function returns the classification of each edge in graph `g`, as well as the order in which vertices are +first discovered during a depth-first search traversal, and when the processing from that vertex is completed +during the depth-first traverlsa. According to the vertex discovery and finish times, each edge in `g` will be +classified as one of: + - *tree edge* : Any collection of edges in `g` that form a forest. Every vertex is either a single-vertex tree + with respect to such a collection, or is part of some larger tree through its connection to another vertex via a + tree edge. This collection is not unique defined on `g`. + - *back edge* : Given a collection of tree edges, back edges are those edges that connect some descendent vertex + in a tree to an ancestor vertex in the same tree. + - *forward edge* : Given a collection of tree edges, forward edges are those that are incident from an ancestor + in a tree, and incident to an descendent in the same tree. + - *cross edge* : Given a collection of tree edges, cross edges are those that are adjacent between vertices in + two different trees, or between vertices in two different subtrees in the same tree. + +```julia-repl +julia> edges, discover, finish = dfs(g) +``` +""" function dfs(g::AbstractGraph{T}) where T time = 0 # discover and finish times @@ -44,11 +71,11 @@ Perform a topoloical sort on graph `g`, returning the weakly connected component If the `sort` keyword agrument is supplied, the components will be sorted according to their size, in either ascending or descending order. If two or more components have the same size, the one with the smallest vertex ID in the first position of the topological sort will appear first. -``` # Arguments Required: - `g::AbstractGraph` : input graph. + Keyword: - `sort::String` : sort weakly connected components according to their size, allowable strings: `ascending`, `descending`. @@ -78,7 +105,6 @@ end Returns the transpose of directed acyclic graph (DAG) `g`, i.e., a DAG identical to `g`, except the direction of all edges is reversed. If `g` is not a DAG, and error is thrown. -``` # Arguments Required: @@ -90,6 +116,16 @@ function gad(g::AbstractGraph{T}) where T end # The set of all vertices in the graph reachable from vertex s +""" + reachable_from(g, s) + +Returns the the set of all vertices in `g` that are reachable from vertex `s`. + +# Arguments +Required: +- `g::AbstractGraph` : acylic input graph. +- `s::Int` : index of the source vertex in `g`. +""" function reachable_from(g::AbstractGraph{T}, s::Int, vlist::Array=Array{Int64,1}()) where T for v in neighbors(g, s) if findfirst(isequal(v), vlist) == nothing # v is not in vlist @@ -101,28 +137,55 @@ function reachable_from(g::AbstractGraph{T}, s::Int, vlist::Array=Array{Int64,1} end # The subgraph induced by vertex s and the vertices reachable from vertex s -# -# usage: -# julia> sg_data = reachable_from_subgraph(g,v) -# Returns the subgraph of `g` induced by the vertices reachable from `v` -# along with a vector mapping the new vertices to the old ones. -# (the vertex `i` in the subgraph corresponds to the vertex `vmap[i]` in `g`.) -# -# julia> sg, vmap = reachable_from_subgraph(g,v) -# Returns the subgraph of `g` induced by the vertices reachable from `v` -# as a LightGraph object stored in sg +""" + reachable_from_subgraph(g, s) + +Returns the subgraph induced by `s` in `g` (i.e., a graph object consisting of vertex +`s` and all vertices reachable from vertex `s` in`g`), as well as a vector mapping the vertex +IDs in the subgraph to their IDs in the orginal graph `g`. + +```julia-rep + sg, vmap = reachable_from_subgraph(g, s) +```` +""" function reachable_from_subgraph(g::AbstractGraph{T}, s::Int) where T vertices = reachable_from(g, s) push!(vertices, s) # add the source vertex to the reachable set - induced_subgraph(g, vertices) -# end + induced_subgraph(g, vertices) end # The set of all vertices in the graph that can reach vertex s -function reachable_to(g::AbstractGraph{T}, s::Int) where T - reachable_from(gad(g), s) # vertices reachable from s in the transpose graph -end +""" + reachable_to(g, t) + +Returns the set of all vertices in `g` that can reach target vertex `t` through any path. + +# Arguments +Required: +- `g::AbstractGraph` : acylic input graph. +- `t::Int` : index of the target vertex in `g`. +""" +function reachable_to(g::AbstractGraph{T}, t::Int) where T + reachable_from(gad(g), t) # vertices reachable from s in the transpose graph + end + +# The subgraph induced by vertex s and the vertices that can reach s +""" + reachable_to_subgraph(g, t) +Returns a subgraph in `g` consisting of vertex `t` and all vertices that can reach +vertex `t` in`g`, as well as a vector mapping the vertex IDs in the subgraph to their IDs +in the orginal graph `g`. + +# Arguments +Required: +- `g::AbstractGraph` : acylic input graph. +- `t::Int` : index of the target vertex in `g`. + +```julia-rep + sg, vmap = reachable_to(g, t) +```` +""" function reachable_to_subgraph(g::AbstractGraph{T}, s::Int) where T vertices = reachable_to(g, s) push!(vertices, s) # add the source vertex to the reachable set @@ -130,19 +193,61 @@ function reachable_to_subgraph(g::AbstractGraph{T}, s::Int) where T end # The set of all vertices reachable to and reachable from vertex s -function reach(g::AbstractGraph{T}, s::Int) where T - union(reachable_to(g,s),reachable_from(g,s)) +""" + reachable(g, v) + +Returns the reach of vertex `v` in `g`, ie., the set of all vertices in `g` that can +reach vertex `v` and can be reached from `v`. + +# Arguments +Required: +- `g::AbstractGraph` : acylic input graph. +- `v::Int` : index of a vertex in `g`. +""" +function reach(g::AbstractGraph{T}, v::Int) where T + union(reachable_to(g, v), reachable_from(g, v)) end -function reach_subgraph(g::AbstractGraph{T}, s::Int) where T - vertices = reach(g, s) - push!(vertices, s) # add the source vertex to the reachable set +# Subgraph induced by the reach of a vertex +""" + reachable_subgraph(g, v) + +Returns a subgraph in `g` consisting of vertex `v ` and all vertices that can reach `v`, as +well as all vertices that `v` can reach. In addition, a vector is returned that maps the +vertex IDs in the subgraph to their IDs in the orginal graph `g`. + +# Arguments +Required: +- `g::AbstractGraph` : acylic input graph. +- `v::Int` : index of a vertex in `g`. + +```julia-rep + sg, vmap = reachable_to(g, v) +```` +""" +function reach_subgraph(g::AbstractGraph{T}, v::Int) where T + vertices = reach(g, v) + push!(vertices, v) # add the source vertex to the reachable set induced_subgraph(g, vertices) end -# The longest path from vertx s to any other vertex in a DAG G (not necessarily unique, -# i.e., there can be more than one longest path between two vertices) +# The longest path from vertx s to any other vertex in a DAG G (not necessarily unique). # Note: in a DAG G, longest paths in G = shortest paths in -G +""" + longest_path(g, s) + +The longest path from vertx s to any other vertex in a acyclic graph `g`. The longest path +is not necessarily unique, i.e., there can be more than one longest path between two vertices. + + # Arguments +Required: +- `g::AbstractGraph` : acylic input graph. +- `s::Int` : index of the source vertex in `g`. + +```julia-repl +julia> path = longest_paths(g, s) +``` +""" function longest_path(g::AbstractGraph{T}, s::Int) where T if is_cyclic(g) error("longest_path(): input graph has cycles") @@ -159,10 +264,25 @@ function longest_path(g::AbstractGraph{T}, s::Int) where T return lp end -# Enumerate all unique long paths in a DAG G, where a long path must include a -# source vertex (in-degree zero) and a different sink vertex (out-degree zero), -# i.e., must be a path containing at least two vertices +# all long paths in a graph +""" + long_paths(g) + + Enumerate all of the unique long paths in acyclic graph `g`, where a "long path" must include a + source vertex (a vertex with in-degree zero) and a different sink vertex (a vertex with out-degree + zero). I.e., a long path is any path containing at least two vertices. This function returns + an array of these long paths, where each path consists of an array of vertex IDs. + + # Arguments +Required: +- `g::AbstractGraph` : acylic input graph. + +```julia-repl +julia> paths = long_paths(g) +``` +""" function long_paths(g::AbstractGraph{T}) where T + # check that g is acyclic if is_cyclic(g) error("long_paths(): input graph has cycles") end From 1d5f3ef7cd948f848606af02cc1931e47f523825 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 14:33:45 -0700 Subject: [PATCH 10/20] fixed errors in documentatoin --- docs/src/degreeplans.md | 2 +- docs/src/graph_algs.md | 1 + docs/src/metrics.md | 2 +- src/CurricularAnalytics.jl | 2 +- src/GraphAlgs.jl | 4 ++-- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/src/degreeplans.md b/docs/src/degreeplans.md index 6a9026af..fe691ba4 100644 --- a/docs/src/degreeplans.md +++ b/docs/src/degreeplans.md @@ -15,7 +15,7 @@ In order to be considered *minimally feasible*, a degree plan $P$ for a curricul 1. Every course in the curriculum $C$ must appear in one and only one term in the degree plan $P$. (Note: $P$ may contain courses that are not in $C$.) 2. The requisite relationships between the courses in $P$ must be respected across the terms in $P$. That is, if course ``a`` is a prerequisite for course ``b`` in the curriculum, then course ``a`` must appear in the degree plan $P$ in an earlier term than course ``b``. -## Optimized Degree Plans +## Optimized-Degree-Plans The Curricular Analytics Toolbox also allows you to create customized degree plans according to various user-specifed criteria. These features make use of the [JuMP](https://github.com/JuliaOpt/JuMP.jl) domain-specific language for specifying optimization problems in Julia, and calls the [Gurobi](https://www.gurobi.com) solver in order to solve the optimzaton problems. In order to use these features you must first install JuMP and Gurobi. For installation instructions see [Additional Requirements](@ref) in the Installation section. diff --git a/docs/src/graph_algs.md b/docs/src/graph_algs.md index 37c55f45..a4a38908 100644 --- a/docs/src/graph_algs.md +++ b/docs/src/graph_algs.md @@ -12,5 +12,6 @@ reachable_from_subgraph reachable_to reachable_to_subgraph reach +reach_subgraph topological_sort ``` diff --git a/docs/src/metrics.md b/docs/src/metrics.md index 29b5f4b5..e8d28f3a 100644 --- a/docs/src/metrics.md +++ b/docs/src/metrics.md @@ -68,7 +68,7 @@ basic_metrics(::Curriculum) ## Degree Plan Metrics -The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimzed Degree Plans](@ref). +The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimized-Degree-Plans](@ref). ### Basic Metrics (Degree Plans) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 3cb32d2f..0bf01c6e 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -26,7 +26,7 @@ include("Visualization.jl") export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, long_paths, - gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, + gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, bin_packing, bin_packing2, find_min_terms, add_lo_requisite!, update_plan, write_csv, find_min_terms, diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index f42f6e3e..1c0cb07f 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -194,7 +194,7 @@ end # The set of all vertices reachable to and reachable from vertex s """ - reachable(g, v) + reach(g, v) Returns the reach of vertex `v` in `g`, ie., the set of all vertices in `g` that can reach vertex `v` and can be reached from `v`. @@ -210,7 +210,7 @@ end # Subgraph induced by the reach of a vertex """ - reachable_subgraph(g, v) + reach_subgraph(g, v) Returns a subgraph in `g` consisting of vertex `v ` and all vertices that can reach `v`, as well as all vertices that `v` can reach. In addition, a vector is returned that maps the From 3469793b3a2328532b4fc958cd58be9f9807950a Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 14:43:43 -0700 Subject: [PATCH 11/20] bug fixes in documentation --- docs/src/degreeplans.md | 2 +- docs/src/metrics.md | 2 +- src/CurricularAnalytics.jl | 2 +- src/DegreePlanCreation.jl | 32 ++++++++++++++++---------------- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/src/degreeplans.md b/docs/src/degreeplans.md index fe691ba4..6a9026af 100644 --- a/docs/src/degreeplans.md +++ b/docs/src/degreeplans.md @@ -15,7 +15,7 @@ In order to be considered *minimally feasible*, a degree plan $P$ for a curricul 1. Every course in the curriculum $C$ must appear in one and only one term in the degree plan $P$. (Note: $P$ may contain courses that are not in $C$.) 2. The requisite relationships between the courses in $P$ must be respected across the terms in $P$. That is, if course ``a`` is a prerequisite for course ``b`` in the curriculum, then course ``a`` must appear in the degree plan $P$ in an earlier term than course ``b``. -## Optimized-Degree-Plans +## Optimized Degree Plans The Curricular Analytics Toolbox also allows you to create customized degree plans according to various user-specifed criteria. These features make use of the [JuMP](https://github.com/JuliaOpt/JuMP.jl) domain-specific language for specifying optimization problems in Julia, and calls the [Gurobi](https://www.gurobi.com) solver in order to solve the optimzaton problems. In order to use these features you must first install JuMP and Gurobi. For installation instructions see [Additional Requirements](@ref) in the Installation section. diff --git a/docs/src/metrics.md b/docs/src/metrics.md index e8d28f3a..7767bafe 100644 --- a/docs/src/metrics.md +++ b/docs/src/metrics.md @@ -68,7 +68,7 @@ basic_metrics(::Curriculum) ## Degree Plan Metrics -The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimized-Degree-Plans](@ref). +The aforementioned curricular complexity metrics are independent of how a curriculum is layed out as a degree plan. That is, the curricular metrics will not change as different degree plans are created. Degree plan metrics are related to the manner in which courses in the curriculum are laid out across the terms in the degree plan. These metrics are used in the creation of optimal degree plans as described in [Optimized Degree Plans](@ref). ### Basic Metrics (Degree Plans) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 0bf01c6e..806d3091 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -26,7 +26,7 @@ include("Visualization.jl") export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, long_paths, - gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph + gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph, isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, bin_packing, bin_packing2, find_min_terms, add_lo_requisite!, update_plan, write_csv, find_min_terms, diff --git a/src/DegreePlanCreation.jl b/src/DegreePlanCreation.jl index bb2e3372..8e888816 100644 --- a/src/DegreePlanCreation.jl +++ b/src/DegreePlanCreation.jl @@ -169,15 +169,15 @@ function create_terms(curric::Curriculum; term_count::Int, min_credits_per_term: end end -""" -find_min_terms function will find the minimum number terms possible to fit all courses with the respect that all requisite - conditions and returns a tuple which contains 3 elements. - 1- Boolean value which shows if term list created for term count. - 2- Term list which contains all courses for related term id. - 3- The term_count is a integer value to show minimum number of terms possible to fit all courses. - * Altough this function returns term list, it does not guarantee that each term will have the same number of credit hours. - It will put all courses as early term as possible according to the complexity score. -""" +#""" +#find_min_terms function will find the minimum number terms possible to fit all courses with the respect that all requisite +# conditions and returns a tuple which contains 3 elements. +# 1- Boolean value which shows if term list created for term count. +# 2- Term list which contains all courses for related term id. +# 3- The term_count is a integer value to show minimum number of terms possible to fit all courses. +# * Altough this function returns term list, it does not guarantee that each term will have the same number of credit hours. +# It will put all courses as early term as possible according to the complexity score. +#""" function find_min_terms(curric::Curriculum, additional_courses::Array{Course}=Array{Course,1}(); min_terms::Int=1, max_terms::Int=10, min_credits_per_term::Int=5, max_credits_per_term::Int=19) for term_count in range(min_terms, stop=max_terms) @@ -190,13 +190,13 @@ function find_min_terms(curric::Curriculum, additional_courses::Array{Course}=Ar return false, nothing, nothing end -""" -balance_terms function will spread all courses to the provided number of terms with minimum number of difference between terms. - In other words, balance terms according to the number of credit hours and returns a tuple which contains 3 elements. - 1- Boolean value which shows if term list created for term count. - 2- Term list which contains all courses for related term id. - 3- The max_credit is a integer value to show maximum number of credit hours assigned to any of the list of terms. -""" +#""" +#balance_terms function will spread all courses to the provided number of terms with minimum number of difference between terms. +# In other words, balance terms according to the number of credit hours and returns a tuple which contains 3 elements. +# 1- Boolean value which shows if term list created for term count. +# 2- Term list which contains all courses for related term id. +# 3- The max_credit is a integer value to show maximum number of credit hours assigned to any of the list of terms. +#""" function balance_terms(curric::Curriculum, additional_courses::Array{Course}=Array{Course,1}(); term_count::Int=1, min_credits_per_term::Int=1, max_credits_per_term::Int=19) for max_credit in range(min_credits_per_term, length=max_credits_per_term-min_credits_per_term+1) From 19a320cf78aa0a61bc4cf38eee477a5cc83de38b Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 14:58:19 -0700 Subject: [PATCH 12/20] minor bug fix in documentaton --- docs/src/persistence.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/persistence.md b/docs/src/persistence.md index 15b99a3d..e3a1b065 100644 --- a/docs/src/persistence.md +++ b/docs/src/persistence.md @@ -6,7 +6,7 @@ The ability to read/write curricula and degree plans to disk is greatly facilita The *CSV file format* stores data as comma-separated values in a text file, allowing data to be presented in tabular form. You can open CSV files with either a text editor or by using your favorite spreadsheet program. The sections below describe the CSV file formats used for curricula and degree plans, as well as functions that can be used to read/write these CSV files. -### Curricula +### Curricula Files The CSV file format used to store curricula is shown below: ![file format for curricula](./curriculum-format.png) @@ -38,7 +38,7 @@ Below is an example curriculum file that uses the aforedescribed format: A link to this CSV file can be found [here](./curriculum-ex.csv), and a visualization of this curriculum, created using the function described in [Visualization Functions](@ref), is as follows: ![visualization of example curriculum](./curriculum-ex-viz.png) -### Degree Plans +### Degree Plan Files The CSV file format used to store degree plans is shown below: ![file format for curricula](./degree-plan-format.png) From 8a0debc2796c440e2ba220ecbe27016e69448d9b Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 15:02:16 -0700 Subject: [PATCH 13/20] fixed test in GraphAlgs.jl --- test/GraphAlgs.jl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/GraphAlgs.jl b/test/GraphAlgs.jl index 9e8cbb0f..c8f9c127 100644 --- a/test/GraphAlgs.jl +++ b/test/GraphAlgs.jl @@ -1,5 +1,7 @@ # Graph Algs tests +using LightGraphs + @testset "GraphAlgs Tests" begin # 12-vertex test diagraph with 5 components From c1fff3584adcb8add317ee6225fa5b546f58718c Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 16:55:05 -0700 Subject: [PATCH 14/20] cleaing up kruft --- src/citing/index.html | 182 --------- src/contributing/index.html | 165 -------- src/curriculum/index.html | 165 -------- src/degreeplan/index.html | 160 -------- src/developing/index.html | 160 -------- src/license/index.html | 772 ------------------------------------ src/metrics/index.html | 166 -------- src/optimizing/index.html | 160 -------- src/persistence/index.html | 160 -------- src/plotting/index.html | 160 -------- src/simulating/index.html | 160 -------- src/types/index.html | 166 -------- 12 files changed, 2576 deletions(-) delete mode 100644 src/citing/index.html delete mode 100644 src/contributing/index.html delete mode 100644 src/curriculum/index.html delete mode 100644 src/degreeplan/index.html delete mode 100644 src/developing/index.html delete mode 100644 src/license/index.html delete mode 100644 src/metrics/index.html delete mode 100644 src/optimizing/index.html delete mode 100644 src/persistence/index.html delete mode 100644 src/plotting/index.html delete mode 100644 src/simulating/index.html delete mode 100644 src/types/index.html diff --git a/src/citing/index.html b/src/citing/index.html deleted file mode 100644 index ce8ed8c1..00000000 --- a/src/citing/index.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - How to Cite CurricularAnalytics - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

How to Cite CurricularAnalytics

-

We encourage you to cite our work if you have used our libraries, tools or datasets. Starring the repository on GitHub is also appreciated.

-

To cite the latest version of the CurricularAnalytics Julia toolbox,

-
@misc{HeFr:18,
-  author       = {Gregory L. Heileman and Hayden Free and {other contributors}},
-  title        = {CurricularAnalytics.jl},
-  year         = 2018,
-  doi          = {getDOI},
-  url          = {getURL}
-}
-
- -

For previous versions, please reference the zenodo site.

-

To cite the definitive Curricular Analytics technical reference, please use the following BibTeX citation:

-
@article{Heileman18,
-  author       = {Gregory L. Heileman and Chaouki T. Abdallah and Ahmad Slim and Michael Hickman},
-  title        = {Curricular Analytics: A Framework for Quantifying the Impact of Curricular Reforms and Pedagogical
-Innovationsl},
-  journal   = {to appear}
-  year         = 2018,
-  url          = {getURL}
-}
-
-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/contributing/index.html b/src/contributing/index.html deleted file mode 100644 index 95366816..00000000 --- a/src/contributing/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - Contributor Guide - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Contributor Guide

-

We welcome all contributors and ask that you read these guidelines before starting to work on this project. Following these guidelines will facilitate collaboration and improve the speed at which your contributions gets merged.

-

Bug reports

-

If you encounter code in this toolbox that does not function properly please file a bug report. The report should be raised as a github issue with a minimal working example that reproduces the error message or erroneous result. The example should include any data needed, and if the issue is incorrectness, please post the correct result along with the incorrect result produced by the toolbox.

-

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

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/curriculum/index.html b/src/curriculum/index.html deleted file mode 100644 index 9589147e..00000000 --- a/src/curriculum/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - Creating Curricula - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Creating Curricula

-

@docs -add_requisite! -delete_requisite! -create_graph! -isvalid_curriculum

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/degreeplan/index.html b/src/degreeplan/index.html deleted file mode 100644 index d66b716d..00000000 --- a/src/degreeplan/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - Creating Degree Plans - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Creating Degree Plans

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/developing/index.html b/src/developing/index.html deleted file mode 100644 index c48d0967..00000000 --- a/src/developing/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - Developer Notes - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Developer Notes

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/license/index.html b/src/license/index.html deleted file mode 100644 index cfe6f944..00000000 --- a/src/license/index.html +++ /dev/null @@ -1,772 +0,0 @@ - - - - - - - - - - - License - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
-
-
- -
                GNU GENERAL PUBLIC LICENSE
-                   Version 3, 29 June 2007
-
-

Copyright (C) 2007 Free Software Foundation, Inc. http://fsf.org/ - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed.

-
                        Preamble
-
-

The GNU General Public License is a free, copyleft license for -software and other kinds of works.

-

The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too.

-

When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things.

-

To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others.

-

For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights.

-

Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it.

-

For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions.

-

Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users.

-

Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free.

-

The precise terms and conditions for copying, distribution and -modification follow.

-
                   TERMS AND CONDITIONS
-
-
    -
  1. Definitions.
  2. -
-

"This License" refers to version 3 of the GNU General Public License.

-

"Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks.

-

"The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations.

-

To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work.

-

A "covered work" means either the unmodified Program or a work based -on the Program.

-

To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well.

-

To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying.

-

An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion.

-
    -
  1. Source Code.
  2. -
-

The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work.

-

A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language.

-

The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it.

-

The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work.

-

The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source.

-

The Corresponding Source for a work in source code form is that -same work.

-
    -
  1. Basic Permissions.
  2. -
-

All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law.

-

You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you.

-

Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary.

-
    -
  1. Protecting Users' Legal Rights From Anti-Circumvention Law.
  2. -
-

No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures.

-

When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures.

-
    -
  1. Conveying Verbatim Copies.
  2. -
-

You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program.

-

You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee.

-
    -
  1. Conveying Modified Source Versions.
  2. -
-

You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions:

-
a) The work must carry prominent notices stating that you modified
-it, and giving a relevant date.
-
-b) The work must carry prominent notices stating that it is
-released under this License and any conditions added under section
-7.  This requirement modifies the requirement in section 4 to
-"keep intact all notices".
-
-c) You must license the entire work, as a whole, under this
-License to anyone who comes into possession of a copy.  This
-License will therefore apply, along with any applicable section 7
-additional terms, to the whole of the work, and all its parts,
-regardless of how they are packaged.  This License gives no
-permission to license the work in any other way, but it does not
-invalidate such permission if you have separately received it.
-
-d) If the work has interactive user interfaces, each must display
-Appropriate Legal Notices; however, if the Program has interactive
-interfaces that do not display Appropriate Legal Notices, your
-work need not make them do so.
-
-

A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate.

-
    -
  1. Conveying Non-Source Forms.
  2. -
-

You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways:

-
a) Convey the object code in, or embodied in, a physical product
-(including a physical distribution medium), accompanied by the
-Corresponding Source fixed on a durable physical medium
-customarily used for software interchange.
-
-b) Convey the object code in, or embodied in, a physical product
-(including a physical distribution medium), accompanied by a
-written offer, valid for at least three years and valid for as
-long as you offer spare parts or customer support for that product
-model, to give anyone who possesses the object code either (1) a
-copy of the Corresponding Source for all the software in the
-product that is covered by this License, on a durable physical
-medium customarily used for software interchange, for a price no
-more than your reasonable cost of physically performing this
-conveying of source, or (2) access to copy the
-Corresponding Source from a network server at no charge.
-
-c) Convey individual copies of the object code with a copy of the
-written offer to provide the Corresponding Source.  This
-alternative is allowed only occasionally and noncommercially, and
-only if you received the object code with such an offer, in accord
-with subsection 6b.
-
-d) Convey the object code by offering access from a designated
-place (gratis or for a charge), and offer equivalent access to the
-Corresponding Source in the same way through the same place at no
-further charge.  You need not require recipients to copy the
-Corresponding Source along with the object code.  If the place to
-copy the object code is a network server, the Corresponding Source
-may be on a different server (operated by you or a third party)
-that supports equivalent copying facilities, provided you maintain
-clear directions next to the object code saying where to find the
-Corresponding Source.  Regardless of what server hosts the
-Corresponding Source, you remain obligated to ensure that it is
-available for as long as needed to satisfy these requirements.
-
-e) Convey the object code using peer-to-peer transmission, provided
-you inform other peers where the object code and Corresponding
-Source of the work are being offered to the general public at no
-charge under subsection 6d.
-
-

A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work.

-

A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product.

-

"Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made.

-

If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM).

-

The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network.

-

Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying.

-
    -
  1. Additional Terms.
  2. -
-

"Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions.

-

When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission.

-

Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms:

-
a) Disclaiming warranty or limiting liability differently from the
-terms of sections 15 and 16 of this License; or
-
-b) Requiring preservation of specified reasonable legal notices or
-author attributions in that material or in the Appropriate Legal
-Notices displayed by works containing it; or
-
-c) Prohibiting misrepresentation of the origin of that material, or
-requiring that modified versions of such material be marked in
-reasonable ways as different from the original version; or
-
-d) Limiting the use for publicity purposes of names of licensors or
-authors of the material; or
-
-e) Declining to grant rights under trademark law for use of some
-trade names, trademarks, or service marks; or
-
-f) Requiring indemnification of licensors and authors of that
-material by anyone who conveys the material (or modified versions of
-it) with contractual assumptions of liability to the recipient, for
-any liability that these contractual assumptions directly impose on
-those licensors and authors.
-
-

All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying.

-

If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms.

-

Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way.

-
    -
  1. Termination.
  2. -
-

You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11).

-

However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation.

-

Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice.

-

Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10.

-
    -
  1. Acceptance Not Required for Having Copies.
  2. -
-

You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so.

-
    -
  1. Automatic Licensing of Downstream Recipients.
  2. -
-

Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License.

-

An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts.

-

You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it.

-
    -
  1. Patents.
  2. -
-

A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version".

-

A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License.

-

Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version.

-

In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party.

-

If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid.

-

If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it.

-

A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007.

-

Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law.

-
    -
  1. No Surrender of Others' Freedom.
  2. -
-

If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program.

-
    -
  1. Use with the GNU Affero General Public License.
  2. -
-

Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such.

-
    -
  1. Revised Versions of this License.
  2. -
-

The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns.

-

Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation.

-

If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program.

-

Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version.

-
    -
  1. Disclaimer of Warranty.
  2. -
-

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

-
    -
  1. Limitation of Liability.
  2. -
-

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES.

-
    -
  1. Interpretation of Sections 15 and 16.
  2. -
-

If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee.

-
                 END OF TERMS AND CONDITIONS
-
-        How to Apply These Terms to Your New Programs
-
-

If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms.

-

To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found.

-
<one line to give the program's name and a brief idea of what it does.>
-Copyright (C) <year>  <name of author>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-

Also add information on how to contact you by electronic and paper mail.

-

If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode:

-
<program>  Copyright (C) <year>  <name of author>
-This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-This is free software, and you are welcome to redistribute it
-under certain conditions; type `show c' for details.
-
-

The hypothetical commands show w' andshow c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box".

-

You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -http://www.gnu.org/licenses/.

-

The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -http://www.gnu.org/philosophy/why-not-lgpl.html.

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/metrics/index.html b/src/metrics/index.html deleted file mode 100644 index 84051844..00000000 --- a/src/metrics/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - Curricular Metrics - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Curricular Metrics

-

@docs -CurricularAnalytics -blocking_factor -delay_factor -centrality -complexity

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/optimizing/index.html b/src/optimizing/index.html deleted file mode 100644 index 17ae27a9..00000000 --- a/src/optimizing/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - Optimizing Degree Plans - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Optimizing Degree Plans

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/persistence/index.html b/src/persistence/index.html deleted file mode 100644 index 94d58092..00000000 --- a/src/persistence/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - Reading/Writing Degree Plans - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Reading/Writing Degree Plans

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/plotting/index.html b/src/plotting/index.html deleted file mode 100644 index b3520d09..00000000 --- a/src/plotting/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - Visualizing Degree Plans - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Visualizing Degree Plans

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/simulating/index.html b/src/simulating/index.html deleted file mode 100644 index 1020b51d..00000000 --- a/src/simulating/index.html +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - Simulating Student Flows - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

Simulating Student Flows

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - diff --git a/src/types/index.html b/src/types/index.html deleted file mode 100644 index 932f05c4..00000000 --- a/src/types/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - CurricularAnalytics Data Types - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

CurricularAnalytics Data Types

-

@docs -Course -Curriculum -LearningOutcome -Term -DegreePlan

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - From c39fd6b14743dd55e02c5c5dc03a46f6186941f4 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 20:40:21 -0700 Subject: [PATCH 15/20] changed name of long_paths to all_paths --- docs/src/graph_algs.md | 2 +- src/CurricularAnalytics.jl | 4 ++-- src/GraphAlgs.jl | 28 ++++++++++++++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/src/graph_algs.md b/docs/src/graph_algs.md index a4a38908..84a521dc 100644 --- a/docs/src/graph_algs.md +++ b/docs/src/graph_algs.md @@ -5,8 +5,8 @@ This toolbox makes use of a number of the graph algorithms provided in the [Ligh ```@docs dfs gad +all_paths longest_path -long_paths reachable_from reachable_from_subgraph reachable_to diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 806d3091..8dca0be5 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -25,7 +25,7 @@ include("Visualization.jl") export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, - Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, long_paths, + Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, all_paths, gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph, isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, @@ -262,7 +262,7 @@ where ``\\#(p)`` denotes the number of vertices in the directed path ``p`` in `` """ function centrality(c::Curriculum, course::Int) cent = 0; g = c.graph - for path in long_paths(g) # all long paths in g + for path in all_paths(g) # conditions: path length is greater than 2, target course must be in the path, the target vertex # cannot be the first or last vertex in the path if (in(course,path) && length(path) > 2 && path[1] != course && path[end] != course) diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index 1c0cb07f..8290f844 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -179,7 +179,7 @@ in the orginal graph `g`. # Arguments Required: -- `g::AbstractGraph` : acylic input graph. +- `g::AbstractGraph` : acylic graph. - `t::Int` : index of the target vertex in `g`. ```julia-rep @@ -201,7 +201,7 @@ reach vertex `v` and can be reached from `v`. # Arguments Required: -- `g::AbstractGraph` : acylic input graph. +- `g::AbstractGraph` : acylic graph. - `v::Int` : index of a vertex in `g`. """ function reach(g::AbstractGraph{T}, v::Int) where T @@ -218,7 +218,7 @@ vertex IDs in the subgraph to their IDs in the orginal graph `g`. # Arguments Required: -- `g::AbstractGraph` : acylic input graph. +- `g::AbstractGraph` : acylic graph. - `v::Int` : index of a vertex in `g`. ```julia-rep @@ -241,7 +241,7 @@ is not necessarily unique, i.e., there can be more than one longest path between # Arguments Required: -- `g::AbstractGraph` : acylic input graph. +- `g::AbstractGraph` : acylic graph. - `s::Int` : index of the source vertex in `g`. ```julia-repl @@ -264,33 +264,33 @@ function longest_path(g::AbstractGraph{T}, s::Int) where T return lp end -# all long paths in a graph +# findall long paths in a graph """ - long_paths(g) + all_paths(g) - Enumerate all of the unique long paths in acyclic graph `g`, where a "long path" must include a + Enumerate all of the unique paths in acyclic graph `g`, where a path in this case must include a source vertex (a vertex with in-degree zero) and a different sink vertex (a vertex with out-degree - zero). I.e., a long path is any path containing at least two vertices. This function returns - an array of these long paths, where each path consists of an array of vertex IDs. + zero). I.e., a path is this case must contain at least two vertices. This function returns + an array of these paths, where each path consists of an array of vertex IDs. # Arguments Required: -- `g::AbstractGraph` : acylic input graph. +- `g::AbstractGraph` : acylic graph. ```julia-repl -julia> paths = long_paths(g) +julia> paths = all_paths(g) ``` """ -function long_paths(g::AbstractGraph{T}) where T +function all_paths(g::AbstractGraph{T}) where T # check that g is acyclic if is_cyclic(g) - error("long_paths(): input graph has cycles") + error("all_paths(): input graph has cycles") end que = Queue{Array}() paths = Array[] sinks = Int[] for v in vertices(g) - if (length(outneighbors(g,v)) == 0) && (length(inneighbors(g,v)) > 0) # consider only sink vertices with an in-degree + if (length(outneighbors(g,v)) == 0) && (length(inneighbors(g,v)) > 0) # consider only sink vertices with a non-zero in-degree push!(sinks, v) end end From 5aca5265e481bfce533fed9420bcafdcfc27951c Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Tue, 20 Aug 2019 21:19:00 -0700 Subject: [PATCH 16/20] added a longest_paths function, removed unecessary files --- src/CurricularAnalytics.jl | 2 +- src/GraphAlgs.jl | 97 ++++++++++++++-------- src/degree-plan-ex.csv | 19 ----- src/index.html | 165 ------------------------------------- 4 files changed, 64 insertions(+), 219 deletions(-) delete mode 100644 src/degree-plan-ex.csv delete mode 100644 src/index.html diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 8dca0be5..41eb0d38 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -25,7 +25,7 @@ include("Visualization.jl") export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, - Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, longest_path, all_paths, + Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, all_paths, longest_path, longest_paths, gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph, isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index 8290f844..a116eb73 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -231,40 +231,7 @@ function reach_subgraph(g::AbstractGraph{T}, v::Int) where T induced_subgraph(g, vertices) end -# The longest path from vertx s to any other vertex in a DAG G (not necessarily unique). -# Note: in a DAG G, longest paths in G = shortest paths in -G -""" - longest_path(g, s) - -The longest path from vertx s to any other vertex in a acyclic graph `g`. The longest path -is not necessarily unique, i.e., there can be more than one longest path between two vertices. - - # Arguments -Required: -- `g::AbstractGraph` : acylic graph. -- `s::Int` : index of the source vertex in `g`. - -```julia-repl -julia> path = longest_paths(g, s) -``` -""" -function longest_path(g::AbstractGraph{T}, s::Int) where T - if is_cyclic(g) - error("longest_path(): input graph has cycles") - end - lp = Array{Edge}[] - max = 0 - # shortest path from s to all vertices in -G - for path in enumerate_paths(dijkstra_shortest_paths(g, s, -weights(g), allpaths=true)) - if length(path) > max - lp = path - max = length(path) - end - end - return lp -end - -# findall long paths in a graph +# find all paths in a graph """ all_paths(g) @@ -314,3 +281,65 @@ function all_paths(g::AbstractGraph{T}) where T end return paths end + +# The longest path from vertx s to any other vertex in a DAG G (not necessarily unique). +# Note: in a DAG G, longest paths in G = shortest paths in -G +""" + longest_path(g, s) + +The longest path from vertx s to any other vertex in a acyclic graph `g`. The longest path +is not necessarily unique, i.e., there can be more than one longest path between two vertices. + + # Arguments +Required: +- `g::AbstractGraph` : acylic graph. +- `s::Int` : index of the source vertex in `g`. + +```julia-repl +julia> path = longest_paths(g, s) +``` +""" +function longest_path(g::AbstractGraph{T}, s::Int) where T + if is_cyclic(g) + error("longest_path(): input graph has cycles") + end + lp = Array{Edge}[] + max = 0 + # shortest path from s to all vertices in -G + for path in enumerate_paths(dijkstra_shortest_paths(g, s, -weights(g), allpaths=true)) + if length(path) > max + lp = path + max = length(path) + end + end + return lp +end + +# Find all fo the longest paths in an acyclic graph. +""" + longest_paths(g) + +Finds the length of the longest path in `g`, and returns all paths in `g` of that length. + + # Arguments +Required: +- `g::AbstractGraph` : acylic graph. + +```julia-repl +julia> paths = longest_paths(g) +``` +""" +function longest_paths(g::AbstractGraph{T}) where T + if is_cyclic(g) + error("longest_paths(): input graph has cycles") + end + lps = Array[] + max = 0 + for path in all_paths(g) + length(path) > max ? max = length(path) : nothing + end + for path in all_paths(g) + length(path) == max ? push!(lps, path) : nothing + end + return lps +end \ No newline at end of file diff --git a/src/degree-plan-ex.csv b/src/degree-plan-ex.csv deleted file mode 100644 index 49e7930b..00000000 --- a/src/degree-plan-ex.csv +++ /dev/null @@ -1,19 +0,0 @@ -Curriculum,Underwater Basket Weaving,,,,,,,,, -Degree Plan,Precalc Ready Students,,,,,,,,, -Institution,ACME State University,,,,,,,,, -Degree Type,AA,,,,,,,,, -System Type,semester,,,,,,,,, -CIP,50.0712,,,,,,,,, -Courses,,,,,,,,,, -Course ID,Course Name,Prefix,Number,Prerequisites,Corequisites,Strict-Corequisites,Credit Hours,Institution,Canonical Name,Term -1,Introduction to Baskets,BW,101,,,,3,,,1 -2,Swimming,PE,115,,,,3,,,1 -3,Introductory Calculus w/ Basketry Applications,MA,116,9,,,4,,,2 -4,Basic Basket Forms,BW,111,1,,5,3,,,2 -5,Basic Basket Forms Lab,BW,111L,,,,1,,,2 -6,Advanced Basketry,BW,201,"4;5",3,,3,,,3 -7,Basket Materials & Decoration,BW,214,1,,,3,,,3 -8,Underwater Weaving,BW,301,2,7,,3,,,4 -Additional Courses,,,,,,,,,, -Course ID,Course Name,Prefix,Number,Prerequisites,Corequisites,Strict-Corequisites,Credit Hours,Institution,Canonical Name,Term -9,Precalculus w/ Basketry Applications,MA,110,,,,3,,,1 \ No newline at end of file diff --git a/src/index.html b/src/index.html deleted file mode 100644 index 515dd0e1..00000000 --- a/src/index.html +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - - - - - - CurricularAnalytics - CurricularAnalytics.jl - - - - - - - - - - - - - - - - - -
- -
- -

CurricularAnalytics

-

CurricularAnalytics.jl is a toolbox for studying and analyzing academic program curricula using the Julia programming language. The toolbox represents curricula as graphs, allowing various graph-theoretic measures to be applied in order to quantify the complexity of curricula. In addition to analyzing curricular complexity, the toolbox supports the ability to visualize curricula, to compare and contrast curricula, to create optimal degree plans for completing curricula that satisfy particular constraints, and to simulate the impact of various events on student progression through a curriculum.

-

Basic toolbox functionality

-

The basic data types used in the CurricularAnalytics.jl libraries are described in CurricularAnalytics Data Types. The toolbox includes a number of convenient functions that can be used to create a curriculum graph; these are described in Creating Curricula. In addition, functions that can be used to create a degree plan from a curriculum are described in [Creating Degree Plans].

-

Detailed example and tutorials on how to create and analyze curricula and degree plans can be found in the CurricularAnalytics Tutorial Notebooks repository.

-
- -
-
-

Copyright © 2018 GH, Maintained by the CA Team.

-

Documentation built with MkDocs.

-
- - - - - - - - From fe89bb37fe8c8fd54ba3ec1f89a5738ec91d99ba Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Wed, 21 Aug 2019 10:20:07 -0700 Subject: [PATCH 17/20] refactored isvalid_curriculum() --- src/CurricularAnalytics.jl | 85 +++++++++++++++++++++++++------------ src/DataTypes.jl | 22 +++++++--- src/DegreePlanAnalytics.jl | 2 +- test/CurricularAnalytics.jl | 15 ++++--- 4 files changed, 85 insertions(+), 39 deletions(-) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 41eb0d38..61162d1e 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -23,11 +23,11 @@ include("CSVUtilities.jl") include("DataHandler.jl") include("Visualization.jl") -export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, - LearningOutcome, Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, - Term, DegreePlan, find_term, course_from_id, dfs, topological_sort, all_paths, longest_path, longest_paths, - gad, reachable_from, reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph, - isvalid_curriculum, extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, +export Degree, AA, AS, AAS, BA, BS, System, semester, quarter, Requisite, pre, co, strict_co, EdgeClass, LearningOutcome, + Course, add_requisite!, delete_requisite!, Curriculum, total_credits, requisite_type, Term, DegreePlan, find_term, + course_from_id, dfs, topological_sort, all_paths, longest_path, longest_paths, gad, reachable_from, + reachable_from_subgraph, reachable_to, reachable_to_subgraph, reach, reach_subgraph, isvalid_curriculum, + extraneous_requisites, blocking_factor, delay_factor, centrality, complexity, courses_from_vertices, compare_curricula, isvalid_degree_plan, print_plan, visualize, basic_metrics, read_csv, create_degree_plan, bin_packing, bin_packing2, find_min_terms, add_lo_requisite!, update_plan, write_csv, find_min_terms, balance_terms, requisite_distance, balance_terms_opt, find_min_terms_opt, read_Opt_Config, optimize_plan, @@ -38,16 +38,16 @@ function init_opt() include(dirname(pathof(CurricularAnalytics)) * "/Optimization.jl") end -# Check if a curriculum graph has requisite cycles or extraneous requsities. +# Check if a curriculum graph has requisite cycles. """ isvalid_curriculum(c::Curriculum, errors::IOBuffer) -Tests whether or not the curriculum graph ``G_c`` associated with curriculum `c` is valid. Returns -a boolean value, with `true` indicating the curriculum is valid, and `false` indicating it -is not. +Tests whether or not the curriculum graph ``G_c`` associated with curriculum `c` is valid, i.e., +whether or not it contains a requisite cycle. Returns a boolean value, with `true` indicating the +curriculum is valid, and `false` indicating it is not. -If ``G_c`` is not valid, the reason(s) why are written to the `errors` buffer. To view these -reasons, use: +If ``G_c`` is not valid, the requisite cycle(s) are written to the `errors` buffer. To view these +cycles, use: ```julia-repl julia> errors = IOBuffer() @@ -55,12 +55,8 @@ julia> isvalid_curriculum(c, errors) julia> println(String(take!(errors))) ``` -There are two reasons why a curriculum graph might not be valid: -- Cycles : If a curriculum graph contains a directed cycle, it is not possible to complete the curriculum. -- Extraneous Requisites : These are redundant requisites that may introduce spurious complexity. - If a curriculum has the prerequisite relationships \$c_1 \\rightarrow c_2 \\rightarrow c_3\$ - and \$c_1 \\rightarrow c_3\$, and \$c_1\$ and \$c_2\$ are *not* co-requisites, then \$c_1 - \\rightarrow c_3\$ is redundant and therefore extraneous. +A curriculum graph is not valid if it contains a directed cycle; in this case it is not possible to complete +the curriculum. """ function isvalid_curriculum(c::Curriculum, error_msg::IOBuffer=IOBuffer()) g = c.graph @@ -69,7 +65,8 @@ function isvalid_curriculum(c::Curriculum, error_msg::IOBuffer=IOBuffer()) cycles = simplecycles(g) if size(cycles,1) != 0 validity = false - write(error_msg, "\nCurriculum \'$(c.name)\' has requisite cycles:\n") + c.institution != "" ? write(error_msg, "\n$(c.institution): ") : "\n" + write(error_msg, " curriculum \'$(c.name)\' has requisite cycles:\n") for cyc in cycles write(error_msg, "(") for (i,v) in enumerate(cyc) @@ -80,19 +77,33 @@ function isvalid_curriculum(c::Curriculum, error_msg::IOBuffer=IOBuffer()) end end end - else # no cycles, can now check for extraneous requisites - extran_errors = IOBuffer() - if extraneous_requisites(c, extran_errors) - validity = false - write(error_msg, "\nCurriculum \'$(c.name)\' has extraneous requisites:\n") - write(error_msg, String(take!(extran_errors))) - end end return validity end +## refactoring this out of the function above, to reduce warning outputs -- use extraneous_requisites() in its place +#else # no cycles, can now check for extraneous requisites +# extran_errors = IOBuffer() +# if extraneous_requisites(c, extran_errors) +# validity = false +# c.institution != "" ? write(error_msg, "\n$(c.institution): ") : "\n" +# write(error_msg, " curriculum \'$(c.name)\' has extraneous requisites:\n") +# write(error_msg, String(take!(extran_errors))) +# end +# end +# return validity +#end + +""" + function extraneous_requisites(c::Curriculum, error_msg::IOBuffer) + +Determines whether or not a curriculum `c` contains extraneous requisites, and returns them. Extraneous requisites +are redundant requisites that may introduce spurious complexity. For examokem, if a curriculum has the prerequisite +relationships \$c_1 \\rightarrow c_2 \\rightarrow c_3\$ and \$c_1 \\rightarrow c_3\$, and \$c_1\$ and \$c_2\$ are +*not* co-requisites, then \$c_1 \\rightarrow c_3\$ is redundant and therefore extraneous. +""" function extraneous_requisites(c::Curriculum, error_msg::IOBuffer) - if is_cyclic(c.graph) # error condition should no occur, as cycles are checked in isvalid_curriculum() + if is_cyclic(c.graph) # error condition should not occur, as cycles are checked in isvalid_curriculum() error("\nExtraneous requisities are due to cycles in the curriculum graph") end g = c.graph @@ -140,6 +151,8 @@ function extraneous_requisites(c::Curriculum, error_msg::IOBuffer) end end if extraneous == true + c.institution != "" ? write(error_msg, "\n$(c.institution): ") : "\n" + write(error_msg, " curriculum \'$(c.name)\' has extraneous requisites:\n") write(error_msg, str) end return extraneous @@ -389,6 +402,26 @@ function compare_curricula(c1::Curriculum, c2::Curriculum) return report end +# Create a path as an array of courses from a path provided as vertex IDs. +# The array returned can be (keyword arguments): +# -course data objects : object +# -the names of courses : name +# -the full names of courses (prefix, number, name) : fullname +function courses_from_vertices(curriculum::Curriculum, path::Array{Int,1}; course::String="object") + if course == "object" + course_path = Course[] + else + course_path = String[] + end + for i in path + c = curriculum.courses[i] + course == "object" ? push!(course_path, c) : nothing + course == "name" ? push!(course_path, "$(c.name)") : nothing + course == "fullname" ? push!(course_path, "$(c.prefix) $(c.num) - $(c.name)") : nothing + end + return course_path +end + # Basic metrics for a currciulum. """ basic_metrics(c::Curriculum) diff --git a/src/DataTypes.jl b/src/DataTypes.jl index be116fff..a173a437 100644 --- a/src/DataTypes.jl +++ b/src/DataTypes.jl @@ -48,7 +48,6 @@ mutable struct LearningOutcome end end - #""" #add_lo_requisite!(rlo, tlo, requisite_type) #Add learning outcome rlo as a requisite, of type requisite_type, for target learning @@ -270,13 +269,19 @@ mutable struct Curriculum this.metrics = Dict{String, Any}() this.learning_outcomes = learning_outcomes errors = IOBuffer() - if(isvalid_curriculum(this, errors)) + if isvalid_curriculum(this, errors) return this else - printstyled("WARNING: Curriculum was created, but is invalid:", color = :yellow) + printstyled("WARNING: Curriculum was created, but is invalid due to requisite cycle(s):", color = :yellow) println(String(take!(errors))) return this end + # extraneous requisites are only checked if the curriculum is valid + if extraneous_requisites(this, errors) + printstyled("WARNING: Curriculum contains extraneous requisite(s).\n A list of extraneous requisites can be obtained by using the extraneous_requisites() function.", color = :yellow) + take!(errors) # flush the error buffer + return this + end end end @@ -294,8 +299,8 @@ function map_vertex_ids(curriculum::Curriculum) return mapped_ids end -# Determine the course ID associated with a vertex in a curriculum graph. -function course_from_id(id::Int, curriculum::Curriculum) +# Return the course associated with a course id in a curriculum +function course_from_id(curriculum::Curriculum, id::Int) for c in curriculum.courses if c.id == id return c @@ -303,6 +308,11 @@ function course_from_id(id::Int, curriculum::Curriculum) end end +# Return the course associated with a vertex id in a curriculum graph +function course_from_vertex(curriculum::Curriculum, vertex::Int) + c = curriculum.courses[vertex] +end + # The total number of credit hours in a curriculum function total_credits(curriculum::Curriculum) total_credits = 0 @@ -515,7 +525,7 @@ function isvalid_degree_plan(plan::DegreePlan, error_msg::IOBuffer=IOBuffer()) if length(setdiff(curric_classes, dp_classes)) > 0 validity = false for i in setdiff(curric_classes, dp_classes) - c = course_from_id(i, plan.curriculum) + c = course_from_id(plan.curriculum, i) write(error_msg, "\n-Degree plan is missing required course: $(c.name)") end end diff --git a/src/DegreePlanAnalytics.jl b/src/DegreePlanAnalytics.jl index fc3bbdec..acb1d5ab 100644 --- a/src/DegreePlanAnalytics.jl +++ b/src/DegreePlanAnalytics.jl @@ -103,7 +103,7 @@ function requisite_distance(plan::DegreePlan, course::Course) distance = 0 term = find_term(plan, course) for req in keys(course.requisites) - distance = distance + (term - find_term(plan, course_from_id(req, plan.curriculum))) + distance = distance + (term - find_term(plan, course_from_id(plan.curriculum, req))) end return course.metrics["requisite distance"] = distance end diff --git a/test/CurricularAnalytics.jl b/test/CurricularAnalytics.jl index 549de283..a08c192e 100644 --- a/test/CurricularAnalytics.jl +++ b/test/CurricularAnalytics.jl @@ -16,7 +16,7 @@ add_requisite!(A,A,pre) curric = Curriculum("Cycle", [A]) -# Test is_valid_curriculum() +# Test isvalid_curriculum() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == false #@test String(take!(errors)) == "\nCurriculum Cycle contains the following requisite cycles:\n(A)\n" @@ -42,9 +42,9 @@ add_requisite!(a,b,pre) curric = Curriculum("Extraneous", [a, b, c, d], sortby_ID=false) -# Test is_valid_curriculum() +# Test extraneous_requisites() errors = IOBuffer() -@test isvalid_curriculum(curric, errors) == false +@test extraneous_requisites(curric, errors) == true #@test String(take!(errors)) == "\nCurriculum Extraneous contains the following extraneous requisites:\nCourse C has redundant requisite: A" # 8-vertex test curriculum - valid @@ -74,9 +74,10 @@ add_requisite!(D,F,pre) curric = Curriculum("Underwater Basket Weaving", [A,B,C,D,E,F,G,H], institution="ACME State University", CIP="445786",sortby_ID=false) -# Test is_valid_curriculum() +# Test isvalid_curriculum() and extraneous_requisites() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == true +@test extraneous_requisites(curric, errors) == false # Test analytics @test delay_factor(curric) == (19.0, [3.0, 3.0, 3.0, 3.0, 3.0, 2.0, 1.0, 1.0]) @@ -117,9 +118,10 @@ add_requisite!(G,F,pre) curric = Curriculum("Postmodern Basket Weaving", [A,B,C,D,E,F,G], sortby_ID=false) -# Test is_valid_curriculum() +# Test isvalid_curriculum() and extraneous_requisites() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == true +@test extraneous_requisites(curric, errors) == false # Test analytics @test delay_factor(curric) == (32.0, [5.0, 5.0, 4.0, 5.0, 3.0, 5.0, 5.0]) @@ -157,9 +159,10 @@ add_requisite!(D,F,pre) curric = Curriculum("Underwater Basket Weaving", [A,B,C,D,E,F,G,H], institution="ACME State University", CIP="445786",sortby_ID=false) -# Test is_valid_curriculum() +# Test isvalid_curriculum() and extraneous_requisites() errors = IOBuffer() @test isvalid_curriculum(curric, errors) == true +@test extraneous_requisites(curric, errors) == false # Test basic_metrics() basic_metrics(curric) From a60dcc1ed2ac140fc5d19631982f66d2a4ec46a4 Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Wed, 21 Aug 2019 10:32:29 -0700 Subject: [PATCH 18/20] bug fix in curriclum constructor --- src/DataTypes.jl | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/DataTypes.jl b/src/DataTypes.jl index a173a437..a91cf6f3 100644 --- a/src/DataTypes.jl +++ b/src/DataTypes.jl @@ -269,19 +269,14 @@ mutable struct Curriculum this.metrics = Dict{String, Any}() this.learning_outcomes = learning_outcomes errors = IOBuffer() - if isvalid_curriculum(this, errors) - return this - else + if !(isvalid_curriculum(this, errors)) printstyled("WARNING: Curriculum was created, but is invalid due to requisite cycle(s):", color = :yellow) println(String(take!(errors))) - return this - end - # extraneous requisites are only checked if the curriculum is valid - if extraneous_requisites(this, errors) - printstyled("WARNING: Curriculum contains extraneous requisite(s).\n A list of extraneous requisites can be obtained by using the extraneous_requisites() function.", color = :yellow) + elseif extraneous_requisites(this, errors) # extraneous requisites only checked if the curriculum is valid + printstyled("WARNING: Curriculum contains extraneous requisite(s).\n List the extraneous requisites using the extraneous_requisites() function.", color = :yellow) take!(errors) # flush the error buffer - return this end + return this end end From 906bef8df175d96e3e60d1964b7fe592dd203b2a Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Wed, 21 Aug 2019 15:25:31 -0700 Subject: [PATCH 19/20] refactored basic_metrics(c::Curriculum) --- src/CurricularAnalytics.jl | 91 +++++++++++++++++++++++++++----------- src/DataTypes.jl | 2 +- src/GraphAlgs.jl | 12 +++-- 3 files changed, 74 insertions(+), 31 deletions(-) diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 61162d1e..53ea9d89 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -361,6 +361,30 @@ function complexity(c::Curriculum) return c.metrics["complexity"] = curric_complexity, course_complexity end +# Find all fo the longest paths in a curriculum. +""" + longest_paths(c) + +Finds longest paths in curriculum `c`, and returns an array of course arrays, where +each course array contains the courses in a longest path. + + # Arguments +Required: +- `c::Curriculum` : a valid curriculum. + +```julia-repl +julia> paths = longest_paths(c) +``` +""" +function longest_paths(c::Curriculum) + lps = Array{Array{Course,1},1}() + for path in longest_paths(c.graph) + c_path = courses_from_vertices(c, path) + push!(lps, c_path) + end + return c.metrics["longest paths"] = lps +end + # Compare the metrics associated with two curricula # to print out the report, use: println(String(take!(report))), where report is the IOBuffer returned by this function function compare_curricula(c1::Curriculum, c2::Curriculum) @@ -402,24 +426,24 @@ function compare_curricula(c1::Curriculum, c2::Curriculum) return report end -# Create a path as an array of courses from a path provided as vertex IDs. +# Create a list of courses or course names from a array of vertex IDs. # The array returned can be (keyword arguments): # -course data objects : object # -the names of courses : name # -the full names of courses (prefix, number, name) : fullname -function courses_from_vertices(curriculum::Curriculum, path::Array{Int,1}; course::String="object") +function courses_from_vertices(curriculum::Curriculum, vertices::Array{Int,1}; course::String="object") if course == "object" - course_path = Course[] + course_list = Course[] else - course_path = String[] + course_list = String[] end - for i in path - c = curriculum.courses[i] - course == "object" ? push!(course_path, c) : nothing - course == "name" ? push!(course_path, "$(c.name)") : nothing - course == "fullname" ? push!(course_path, "$(c.prefix) $(c.num) - $(c.name)") : nothing + for v in vertices + c = curriculum.courses[v] + course == "object" ? push!(course_list, c) : nothing + course == "name" ? push!(course_list, "$(c.name)") : nothing + course == "fullname" ? push!(course_list, "$(c.prefix) $(c.num) - $(c.name)") : nothing end - return course_path + return course_list end # Basic metrics for a currciulum. @@ -449,7 +473,7 @@ julia> curriculum.metrics """ function basic_metrics(curric::Curriculum) buf = IOBuffer() - complexity(curric), centrality(curric) # compute all curricular metrics + complexity(curric), centrality(curric), longest_paths(curric) # compute all curricular metrics max_bf = 0; max_df = 0; max_cc = 0; max_cent = 0 max_bf_courses = Array{Course,1}(); max_df_courses = Array{Course,1}(); max_cc_courses = Array{Course,1}(); max_cent_courses = Array{Course,1}() for c in curric.courses @@ -490,6 +514,8 @@ function basic_metrics(curric::Curriculum) curric.metrics["max. complexity"] = max_cc curric.metrics["max. complexity courses"] = max_cc_courses end + # write metrics to IO buffer + write(buf, "\n$(curric.institution) ") write(buf, "\nCurriculum: $(curric.name)\n") write(buf, " credit hours = $(curric.credit_hours)\n") write(buf, " number of courses = $(curric.num_courses)") @@ -497,35 +523,48 @@ function basic_metrics(curric::Curriculum) write(buf, " entire curriculum = $(curric.metrics["blocking factor"][1])\n") write(buf, " max. value = $(max_bf), ") write(buf, "for course(s): ") - write(buf, "$(max_bf_courses[1].prefix) $(max_bf_courses[1].num) $(max_bf_courses[1].name)") - for c in max_bf_courses[2:end] - write(buf, ", $(c.prefix) $(c.num) $(c.name)") - end + write_course_names(buf, max_bf_courses) write(buf, "\n Centrality --\n") write(buf, " entire curriculum = $(curric.metrics["centrality"][1])\n") write(buf, " max. value = $(max_cent), ") write(buf, "for course(s): ") - write(buf, "$(max_cent_courses[1].prefix) $(max_cent_courses[1].num) $(max_cent_courses[1].name)") - for c in max_cent_courses[2:end] - write(buf, ", $(c.prefix) $(c.num) $(c.name)") - end + write_course_names(buf, max_cent_courses) write(buf, "\n Delay Factor --\n") write(buf, " entire curriculum = $(curric.metrics["delay factor"][1])\n") write(buf, " max. value = $(max_df), ") write(buf, "for course(s): ") - write(buf, "$(max_df_courses[1].prefix) $(max_df_courses[1].num) $(max_df_courses[1].name)") - for c in max_df_courses[2:end] - write(buf, ", $(c.prefix) $(c.num) $(c.name)") - end + write_course_names(buf, max_df_courses) write(buf, "\n Complexity --\n") write(buf, " entire curriculum = $(curric.metrics["complexity"][1])\n") write(buf, " max. value = $(max_cc), ") write(buf, "for course(s): ") - write(buf, "$(max_cc_courses[1].prefix) $(max_cc_courses[1].num) $(max_cc_courses[1].name)") - for c in max_cc_courses[2:end] - write(buf, ", $(c.prefix) $(c.num) $(c.name)") + write_course_names(buf, max_cc_courses) + write(buf, "\n Longest Path(s) --\n") + write(buf, " length = $(length(curric.metrics["longest paths"][1])), number of paths = $(length(curric.metrics["longest paths"])), path(s):\n") + for path in curric.metrics["longest paths"] + write(buf, " ") + write_course_names(buf, path, separator=" -> ") + write(buf, "\n") end return buf end +function write_course_names(buf::IOBuffer, courses::Array{Course,1}; separator::String=", ") + if length(courses) == 1 + write_course_name(buf, courses[1]) + else + for c in courses[1:end-1] + write_course_name(buf, c) + write(buf, separator) + end + write_course_name(buf, courses[end]) + end +end + +function write_course_name(buf::IOBuffer, c::Course) + !isempty(c.prefix) ? write(buf, "$(c.prefix) ") : nothing + !isempty(c.num) ? write(buf, "$(c.pnum) - ") : nothing + write(buf, "$(c.name)") # name is a required item +end + end # module \ No newline at end of file diff --git a/src/DataTypes.jl b/src/DataTypes.jl index a91cf6f3..8e4c2580 100644 --- a/src/DataTypes.jl +++ b/src/DataTypes.jl @@ -273,7 +273,7 @@ mutable struct Curriculum printstyled("WARNING: Curriculum was created, but is invalid due to requisite cycle(s):", color = :yellow) println(String(take!(errors))) elseif extraneous_requisites(this, errors) # extraneous requisites only checked if the curriculum is valid - printstyled("WARNING: Curriculum contains extraneous requisite(s).\n List the extraneous requisites using the extraneous_requisites() function.", color = :yellow) + printstyled("WARNING: $(this.institution) Curriculum: $(this.name) contains extraneous requisite(s).\n You may list extraneous requisites using the extraneous_requisites() function.\n\n", color = :yellow) take!(errors) # flush the error buffer end return this diff --git a/src/GraphAlgs.jl b/src/GraphAlgs.jl index a116eb73..e15b47ef 100644 --- a/src/GraphAlgs.jl +++ b/src/GraphAlgs.jl @@ -272,7 +272,9 @@ function all_paths(g::AbstractGraph{T}) where T x[1] = u # put new neighbor at the head of array, replacing an in-neighbor end if length(inneighbors(g, u)) == 0 # reached a source vertex, done with path - push!(paths, x) + if !(x in paths) + push!(paths, x) + end else enqueue!(que, copy(x)) end @@ -319,7 +321,8 @@ end """ longest_paths(g) -Finds the length of the longest path in `g`, and returns all paths in `g` of that length. +Finds the set of longest paths in `g`, and returns an array of vertex arrays, where each vertex +array contains the vertices in a longest path. # Arguments Required: @@ -335,10 +338,11 @@ function longest_paths(g::AbstractGraph{T}) where T end lps = Array[] max = 0 - for path in all_paths(g) + paths = all_paths(g) + for path in paths # find length of longest path length(path) > max ? max = length(path) : nothing end - for path in all_paths(g) + for path in paths length(path) == max ? push!(lps, path) : nothing end return lps From 547193ff48b6eac4484f1fbd2c1138906efaec1f Mon Sep 17 00:00:00 2001 From: Greg Heileman Date: Wed, 21 Aug 2019 16:19:07 -0700 Subject: [PATCH 20/20] fixed issues so tests pass --- src/CurricularAnalytics.jl | 2 +- src/curriculum.csv | 19 +++++++++++++++++++ src/degree_plan.csv | 26 ++++++++++++++++++++++++++ test/CurricularAnalytics.jl | 6 +++--- 4 files changed, 49 insertions(+), 4 deletions(-) create mode 100644 src/curriculum.csv create mode 100644 src/degree_plan.csv diff --git a/src/CurricularAnalytics.jl b/src/CurricularAnalytics.jl index 53ea9d89..de437574 100644 --- a/src/CurricularAnalytics.jl +++ b/src/CurricularAnalytics.jl @@ -563,7 +563,7 @@ end function write_course_name(buf::IOBuffer, c::Course) !isempty(c.prefix) ? write(buf, "$(c.prefix) ") : nothing - !isempty(c.num) ? write(buf, "$(c.pnum) - ") : nothing + !isempty(c.num) ? write(buf, "$(c.num) - ") : nothing write(buf, "$(c.name)") # name is a required item end diff --git a/src/curriculum.csv b/src/curriculum.csv new file mode 100644 index 00000000..4b8bee76 --- /dev/null +++ b/src/curriculum.csv @@ -0,0 +1,19 @@ +Curriculum,Underwater Basket Weaving,,,,,,,, +Institution,ACME State University,,,,,,,, +Degree Type,AA,,,,,,,, +System Type,semester,,,,,,,, +CIP,445786,,,,,,,, +Courses,,,,,,,,, +Course ID,Course Name,Prefix,Number,Prerequisites,Corequisites,Strict-Corequisites,Credit Hours,Institution,Canonical Name +1,Introduction to Baskets,BW,101,,,,3,ACME State University,Baskets I +2,Swimming,PE,115,,,,3,ACME State University,Physical Education +3,Introductory Calculus w/ Basketry Applications,MA,116,,,,4,ACME State University,Calculus I +4,Basic Basket Forms,BW,111,1,,5,3,ACME State University,Baskets II +5,Basic Basket Forms Lab,BW,111L,,,,1,ACME State University,Baskets II Laboratory +6,Advanced Basketry,BW,201,"4;5",3,,3,ACME State University,Baskets III +7,Basket Materials & Decoration,BW,214,1,,,3,ACME State University,Basket Materials +8,Underwater Weaving,BW,301,2,7,,3,ACME State University,Baskets IV +9,Humanitites Elective,,,,,,3,ACME State University,Humanitites Core +10,Social Sciences Elective,,,,,,3,ACME State University, +11,Technical Elective,,,,,,3,ACME State University, +12,General Elective,,,,,,3,ACME State University, \ No newline at end of file diff --git a/src/degree_plan.csv b/src/degree_plan.csv new file mode 100644 index 00000000..6e852185 --- /dev/null +++ b/src/degree_plan.csv @@ -0,0 +1,26 @@ +Curriculum,Underwater Basket Weaving,,,,,,,,, +Degree Plan,4-Term Plan,,,,,,,,, +Institution,ACME State University,,,,,,,,, +Degree Type,AA,,,,,,,,, +System Type,semester,,,,,,,,, +CIP,445786,,,,,,,,, +Courses,,,,,,,,,, +Course ID,Course Name,Prefix,Number,Prerequisites,Corequisites,Strict-Corequisites,Credit Hours,Institution,Canonical Name,Term +1,Introduction to Baskets,BW,101,,,,3,ACME State University,Baskets I,2 +2,Swimming,PE,115,,,,3,ACME State University,Physical Education,1 +3,Introductory Calculus w/ Basketry Applications,MA,116,13,,,4,ACME State University,Calculus I,3 +4,Basic Basket Forms,BW,111,1,,5,3,ACME State University,Baskets II,2 +5,Basic Basket Forms Lab,BW,111L,,,,1,ACME State University,Baskets II Laboratory,2 +6,Advanced Basketry,BW,201,"4;5",3,,3,ACME State University,Baskets III,3 +7,Basket Materials & Decoration,BW,214,1,,,3,ACME State University,Basket Materials,3 +8,Underwater Weaving,BW,301,2,7,,3,ACME State University,Baskets IV,4 +9,Humanitites Elective,,,,,,3,ACME State University,Humanitites Core,4 +10,Social Sciences Elective,,,,,,3,ACME State University,,3 +11,Technical Elective,,,,,,3,ACME State University,,4 +12,General Elective,,,,,,3,ACME State University,,2 +Additional Courses,,,,,,,,,, +Course ID,Course Name,Prefix,Number,Prerequisites,Corequisites,Strict-Corequisites,Credit Hours,Institution,Canonical Name,Term +13,Precalculus w/ Basketry Applications,MA,110,14,,,3,ACME State University,Precalculus,2 +14,College Algebra,MA,102,,,15,3,ACME State University,College Algebra,1 +15,College Algebra Studio,MA,102S,,,,1,ACME State University,College Algebra Recitation,1 +16,Hemp Baskets,BW,420,,6,,3,ACME State University,College Algebra Recitation,4 \ No newline at end of file diff --git a/test/CurricularAnalytics.jl b/test/CurricularAnalytics.jl index a08c192e..187d2ea8 100644 --- a/test/CurricularAnalytics.jl +++ b/test/CurricularAnalytics.jl @@ -82,7 +82,7 @@ errors = IOBuffer() # Test analytics @test delay_factor(curric) == (19.0, [3.0, 3.0, 3.0, 3.0, 3.0, 2.0, 1.0, 1.0]) @test blocking_factor(curric) == (8, [2, 2, 1, 3, 0, 0, 0, 0]) -@test centrality(curric) == (9, [0, 0, 9, 0, 0, 0, 0, 0]) +@test centrality(curric) == (3, [0, 0, 3, 0, 0, 0, 0, 0]) @test complexity(curric) == (27.0, [5.0, 5.0, 4.0, 6.0, 3.0, 2.0, 1.0, 1.0]) # Curric: 7-vertex test curriculum - valid @@ -170,12 +170,12 @@ basic_metrics(curric) @test curric.num_courses == 8 @test curric.metrics["blocking factor"] == (8, [2, 2, 1, 3, 0, 0, 0, 0]) @test curric.metrics["delay factor"] == (19.0, [3.0, 3.0, 3.0, 3.0, 3.0, 2.0, 1.0, 1.0]) -@test curric.metrics["centrality"] == (9, [0, 0, 9, 0, 0, 0, 0, 0]) +@test curric.metrics["centrality"] == (3, [0, 0, 3, 0, 0, 0, 0, 0]) @test curric.metrics["complexity"] == (27.0, [5.0, 5.0, 4.0, 6.0, 3.0, 2.0, 1.0, 1.0]) @test curric.metrics["max. blocking factor"] == 3 @test length(curric.metrics["max. blocking factor courses"]) == 1 @test curric.metrics["max. blocking factor courses"][1].name == "Basic Basket Forms Lab" -@test curric.metrics["max. centrality"] == 9 +@test curric.metrics["max. centrality"] == 3 @test length(curric.metrics["max. centrality courses"]) == 1 @test curric.metrics["max. centrality courses"][1].name == "Basic Basket Forms" @test curric.metrics["max. delay factor"] == 3.0