private int[] Identify_all_neighborIndexes_that_are_siblings_recursive(int indexNW) { Already_considered_neighbors.Add(indexNW, true); Network_line_class nw_line = Process_nw.NW[indexNW]; NetworkNode_line_class this_node_line = Process_nw.Nodes.Get_indexed_node_line_if_index_is_correct(indexNW); NetworkNode_line_class target_node_line; int targets_length = nw_line.Targets_length; Network_target_line_class target_line; List <int> all_neighborIndexes_that_are_siblings_list = new List <int>(); for (int indexT = 0; indexT < targets_length; indexT++) { target_line = nw_line.Targets[indexT]; if (!Already_considered_neighbors.ContainsKey(target_line.NW_index)) { target_node_line = Process_nw.Nodes.Get_indexed_node_line_if_index_is_correct(target_line.NW_index); if ((ProcessName_siblingNames_dict.ContainsKey(this_node_line.Name)) && (ProcessName_siblingNames_dict[this_node_line.Name].Contains(target_node_line.Name))) { all_neighborIndexes_that_are_siblings_list.Add(target_line.NW_index); all_neighborIndexes_that_are_siblings_list.AddRange(Identify_all_neighborIndexes_that_are_siblings_recursive(target_line.NW_index)); } } } return(all_neighborIndexes_that_are_siblings_list.ToArray()); }
private void Generate_and_add_yed_node_color_lines_for_all_neighbors_that_are_siblings(int indexNW) { Network_line_class nw_line = Process_nw.NW[indexNW]; NetworkNode_line_class this_node_line = Process_nw.Nodes.Get_indexed_node_line_if_index_is_correct(indexNW); if (!NodeIndex_colorIndex_dict.ContainsKey(indexNW)) { Already_considered_neighbors.Clear(); int[] all_neighborIndexes_siblings = Identify_all_neighborIndexes_that_are_siblings_recursive(indexNW); int indexColor = Identify_free_colorIndex_that_is_not_used_by_neighbors(all_neighborIndexes_siblings); Generate_new_yed_node_color_line_and_add_to_dictionary_and_list(indexNW, indexColor); int all_neighborIndexes_siblings_length = all_neighborIndexes_siblings.Length; int neighborIndex_sibling; for (int indexS = 0; indexS < all_neighborIndexes_siblings_length; indexS++) { neighborIndex_sibling = all_neighborIndexes_siblings[indexS]; if (!NodeIndex_colorIndex_dict.ContainsKey(neighborIndex_sibling)) { Generate_new_yed_node_color_line_and_add_to_dictionary_and_list(neighborIndex_sibling, indexColor); } else { throw new Exception(); } } } }
private void Generate_new_yed_node_color_line_and_add_to_dictionary_and_list(int indexNW, int indexColor) { Color_enum current_rotation_color = Rotation_colors[indexColor]; NetworkNode_line_class node_line = Process_nw.Nodes.Get_indexed_node_line_if_index_is_correct(indexNW); yed_node_color_line_class new_node_color_line = new yed_node_color_line_class(); new_node_color_line.Hexadecimal_color = Hexadecimal_color_class.Get_hexadecimial_code_for_color(current_rotation_color); new_node_color_line.NodeName = (string)node_line.Name.Clone(); NodeIndex_colorIndex_dict.Add(indexNW, indexColor); Color_lines_list.Add(new_node_color_line); }