An Algorithm to Construct Network Motifs for Bioinformatics Study