All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.actelion.research.chem.descriptor.pharmacophoretree.TreeUtils Maven / Gradle / Ivy

There is a newer version: 2024.11.2
Show newest version
package com.actelion.research.chem.descriptor.pharmacophoretree;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class TreeUtils {
	
	
	/*
	 * insert an element into an sorted array of length N. Only insert if index is smaller than N
	 */
	
	private static void binaryInsert(double[] arr, int[][] indexPairs, double val, int[] indexPair) {
		int n = arr.length;
		int index = Arrays.binarySearch(arr, val);
		if(index<0) 
			index=-index-1;		
		else 
			index = index +1;
		if(index> getAdjacencyList(int n, List edges) {
		
		Map> adjacencyList = new HashMap>();
		for(int i=0;i());
		
		for(int[] edge : edges) {
			int n1 = edge[0];
			int n2 = edge[1];
			adjacencyList.get(n1).add(n2);
			adjacencyList.get(n2).add(n1);
		}
		return adjacencyList;
		
	}
	
	public static Map> getAdjacencyListWithBondOrders(int n, List edges) {
		Map> adjacencyList = new HashMap>();
		for(int i=0;i());
		
		for(PharmacophoreTree.BiGramInt edge : edges) {
			int n1 = edge.edge[0];
			int n2 = edge.edge[1];
			adjacencyList.get(n1).put(n2,edge.order);
			adjacencyList.get(n2).put(n1, edge.order);
		}
		return adjacencyList;
	}

	

	
	

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy